Skip to content

Commit 141d65e

Browse files
authored
Feat: Adds interactive analysis pause (#302)
* implemented interactive-session list * adds the interactive session creation * refined in testing * changelog * fix lisitng status error * changed error message for invalid credentials * fix error message * removed tmp files * updates docs * added cis * fix typo in ci * fix typo in ci * fix typo in ci * cleanup * address sentry * removed gitlab token from cis * removed gitlab token from cis * added azzure interactive-session creation support * cleanup * added azure cis * fix typo * fix azure cis * fix cis * address sentry * fix typo in ci * address sentry * draft implementation * changed table to print full id * address sentry * refined implementation in testing * updated docs * changelog * addded cis * fix cis * address sentry * draft implementation * refined implementation and testing * changelog * updated docs * changed tip in the creation command * address sentry * added cis * changed status name to paused * addressed dani's comments * fix typo in merge * fix typo in merge * fix typo in merge * fix typo in merge * addressed sentry * address sentry * address part of danis comments * addressed rest of comments
1 parent f49adfe commit 141d65e

9 files changed

Lines changed: 713 additions & 42 deletions

File tree

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,31 @@ jobs:
977977
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
978978
run: |
979979
cloudos interactive-session status --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID
980+
interactive_session_pause:
981+
needs: interactive_session_create
982+
runs-on: ubuntu-latest
983+
strategy:
984+
matrix:
985+
python-version: ["3.9"]
986+
steps:
987+
- uses: actions/checkout@v3
988+
- name: Set up Python ${{ matrix.python-version }}
989+
uses: actions/setup-python@v4
990+
with:
991+
python-version: ${{ matrix.python-version }}
992+
cache: pip
993+
cache-dependency-path: setup.py
994+
- name: Install dependencies
995+
run: |
996+
pip install -e .
997+
- name: Pause interactive session
998+
env:
999+
CLOUDOS_TOKEN: ${{ secrets.CLOUDOS_TOKEN_ADAPT }}
1000+
CLOUDOS_WORKSPACE_ID: ${{ secrets.CLOUDOS_WORKSPACE_ID_ADAPT }}
1001+
CLOUDOS_URL: "https://cloudos.lifebit.ai"
1002+
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
1003+
run: |
1004+
cloudos interactive-session pause --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID --yes
9801005
9811006
9821007

.github/workflows/ci_az.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,4 +765,30 @@ jobs:
765765
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
766766
run: |
767767
cloudos interactive-session status --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID
768+
interactive_session_pause:
769+
needs: interactive_session_create
770+
runs-on: ubuntu-latest
771+
strategy:
772+
matrix:
773+
python-version: ["3.9"]
774+
steps:
775+
- uses: actions/checkout@v3
776+
- name: Set up Python ${{ matrix.python-version }}
777+
uses: actions/setup-python@v4
778+
with:
779+
python-version: ${{ matrix.python-version }}
780+
cache: pip
781+
cache-dependency-path: setup.py
782+
- name: Install dependencies
783+
run: |
784+
pip install -e .
785+
- name: Pause interactive session
786+
env:
787+
CLOUDOS_TOKEN: ${{ secrets.CLOUDOS_TOKEN_AZURE }}
788+
CLOUDOS_WORKSPACE_ID: ${{ secrets.CLOUDOS_WORKSPACE_ID_AZURE }}
789+
CLOUDOS_URL: "https://dev.sdlc.lifebit.ai"
790+
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
791+
run: |
792+
cloudos interactive-session pause --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID --yes
793+
768794

.github/workflows/ci_dev.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,3 +983,28 @@ jobs:
983983
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
984984
run: |
985985
cloudos interactive-session status --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID
986+
interactive_session_pause:
987+
needs: interactive_session_create
988+
runs-on: ubuntu-latest
989+
strategy:
990+
matrix:
991+
python-version: ["3.9"]
992+
steps:
993+
- uses: actions/checkout@v3
994+
- name: Set up Python ${{ matrix.python-version }}
995+
uses: actions/setup-python@v4
996+
with:
997+
python-version: ${{ matrix.python-version }}
998+
cache: pip
999+
cache-dependency-path: setup.py
1000+
- name: Install dependencies
1001+
run: |
1002+
pip install -e .
1003+
- name: Pause interactive session
1004+
env:
1005+
CLOUDOS_TOKEN: ${{ secrets.CLOUDOS_TOKEN_DEV }}
1006+
CLOUDOS_WORKSPACE_ID: ${{ secrets.CLOUDOS_WORKSPACE_ID_DEV }}
1007+
CLOUDOS_URL: "https://dev.sdlc.lifebit.ai"
1008+
SESSION_ID: ${{ needs.interactive_session_create.outputs.session_id }}
1009+
run: |
1010+
cloudos interactive-session pause --cloudos-url $CLOUDOS_URL --apikey $CLOUDOS_TOKEN --workspace-id $CLOUDOS_WORKSPACE_ID --session-id $SESSION_ID --yes

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## lifebit-ai/cloudos-cli: changelog
22

3+
## v2.85.0 (2026-03-20)
4+
5+
### Feat
6+
7+
- Adds pausing of an interactive session
8+
39
## v2.84.0 (2026-03-19)
410

511
### Feat

README.md

Lines changed: 162 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Python package for interacting with CloudOS
6666
- [Interactive Sessions](#interactive-sessions)
6767
- [List Interactive Sessions](#list-interactive-sessions)
6868
- [Get Interactive Session Status](#get-interactive-session-status)
69+
- [Pause Interactive Session](#pause-interactive-session)
6970
- [Create Interactive Session](#create-interactive-session)
7071
- [Datasets](#datasets)
7172
- [List Files](#list-files)
@@ -1972,9 +1973,9 @@ The table displays sessions with pagination controls (press `n` for next page, `
19721973
┏━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┓
19731974
┃ Status ┃ Name ┃ Type ┃ ID ┃ Owner ┃
19741975
┡━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━┩
1975-
stopped │ cloudosR │ awsRstudio │ 69aee0dba197… │ Leila │
1976-
│ running │ analysis-dev │ awsJupyterNotebook │ 69ae972a18f0… │ John │
1977-
stopped │ test_session │ awsVSCode │ 69a996c098ab… │ James │
1976+
paused │ cloudosR │ RStudio │ 69aee0dba197… │ Leila │
1977+
│ running │ analysis-dev │ Jupyter │ 69ae972a18f0… │ John │
1978+
paused │ test_session │ VS Code │ 69a996c098ab… │ James │
19781979
└─────────┴──────────────┴────────────────────┴───────────────┴────────┘
19791980
19801981
Total sessions: 15
@@ -2012,7 +2013,7 @@ Interactive session list saved to interactive_sessions_list.json
20122013
You can filter sessions by status and other criteria:
20132014

20142015
```bash
2015-
# Filter by status (setup, initialising, running, scheduled, stopped)
2016+
# Filter by status (setup, initialising, running, scheduled, paused)
20162017
cloudos interactive-session list --profile my_profile --filter-status running
20172018
20182019
# Show only your own sessions
@@ -2090,7 +2091,7 @@ Status changed: provisioning → running
20902091
**Watch Mode Behavior**
20912092

20922093
- **Pre-running sessions** (setup, initialising, scheduled): Watch mode will continuously poll and display status changes every 30 seconds (default)
2093-
- **Running/stopped sessions**: Watch mode will show a warning and display the current status instead
2094+
- **Running/paused sessions**: Watch mode will show a warning and display the current status instead
20942095

20952096
Example with a running session:
20962097

@@ -2159,6 +2160,161 @@ cloudos interactive-session status --session-id <SESSION_ID> --profile my_profil
21592160
# Creates: /tmp/session_status.csv
21602161
```
21612162

2163+
#### Pause Interactive Session
2164+
2165+
You can pause and terminate a running interactive session using the `cloudos interactive-session pause` command. This command gracefully shuts down the session and optionally saves session data before termination.
2166+
2167+
**Basic Usage**
2168+
2169+
Pause a session with confirmation:
2170+
2171+
```bash
2172+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2173+
```
2174+
2175+
The command displays a confirmation prompt:
2176+
2177+
```console
2178+
About to pause session: 69bd11ca02326c5b3649f5c1
2179+
Upload data before pausing: True
2180+
Force immediate termination: False
2181+
Continue? [y/N]: y
2182+
2183+
✓ Session pause request sent successfully.
2184+
You can monitor the session status using: cloudos interactive-session status --session-id 69bd11ca02326c5b3649f5c1
2185+
```
2186+
2187+
**Skip Confirmation Prompt**
2188+
2189+
Use the `-y` or `--yes` flag to skip the confirmation prompt:
2190+
2191+
```bash
2192+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile -y
2193+
```
2194+
2195+
**Data Management Options**
2196+
2197+
By default, session data is saved to S3 before pausing. Use `--no-upload` to skip data saving (use with caution):
2198+
2199+
```bash
2200+
# Save session data before pausing (default)
2201+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2202+
2203+
# Skip saving data (use with caution)
2204+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --no-upload
2205+
```
2206+
2207+
**Termination Modes**
2208+
2209+
**Graceful Shutdown (default)**
2210+
2211+
Allows the session to clean up resources and save data before terminating:
2212+
2213+
```bash
2214+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2215+
```
2216+
2217+
**Force Immediate Termination**
2218+
2219+
Bypass graceful shutdown for immediate termination (useful for stuck sessions):
2220+
2221+
```bash
2222+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --force
2223+
```
2224+
2225+
Use `--force` with caution as it may not save session data properly.
2226+
2227+
**Wait for Termination**
2228+
2229+
Use the `--wait` flag to monitor the session until it reaches a terminal state:
2230+
2231+
```bash
2232+
cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --wait
2233+
```
2234+
2235+
Output with `--wait`:
2236+
2237+
```console
2238+
Pausing session...
2239+
Status: shutting_down
2240+
Status: uploading_data
2241+
Status: cleaning_up
2242+
Status: stopped
2243+
✓ Session paused successfully
2244+
```
2245+
2246+
**Error Handling**
2247+
2248+
The command provides helpful error messages for common issues:
2249+
2250+
```console
2251+
# Trying to pause an already paused session
2252+
Error: Cannot pause session - the session is already paused.
2253+
Tip: Check the session status with: cloudos interactive-session status --session-id <SESSION_ID>
2254+
2255+
# Trying to pause a session that is already being paused
2256+
Error: Cannot pause session - the session is already being paused.
2257+
Tip: Wait a moment and check status with: cloudos interactive-session status --session-id <SESSION_ID>
2258+
```
2259+
2260+
**Examples**
2261+
2262+
Basic pause with confirmation:
2263+
2264+
```bash
2265+
cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a
2266+
```
2267+
2268+
Pause without saving data and skip confirmation:
2269+
2270+
```bash
2271+
cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a --no-upload -y
2272+
```
2273+
2274+
Force pause and wait for termination:
2275+
2276+
```bash
2277+
cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a --force -y --wait
2278+
```
2279+
2280+
Pause using profile configuration:
2281+
2282+
```bash
2283+
cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --profile my_profile --wait
2284+
```
2285+
2286+
Pause with verbose output:
2287+
2288+
```bash
2289+
cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --profile my_profile --verbose
2290+
```
2291+
2292+
**Options Reference**
2293+
2294+
The command automatically loads from profile (via `@with_profile_config` decorator):
2295+
- **From Profile**: apikey, cloudos-url, workspace-id
2296+
- **Command Line**: Additional options and behaviors
2297+
2298+
**Required:**
2299+
- `--session-id`: The session ID to pause (24-character hex string)
2300+
2301+
**Optional Overrides from Profile:**
2302+
- `--apikey` (optional): Override API key from profile
2303+
- `--cloudos-url` (optional): Override CloudOS URL from profile
2304+
- `--workspace-id` (optional): Override workspace ID from profile
2305+
2306+
**Optional Behavior Flags:**
2307+
- `--no-upload`: Don't save session data before pausing (default: saves data)
2308+
- `--force`: Force immediate termination, skip graceful shutdown (default: graceful). **Warning:** Shows a warning message that some data may not be saved.
2309+
- `--wait`: Wait for session to fully pause (default: return immediately after sending pause command)
2310+
- `-y, --yes`: Skip confirmation prompt (default: show confirmation)
2311+
- `--verbose`: Show detailed progress messages
2312+
2313+
**Optional Connection:**
2314+
- `--disable-ssl-verification`: Disable SSL certificate verification (not recommended)
2315+
- `--ssl-cert`: Path to SSL certificate file
2316+
- `--profile`: Profile to use from config file (default: default profile)
2317+
21622318
#### Create Interactive Session
21632319

21642320
You can create and start a new interactive session using the `cloudos interactive-session create` command. This command provisions a new virtual environment with your specified configuration.
@@ -2293,7 +2449,7 @@ The output shows the session details including:
22932449
- Session ID
22942450
- Session name
22952451
- Backend type (jupyter, vscode, rstudio, spark)
2296-
- Current status (scheduled, initialising, setup, running, stopped)
2452+
- Current status (scheduled, initialising, setup, running, paused)
22972453

22982454

22992455
### Datasets

cloudos_cli/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.84.0'
1+
__version__ = '2.85.0'

0 commit comments

Comments
 (0)