cloudos-cli 2.84.0__tar.gz → 2.85.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/PKG-INFO +163 -7
  2. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/README.md +162 -6
  3. cloudos_cli-2.85.0/cloudos_cli/_version.py +1 -0
  4. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/clos.py +67 -1
  5. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/interactive_session/cli.py +229 -4
  6. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/interactive_session/interactive_session.py +172 -30
  7. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/PKG-INFO +163 -7
  8. cloudos_cli-2.84.0/cloudos_cli/_version.py +0 -1
  9. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/LICENSE +0 -0
  10. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/__init__.py +0 -0
  11. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/__main__.py +0 -0
  12. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/bash/__init__.py +0 -0
  13. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/bash/cli.py +0 -0
  14. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/configure/__init__.py +0 -0
  15. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/configure/cli.py +0 -0
  16. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/configure/configure.py +0 -0
  17. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/constants.py +0 -0
  18. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/cost/__init__.py +0 -0
  19. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/cost/cost.py +0 -0
  20. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/cromwell/__init__.py +0 -0
  21. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/cromwell/cli.py +0 -0
  22. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/datasets/__init__.py +0 -0
  23. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/datasets/cli.py +0 -0
  24. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/datasets/datasets.py +0 -0
  25. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/import_wf/__init__.py +0 -0
  26. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  27. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/interactive_session/__init__.py +0 -0
  28. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/jobs/__init__.py +0 -0
  29. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/jobs/cli.py +0 -0
  30. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/jobs/job.py +0 -0
  31. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/link/__init__.py +0 -0
  32. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/link/cli.py +0 -0
  33. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/link/link.py +0 -0
  34. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/logging/__init__.py +0 -0
  35. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/logging/logger.py +0 -0
  36. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/procurement/__init__.py +0 -0
  37. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/procurement/cli.py +0 -0
  38. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/procurement/images.py +0 -0
  39. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/projects/__init__.py +0 -0
  40. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/projects/cli.py +0 -0
  41. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/queue/__init__.py +0 -0
  42. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/queue/cli.py +0 -0
  43. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/queue/queue.py +0 -0
  44. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/related_analyses/__init__.py +0 -0
  45. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/related_analyses/related_analyses.py +0 -0
  46. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/__init__.py +0 -0
  47. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/array_job.py +0 -0
  48. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/cli_helpers.py +0 -0
  49. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/cloud.py +0 -0
  50. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/details.py +0 -0
  51. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/errors.py +0 -0
  52. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/last_wf.py +0 -0
  53. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/requests.py +0 -0
  54. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/utils/resources.py +0 -0
  55. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/workflows/__init__.py +0 -0
  56. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli/workflows/cli.py +0 -0
  57. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/SOURCES.txt +0 -0
  58. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  59. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  60. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/requires.txt +0 -0
  61. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  62. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/setup.cfg +0 -0
  63. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/setup.py +0 -0
  64. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/__init__.py +0 -0
  65. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/functions_for_pytest.py +0 -0
  66. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_cli_project_create.py +0 -0
  67. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_cost/__init__.py +0 -0
  68. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_cost/test_job_cost.py +0 -0
  69. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_error_messages.py +0 -0
  70. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_interactive_session/__init__.py +0 -0
  71. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_interactive_session/test_create_session.py +0 -0
  72. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_interactive_session/test_list_sessions.py +0 -0
  73. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_logging/__init__.py +0 -0
  74. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_logging/test_logger.py +0 -0
  75. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_related_analyses/__init__.py +0 -0
  76. {cloudos_cli-2.84.0 → cloudos_cli-2.85.0}/tests/test_related_analyses/test_related_analyses.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.84.0
3
+ Version: 2.85.0
4
4
  Summary: Python package for interacting with CloudOS
5
5
  Home-page: https://github.com/lifebit-ai/cloudos-cli
6
6
  Author: David Piñeyro
@@ -101,6 +101,7 @@ Python package for interacting with CloudOS
101
101
  - [Interactive Sessions](#interactive-sessions)
102
102
  - [List Interactive Sessions](#list-interactive-sessions)
103
103
  - [Get Interactive Session Status](#get-interactive-session-status)
104
+ - [Pause Interactive Session](#pause-interactive-session)
104
105
  - [Create Interactive Session](#create-interactive-session)
105
106
  - [Datasets](#datasets)
106
107
  - [List Files](#list-files)
@@ -2007,9 +2008,9 @@ The table displays sessions with pagination controls (press `n` for next page, `
2007
2008
  ┏━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┓
2008
2009
  ┃ Status ┃ Name ┃ Type ┃ ID ┃ Owner ┃
2009
2010
  ┡━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━┩
2010
- stopped │ cloudosR │ awsRstudio │ 69aee0dba197… │ Leila │
2011
- │ running │ analysis-dev │ awsJupyterNotebook │ 69ae972a18f0… │ John │
2012
- stopped │ test_session │ awsVSCode │ 69a996c098ab… │ James │
2011
+ paused │ cloudosR │ RStudio │ 69aee0dba197… │ Leila │
2012
+ │ running │ analysis-dev │ Jupyter │ 69ae972a18f0… │ John │
2013
+ paused │ test_session │ VS Code │ 69a996c098ab… │ James │
2013
2014
  └─────────┴──────────────┴────────────────────┴───────────────┴────────┘
2014
2015
 
2015
2016
  Total sessions: 15
@@ -2047,7 +2048,7 @@ Interactive session list saved to interactive_sessions_list.json
2047
2048
  You can filter sessions by status and other criteria:
2048
2049
 
2049
2050
  ```bash
2050
- # Filter by status (setup, initialising, running, scheduled, stopped)
2051
+ # Filter by status (setup, initialising, running, scheduled, paused)
2051
2052
  cloudos interactive-session list --profile my_profile --filter-status running
2052
2053
 
2053
2054
  # Show only your own sessions
@@ -2125,7 +2126,7 @@ Status changed: provisioning → running
2125
2126
  **Watch Mode Behavior**
2126
2127
 
2127
2128
  - **Pre-running sessions** (setup, initialising, scheduled): Watch mode will continuously poll and display status changes every 30 seconds (default)
2128
- - **Running/stopped sessions**: Watch mode will show a warning and display the current status instead
2129
+ - **Running/paused sessions**: Watch mode will show a warning and display the current status instead
2129
2130
 
2130
2131
  Example with a running session:
2131
2132
 
@@ -2194,6 +2195,161 @@ cloudos interactive-session status --session-id <SESSION_ID> --profile my_profil
2194
2195
  # Creates: /tmp/session_status.csv
2195
2196
  ```
2196
2197
 
2198
+ #### Pause Interactive Session
2199
+
2200
+ 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.
2201
+
2202
+ **Basic Usage**
2203
+
2204
+ Pause a session with confirmation:
2205
+
2206
+ ```bash
2207
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2208
+ ```
2209
+
2210
+ The command displays a confirmation prompt:
2211
+
2212
+ ```console
2213
+ About to pause session: 69bd11ca02326c5b3649f5c1
2214
+ Upload data before pausing: True
2215
+ Force immediate termination: False
2216
+ Continue? [y/N]: y
2217
+
2218
+ ✓ Session pause request sent successfully.
2219
+ You can monitor the session status using: cloudos interactive-session status --session-id 69bd11ca02326c5b3649f5c1
2220
+ ```
2221
+
2222
+ **Skip Confirmation Prompt**
2223
+
2224
+ Use the `-y` or `--yes` flag to skip the confirmation prompt:
2225
+
2226
+ ```bash
2227
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile -y
2228
+ ```
2229
+
2230
+ **Data Management Options**
2231
+
2232
+ By default, session data is saved to S3 before pausing. Use `--no-upload` to skip data saving (use with caution):
2233
+
2234
+ ```bash
2235
+ # Save session data before pausing (default)
2236
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2237
+
2238
+ # Skip saving data (use with caution)
2239
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --no-upload
2240
+ ```
2241
+
2242
+ **Termination Modes**
2243
+
2244
+ **Graceful Shutdown (default)**
2245
+
2246
+ Allows the session to clean up resources and save data before terminating:
2247
+
2248
+ ```bash
2249
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile
2250
+ ```
2251
+
2252
+ **Force Immediate Termination**
2253
+
2254
+ Bypass graceful shutdown for immediate termination (useful for stuck sessions):
2255
+
2256
+ ```bash
2257
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --force
2258
+ ```
2259
+
2260
+ Use `--force` with caution as it may not save session data properly.
2261
+
2262
+ **Wait for Termination**
2263
+
2264
+ Use the `--wait` flag to monitor the session until it reaches a terminal state:
2265
+
2266
+ ```bash
2267
+ cloudos interactive-session pause --session-id <SESSION_ID> --profile my_profile --wait
2268
+ ```
2269
+
2270
+ Output with `--wait`:
2271
+
2272
+ ```console
2273
+ Pausing session...
2274
+ Status: shutting_down
2275
+ Status: uploading_data
2276
+ Status: cleaning_up
2277
+ Status: stopped
2278
+ ✓ Session paused successfully
2279
+ ```
2280
+
2281
+ **Error Handling**
2282
+
2283
+ The command provides helpful error messages for common issues:
2284
+
2285
+ ```console
2286
+ # Trying to pause an already paused session
2287
+ Error: Cannot pause session - the session is already paused.
2288
+ Tip: Check the session status with: cloudos interactive-session status --session-id <SESSION_ID>
2289
+
2290
+ # Trying to pause a session that is already being paused
2291
+ Error: Cannot pause session - the session is already being paused.
2292
+ Tip: Wait a moment and check status with: cloudos interactive-session status --session-id <SESSION_ID>
2293
+ ```
2294
+
2295
+ **Examples**
2296
+
2297
+ Basic pause with confirmation:
2298
+
2299
+ ```bash
2300
+ cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a
2301
+ ```
2302
+
2303
+ Pause without saving data and skip confirmation:
2304
+
2305
+ ```bash
2306
+ cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a --no-upload -y
2307
+ ```
2308
+
2309
+ Force pause and wait for termination:
2310
+
2311
+ ```bash
2312
+ cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --workspace-id 687fb9905c45270e09db1e9a --force -y --wait
2313
+ ```
2314
+
2315
+ Pause using profile configuration:
2316
+
2317
+ ```bash
2318
+ cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --profile my_profile --wait
2319
+ ```
2320
+
2321
+ Pause with verbose output:
2322
+
2323
+ ```bash
2324
+ cloudos interactive-session pause --session-id 688351ab6be610972db54a8e --profile my_profile --verbose
2325
+ ```
2326
+
2327
+ **Options Reference**
2328
+
2329
+ The command automatically loads from profile (via `@with_profile_config` decorator):
2330
+ - **From Profile**: apikey, cloudos-url, workspace-id
2331
+ - **Command Line**: Additional options and behaviors
2332
+
2333
+ **Required:**
2334
+ - `--session-id`: The session ID to pause (24-character hex string)
2335
+
2336
+ **Optional Overrides from Profile:**
2337
+ - `--apikey` (optional): Override API key from profile
2338
+ - `--cloudos-url` (optional): Override CloudOS URL from profile
2339
+ - `--workspace-id` (optional): Override workspace ID from profile
2340
+
2341
+ **Optional Behavior Flags:**
2342
+ - `--no-upload`: Don't save session data before pausing (default: saves data)
2343
+ - `--force`: Force immediate termination, skip graceful shutdown (default: graceful). **Warning:** Shows a warning message that some data may not be saved.
2344
+ - `--wait`: Wait for session to fully pause (default: return immediately after sending pause command)
2345
+ - `-y, --yes`: Skip confirmation prompt (default: show confirmation)
2346
+ - `--verbose`: Show detailed progress messages
2347
+
2348
+ **Optional Connection:**
2349
+ - `--disable-ssl-verification`: Disable SSL certificate verification (not recommended)
2350
+ - `--ssl-cert`: Path to SSL certificate file
2351
+ - `--profile`: Profile to use from config file (default: default profile)
2352
+
2197
2353
  #### Create Interactive Session
2198
2354
 
2199
2355
  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.
@@ -2328,7 +2484,7 @@ The output shows the session details including:
2328
2484
  - Session ID
2329
2485
  - Session name
2330
2486
  - Backend type (jupyter, vscode, rstudio, spark)
2331
- - Current status (scheduled, initialising, setup, running, stopped)
2487
+ - Current status (scheduled, initialising, setup, running, paused)
2332
2488
 
2333
2489
 
2334
2490
  ### Datasets
@@ -66,6 +66,7 @@ Python package for interacting with CloudOS
66
66
  - [Interactive Sessions](#interactive-sessions)
67
67
  - [List Interactive Sessions](#list-interactive-sessions)
68
68
  - [Get Interactive Session Status](#get-interactive-session-status)
69
+ - [Pause Interactive Session](#pause-interactive-session)
69
70
  - [Create Interactive Session](#create-interactive-session)
70
71
  - [Datasets](#datasets)
71
72
  - [List Files](#list-files)
@@ -1972,9 +1973,9 @@ The table displays sessions with pagination controls (press `n` for next page, `
1972
1973
  ┏━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┓
1973
1974
  ┃ Status ┃ Name ┃ Type ┃ ID ┃ Owner ┃
1974
1975
  ┡━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━┩
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 │
1978
1979
  └─────────┴──────────────┴────────────────────┴───────────────┴────────┘
1979
1980
 
1980
1981
  Total sessions: 15
@@ -2012,7 +2013,7 @@ Interactive session list saved to interactive_sessions_list.json
2012
2013
  You can filter sessions by status and other criteria:
2013
2014
 
2014
2015
  ```bash
2015
- # Filter by status (setup, initialising, running, scheduled, stopped)
2016
+ # Filter by status (setup, initialising, running, scheduled, paused)
2016
2017
  cloudos interactive-session list --profile my_profile --filter-status running
2017
2018
 
2018
2019
  # Show only your own sessions
@@ -2090,7 +2091,7 @@ Status changed: provisioning → running
2090
2091
  **Watch Mode Behavior**
2091
2092
 
2092
2093
  - **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
2094
2095
 
2095
2096
  Example with a running session:
2096
2097
 
@@ -2159,6 +2160,161 @@ cloudos interactive-session status --session-id <SESSION_ID> --profile my_profil
2159
2160
  # Creates: /tmp/session_status.csv
2160
2161
  ```
2161
2162
 
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
+
2162
2318
  #### Create Interactive Session
2163
2319
 
2164
2320
  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:
2293
2449
  - Session ID
2294
2450
  - Session name
2295
2451
  - Backend type (jupyter, vscode, rstudio, spark)
2296
- - Current status (scheduled, initialising, setup, running, stopped)
2452
+ - Current status (scheduled, initialising, setup, running, paused)
2297
2453
 
2298
2454
 
2299
2455
  ### Datasets
@@ -0,0 +1 @@
1
+ __version__ = '2.85.0'
@@ -2313,7 +2313,7 @@ class Cloudos:
2313
2313
  if status:
2314
2314
  # status is a list of valid status values (user-friendly names)
2315
2315
  # Include both spellings and API names for flexibility
2316
- valid_statuses = ['setup', 'initialising', 'initializing', 'running', 'scheduled', 'stopped', 'aborted']
2316
+ valid_statuses = ['setup', 'initialising', 'initializing', 'running', 'scheduled', 'stopped', 'paused', 'aborted']
2317
2317
  for s in status:
2318
2318
  if s.lower() not in valid_statuses:
2319
2319
  raise ValueError(f"Invalid status '{s}'. Valid values: {', '.join(valid_statuses)}")
@@ -2326,6 +2326,7 @@ class Cloudos:
2326
2326
  'running': 'ready', # API uses 'ready' for running sessions
2327
2327
  'scheduled': 'scheduled',
2328
2328
  'stopped': 'aborted',
2329
+ 'paused': 'aborted', # 'paused' and 'stopped' both map to 'aborted' API status
2329
2330
  'aborted': 'aborted' # Also accept 'aborted' as input
2330
2331
  }
2331
2332
  mapped_statuses = [status_mapping[s.lower()] for s in status]
@@ -2417,5 +2418,70 @@ class Cloudos:
2417
2418
  # Return the full session object from response
2418
2419
  content = r.json()
2419
2420
  return content
2421
+
2422
+ def abort_interactive_session(self, session_id, team_id, upload_on_close=True, force_abort=False, verify=True):
2423
+ """Abort and stop a running interactive session.
2424
+
2425
+ Parameters
2426
+ ----------
2427
+ session_id : string
2428
+ The session ID (MongoDB ObjectId) to abort.
2429
+ team_id : string
2430
+ The CloudOS team id (workspace id) where the session is running.
2431
+ upload_on_close : bool, optional
2432
+ If True, save session data to S3 before terminating. Default=True.
2433
+ force_abort : bool, optional
2434
+ If True, force immediate termination (skip graceful shutdown). Default=False.
2435
+ verify: [bool|string], default=True
2436
+ Whether to use SSL verification or not. Alternatively, if
2437
+ a string is passed, it will be interpreted as the path to
2438
+ the SSL certificate file.
2439
+
2440
+ Returns
2441
+ -------
2442
+ int
2443
+ HTTP status code (204 for successful abort, no content returned).
2444
+ """
2445
+ # Validate session_id
2446
+ if not session_id or not isinstance(session_id, str):
2447
+ raise ValueError("Invalid session_id: must be a non-empty string")
2448
+
2449
+ # Validate team_id
2450
+ if not team_id or not isinstance(team_id, str):
2451
+ raise ValueError("Invalid team_id: must be a non-empty string")
2452
+
2453
+ headers = {
2454
+ "Content-type": "application/json",
2455
+ "apikey": self.apikey
2456
+ }
2457
+
2458
+ # Build request body
2459
+ payload = {
2460
+ "uploadOnClose": upload_on_close,
2461
+ "forceAbort": force_abort
2462
+ }
2463
+
2464
+ # Build URL with teamId query parameter
2465
+ url = f"{self.cloudos_url}/api/v1/interactive-sessions/{session_id}/abort?teamId={team_id}"
2466
+
2467
+ # Make the API request with PUT method
2468
+ try:
2469
+ r = requests.put(
2470
+ url,
2471
+ headers=headers,
2472
+ data=json.dumps(payload),
2473
+ verify=verify,
2474
+ timeout=30
2475
+ )
2476
+ except Exception as e:
2477
+ raise Exception(f"Failed to abort interactive session: {str(e)}")
2478
+
2479
+ if r.status_code >= 400:
2480
+ if r.status_code == 404:
2481
+ raise ValueError(f"Session not found: {session_id}")
2482
+ raise BadRequestException(r)
2483
+
2484
+ # Return the status code (204 No Content is success)
2485
+ return r.status_code
2420
2486
 
2421
2487