cloudos-cli 2.69.1__tar.gz → 2.70.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 (55) hide show
  1. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/PKG-INFO +75 -1
  2. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/README.md +74 -0
  3. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/__main__.py +36 -4
  4. cloudos_cli-2.70.0/cloudos_cli/_version.py +1 -0
  5. cloudos_cli-2.70.0/cloudos_cli/delete/__init__.py +8 -0
  6. cloudos_cli-2.70.0/cloudos_cli/delete/results.py +24 -0
  7. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/jobs/job.py +57 -2
  8. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/PKG-INFO +75 -1
  9. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/SOURCES.txt +2 -0
  10. cloudos_cli-2.69.1/cloudos_cli/_version.py +0 -1
  11. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/LICENSE +0 -0
  12. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/__init__.py +0 -0
  13. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/clos.py +0 -0
  14. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/configure/__init__.py +0 -0
  15. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/configure/configure.py +0 -0
  16. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/cost/__init__.py +0 -0
  17. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/cost/cost.py +0 -0
  18. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/datasets/__init__.py +0 -0
  19. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/datasets/datasets.py +0 -0
  20. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/import_wf/__init__.py +0 -0
  21. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  22. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/jobs/__init__.py +0 -0
  23. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/link/__init__.py +0 -0
  24. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/link/link.py +0 -0
  25. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/logging/__init__.py +0 -0
  26. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/logging/logger.py +0 -0
  27. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/procurement/__init__.py +0 -0
  28. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/procurement/images.py +0 -0
  29. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/queue/__init__.py +0 -0
  30. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/queue/queue.py +0 -0
  31. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/related_analyses/__init__.py +0 -0
  32. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/related_analyses/related_analyses.py +0 -0
  33. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/__init__.py +0 -0
  34. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/array_job.py +0 -0
  35. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/cloud.py +0 -0
  36. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/details.py +0 -0
  37. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/errors.py +0 -0
  38. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/last_wf.py +0 -0
  39. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/requests.py +0 -0
  40. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli/utils/resources.py +0 -0
  41. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  42. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  43. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/requires.txt +0 -0
  44. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  45. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/setup.cfg +0 -0
  46. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/setup.py +0 -0
  47. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/__init__.py +0 -0
  48. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/functions_for_pytest.py +0 -0
  49. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_cli_project_create.py +0 -0
  50. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_cost/__init__.py +0 -0
  51. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_cost/test_job_cost.py +0 -0
  52. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_logging/__init__.py +0 -0
  53. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_logging/test_logger.py +0 -0
  54. {cloudos_cli-2.69.1 → cloudos_cli-2.70.0}/tests/test_related_analyses/__init__.py +0 -0
  55. {cloudos_cli-2.69.1 → cloudos_cli-2.70.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.69.1
3
+ Version: 2.70.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
@@ -81,6 +81,7 @@ Python package for interacting with CloudOS
81
81
  - [List Jobs](#list-jobs)
82
82
  - [Get Job Costs](#get-job-costs)
83
83
  - [Get Job Related Analyses](#get-job-related-analyses)
84
+ - [Delete Job Results](#delete-job-results)
84
85
  - [Bash Jobs](#bash-jobs)
85
86
  - [Send Array Job](#send-array-job)
86
87
  - [Submit a Bash Array Job](#submit-a-bash-array-job)
@@ -1378,6 +1379,79 @@ Related analyses are particularly useful for:
1378
1379
  > [!NOTE]
1379
1380
  > Related jobs are identified by their shared working directory folder ID. Only jobs within the same workspace that use the same working directory will be displayed.
1380
1381
 
1382
+ #### Delete Job Results
1383
+
1384
+ CloudOS allows you to permanently delete job results directories to manage storage and clean up completed analyses. This feature provides a safe way to remove final analysis results with built-in confirmation prompts and status tracking.
1385
+
1386
+ > [!WARNING]
1387
+ > Deleting job results is **irreversible**. All data and backups will be permanently removed and cannot be recovered. Use this feature with caution.
1388
+
1389
+ **Delete Results with Confirmation**
1390
+
1391
+ To delete the results directory of a completed job, use the `--delete` flag with the `job results` command. By default, a confirmation prompt will be displayed before deletion:
1392
+
1393
+ ```bash
1394
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1395
+ ```
1396
+
1397
+ The expected output will show a warning confirmation:
1398
+
1399
+ ```console
1400
+ Executing results...
1401
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1402
+
1403
+ ⚠️ Deleting final analysis results is irreversible. All data and backups will be permanently removed and cannot be recovered. You can skip this confirmation step by providing '-y' or '--yes' flag to 'cloudos job results --delete'. Please confirm that you want to delete final results of this analysis? [y/n]
1404
+ ```
1405
+
1406
+ Type `y` to proceed with deletion or `n` to cancel:
1407
+
1408
+ ```console
1409
+ y
1410
+
1411
+ Results directories deleted successfully.
1412
+ ```
1413
+
1414
+ **Skip Confirmation Prompt**
1415
+
1416
+ For automated workflows or when you're certain about deletion, you can skip the confirmation prompt using the `-y` or `--yes` flag:
1417
+
1418
+ ```bash
1419
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete --yes
1420
+ ```
1421
+
1422
+ This will immediately proceed with deletion without prompting for confirmation:
1423
+
1424
+ ```console
1425
+ Executing results...
1426
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1427
+
1428
+ Results directories deleted successfully.
1429
+ ```
1430
+
1431
+ **Error Handling**
1432
+
1433
+ The deletion command handles various scenarios with specific error messages:
1434
+
1435
+ - **Job not found**: If the specified job ID doesn't exist or is not accessible
1436
+ - **No results directory**: If the job doesn't have a results directory associated with it
1437
+ - **Permission denied**: If your API key doesn't have permission to delete the results
1438
+ - **Resource conflict**: If the folder cannot be deleted due to dependencies
1439
+
1440
+ Example when a job has no results:
1441
+
1442
+ ```bash
1443
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1444
+ ```
1445
+
1446
+ ```console
1447
+ Executing results...
1448
+ Selected job does not have 'Results' information.
1449
+ ```
1450
+
1451
+ > [!NOTE]
1452
+ > The `--delete` flag is compatible with other `job results` options. You can combine it with `--verbose` for detailed logging, but cannot be used together with `--link` or `--status` flags.
1453
+
1454
+
1381
1455
  ### Bash Jobs
1382
1456
  Execute bash scripts on CloudOS for custom processing workflows. Bash jobs allow you to run shell commands with custom parameters and are ideal for data preprocessing or simple computational tasks.
1383
1457
 
@@ -46,6 +46,7 @@ Python package for interacting with CloudOS
46
46
  - [List Jobs](#list-jobs)
47
47
  - [Get Job Costs](#get-job-costs)
48
48
  - [Get Job Related Analyses](#get-job-related-analyses)
49
+ - [Delete Job Results](#delete-job-results)
49
50
  - [Bash Jobs](#bash-jobs)
50
51
  - [Send Array Job](#send-array-job)
51
52
  - [Submit a Bash Array Job](#submit-a-bash-array-job)
@@ -1343,6 +1344,79 @@ Related analyses are particularly useful for:
1343
1344
  > [!NOTE]
1344
1345
  > Related jobs are identified by their shared working directory folder ID. Only jobs within the same workspace that use the same working directory will be displayed.
1345
1346
 
1347
+ #### Delete Job Results
1348
+
1349
+ CloudOS allows you to permanently delete job results directories to manage storage and clean up completed analyses. This feature provides a safe way to remove final analysis results with built-in confirmation prompts and status tracking.
1350
+
1351
+ > [!WARNING]
1352
+ > Deleting job results is **irreversible**. All data and backups will be permanently removed and cannot be recovered. Use this feature with caution.
1353
+
1354
+ **Delete Results with Confirmation**
1355
+
1356
+ To delete the results directory of a completed job, use the `--delete` flag with the `job results` command. By default, a confirmation prompt will be displayed before deletion:
1357
+
1358
+ ```bash
1359
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1360
+ ```
1361
+
1362
+ The expected output will show a warning confirmation:
1363
+
1364
+ ```console
1365
+ Executing results...
1366
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1367
+
1368
+ ⚠️ Deleting final analysis results is irreversible. All data and backups will be permanently removed and cannot be recovered. You can skip this confirmation step by providing '-y' or '--yes' flag to 'cloudos job results --delete'. Please confirm that you want to delete final results of this analysis? [y/n]
1369
+ ```
1370
+
1371
+ Type `y` to proceed with deletion or `n` to cancel:
1372
+
1373
+ ```console
1374
+ y
1375
+
1376
+ Results directories deleted successfully.
1377
+ ```
1378
+
1379
+ **Skip Confirmation Prompt**
1380
+
1381
+ For automated workflows or when you're certain about deletion, you can skip the confirmation prompt using the `-y` or `--yes` flag:
1382
+
1383
+ ```bash
1384
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete --yes
1385
+ ```
1386
+
1387
+ This will immediately proceed with deletion without prompting for confirmation:
1388
+
1389
+ ```console
1390
+ Executing results...
1391
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1392
+
1393
+ Results directories deleted successfully.
1394
+ ```
1395
+
1396
+ **Error Handling**
1397
+
1398
+ The deletion command handles various scenarios with specific error messages:
1399
+
1400
+ - **Job not found**: If the specified job ID doesn't exist or is not accessible
1401
+ - **No results directory**: If the job doesn't have a results directory associated with it
1402
+ - **Permission denied**: If your API key doesn't have permission to delete the results
1403
+ - **Resource conflict**: If the folder cannot be deleted due to dependencies
1404
+
1405
+ Example when a job has no results:
1406
+
1407
+ ```bash
1408
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1409
+ ```
1410
+
1411
+ ```console
1412
+ Executing results...
1413
+ Selected job does not have 'Results' information.
1414
+ ```
1415
+
1416
+ > [!NOTE]
1417
+ > The `--delete` flag is compatible with other `job results` options. You can combine it with `--verbose` for detailed logging, but cannot be used together with `--link` or `--status` flags.
1418
+
1419
+
1346
1420
  ### Bash Jobs
1347
1421
  Execute bash scripts on CloudOS for custom processing workflows. Bash jobs allow you to run shell commands with custom parameters and are ideal for data preprocessing or simple computational tasks.
1348
1422
 
@@ -31,6 +31,7 @@ from cloudos_cli.configure.configure import (
31
31
  CLOUDOS_URL
32
32
  )
33
33
  from cloudos_cli.related_analyses.related_analyses import related_analyses
34
+ from cloudos_cli.delete.results import delete_job_results
34
35
 
35
36
 
36
37
  # GLOBAL VARS
@@ -1013,6 +1014,12 @@ def job_logs(ctx,
1013
1014
  @click.option('--link',
1014
1015
  help='Link the results directories to an interactive session.',
1015
1016
  is_flag=True)
1017
+ @click.option('--delete',
1018
+ help='Delete the results directory of a CloudOS job.',
1019
+ is_flag=True)
1020
+ @click.option('-y', '--yes',
1021
+ help='Skip confirmation prompt when deleting results.',
1022
+ is_flag=True)
1016
1023
  @click.option('--session-id',
1017
1024
  help='The specific CloudOS interactive session id. Required when using --link flag.',
1018
1025
  required=False)
@@ -1037,6 +1044,8 @@ def job_results(ctx,
1037
1044
  workspace_id,
1038
1045
  job_id,
1039
1046
  link,
1047
+ delete,
1048
+ yes,
1040
1049
  session_id,
1041
1050
  status,
1042
1051
  verbose,
@@ -1150,12 +1159,12 @@ def job_results(ctx,
1150
1159
  results = cl.get_job_results(job_id, workspace_id, verify_ssl)
1151
1160
  for name, path in results.items():
1152
1161
  print(f"{name}: {path}")
1153
-
1162
+
1154
1163
  # Link to interactive session if requested
1155
1164
  if link:
1156
1165
  if verbose:
1157
1166
  print(f'\tLinking {len(results)} result directories to interactive session {session_id}...')
1158
-
1167
+
1159
1168
  # Use Link class to perform the linking
1160
1169
  link_client = Link(
1161
1170
  cloudos_url=cloudos_url,
@@ -1165,12 +1174,35 @@ def job_results(ctx,
1165
1174
  project_name=None, # Not needed for S3 paths
1166
1175
  verify=verify_ssl
1167
1176
  )
1168
-
1177
+
1169
1178
  for name, path in results.items():
1170
1179
  if verbose:
1171
1180
  print(f'\t\tLinking {name} ({path})...')
1172
1181
  link_client.link_folder(path, session_id)
1173
-
1182
+
1183
+ # Delete results directory if requested
1184
+ if delete:
1185
+ # Ask for confirmation unless --yes flag is provided
1186
+ if not yes:
1187
+ confirmation_message = (
1188
+ "\n⚠️ Deleting final analysis results is irreversible. "
1189
+ "All data and backups will be permanently removed and cannot be recovered. "
1190
+ "You can skip this confirmation step by providing '-y' or '--yes' flag to "
1191
+ "'cloudos job results --delete'. "
1192
+ "Please confirm that you want to delete final results of this analysis? [y/n] "
1193
+ )
1194
+ click.secho(confirmation_message, fg='white', bg='yellow')
1195
+ user_input = input().strip().lower()
1196
+ if user_input != 'y':
1197
+ print('\nDeletion cancelled.')
1198
+ return
1199
+ if verbose:
1200
+ print(f'\nDeleting {len(results)} result directories from CloudOS...')
1201
+ delete_job_results(cloudos_url, apikey, job_id, workspace_id, verify_ssl)
1202
+ print('Results directories deleted successfully.')
1203
+ else:
1204
+ if yes:
1205
+ click.secho("\n'--yes' flag is ignored when '--delete' is not specified.", fg='yellow', bold=True)
1174
1206
  except BadRequestException as e:
1175
1207
  raise ValueError(f"Job '{job_id}' not found or not accessible: {str(e)}")
1176
1208
  except Exception as e:
@@ -0,0 +1 @@
1
+ __version__ = '2.70.0'
@@ -0,0 +1,8 @@
1
+ """
2
+ Functions and classes related to delete (results & workdir).
3
+ """
4
+
5
+ from .results import delete_job_results
6
+
7
+
8
+ __all__ = ['results']
@@ -0,0 +1,24 @@
1
+ import click
2
+ import cloudos_cli.jobs.job as jb
3
+
4
+
5
+ def delete_job_results(cloudos_url, apikey, j_id, workspace_id, verify=True):
6
+ job = jb.Job(cloudos_url, apikey, None, workspace_id, None, None, workflow_id=1234, project_id="None",
7
+ mainfile=None, importsfile=None, verify=verify)
8
+
9
+ # Get job results directory
10
+ try:
11
+ j_results_dir = job.get_field_from_jobs_endpoint(j_id, field='analysisResults', verify=verify)
12
+ except Exception as e:
13
+ if "Field 'analysisResults' not found in endpoint 'jobs'" in str(e):
14
+ click.secho("Selected job does not have 'Results' information.", fg="yellow", bold=True)
15
+ return
16
+ else:
17
+ raise e
18
+
19
+ # Get folder ID
20
+ folder_id = j_results_dir.get('folderId')
21
+ if not folder_id:
22
+ raise ValueError("The job does not have a results directory associated.")
23
+
24
+ job.delete_job_results(folder_id, verify=verify)
@@ -7,7 +7,7 @@ from typing import Union
7
7
  import json
8
8
  from cloudos_cli.clos import Cloudos
9
9
  from cloudos_cli.utils.errors import BadRequestException
10
- from cloudos_cli.utils.requests import retry_requests_post, retry_requests_get
10
+ from cloudos_cli.utils.requests import retry_requests_post, retry_requests_get, retry_requests_delete
11
11
  from pathlib import Path
12
12
  import base64
13
13
  from cloudos_cli.utils.array_job import classify_pattern, get_file_or_folder_id, extract_project
@@ -1426,4 +1426,59 @@ class Job(Cloudos):
1426
1426
  if not parent_job_id:
1427
1427
  return None
1428
1428
  else:
1429
- return parent_job_id
1429
+ return parent_job_id
1430
+
1431
+ def delete_job_results(self, folder_id, verify=True):
1432
+ """Delete job results folder.
1433
+
1434
+ Parameters
1435
+ ----------
1436
+ folder_id : str
1437
+ The ID of the folder to delete (typically a job results folder).
1438
+ verify : [bool | str], optional
1439
+ Whether to use SSL verification or not. Alternatively, if
1440
+ a string is passed, it will be interpreted as the path to
1441
+ the SSL certificate file. Default is True.
1442
+
1443
+ Returns
1444
+ -------
1445
+ dict
1446
+ A dictionary containing the deletion response from the API.
1447
+
1448
+ Raises
1449
+ ------
1450
+ BadRequestException
1451
+ If the request fails with a status code indicating an error.
1452
+ ValueError
1453
+ If the folder ID is invalid or the folder does not exist.
1454
+ """
1455
+ headers = {
1456
+ "Content-type": "application/json",
1457
+ "apikey": self.apikey
1458
+ }
1459
+ url = f"{self.cloudos_url}/api/v1/folders/{folder_id}?teamId={self.workspace_id}"
1460
+ response = retry_requests_delete(url, headers=headers, verify=verify)
1461
+
1462
+ # Handle specific status codes according to API specification
1463
+ if response.status_code == 204:
1464
+ # NoContent - successful deletion
1465
+ return {"message": "Results deleted successfully", "status": "deleted"}
1466
+ elif response.status_code == 400:
1467
+ raise ValueError("Operation not permitted: Workspace does not allow deleting results folders.")
1468
+ elif response.status_code == 401:
1469
+ raise ValueError("Unauthorized: Invalid or missing API key.")
1470
+ elif response.status_code == 403:
1471
+ raise ValueError("Forbidden: You don't have permission to delete this folder.")
1472
+ elif response.status_code == 404:
1473
+ raise ValueError(f"{json.loads(response.content)['message']}")
1474
+ elif response.status_code == 409:
1475
+ raise ValueError("Conflict: The folder cannot be deleted due to a conflict (e.g., folder is not empty or has dependencies).")
1476
+ elif response.status_code == 500:
1477
+ raise ValueError("Internal server error: The server encountered an error while processing the deletion request.")
1478
+ elif response.status_code >= 400:
1479
+ raise BadRequestException(response)
1480
+
1481
+ # For any other successful response, parse content if available
1482
+ if response.content:
1483
+ return json.loads(response.content)
1484
+ return {"message": "Results deleted successfully"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudos_cli
3
- Version: 2.69.1
3
+ Version: 2.70.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
@@ -81,6 +81,7 @@ Python package for interacting with CloudOS
81
81
  - [List Jobs](#list-jobs)
82
82
  - [Get Job Costs](#get-job-costs)
83
83
  - [Get Job Related Analyses](#get-job-related-analyses)
84
+ - [Delete Job Results](#delete-job-results)
84
85
  - [Bash Jobs](#bash-jobs)
85
86
  - [Send Array Job](#send-array-job)
86
87
  - [Submit a Bash Array Job](#submit-a-bash-array-job)
@@ -1378,6 +1379,79 @@ Related analyses are particularly useful for:
1378
1379
  > [!NOTE]
1379
1380
  > Related jobs are identified by their shared working directory folder ID. Only jobs within the same workspace that use the same working directory will be displayed.
1380
1381
 
1382
+ #### Delete Job Results
1383
+
1384
+ CloudOS allows you to permanently delete job results directories to manage storage and clean up completed analyses. This feature provides a safe way to remove final analysis results with built-in confirmation prompts and status tracking.
1385
+
1386
+ > [!WARNING]
1387
+ > Deleting job results is **irreversible**. All data and backups will be permanently removed and cannot be recovered. Use this feature with caution.
1388
+
1389
+ **Delete Results with Confirmation**
1390
+
1391
+ To delete the results directory of a completed job, use the `--delete` flag with the `job results` command. By default, a confirmation prompt will be displayed before deletion:
1392
+
1393
+ ```bash
1394
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1395
+ ```
1396
+
1397
+ The expected output will show a warning confirmation:
1398
+
1399
+ ```console
1400
+ Executing results...
1401
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1402
+
1403
+ ⚠️ Deleting final analysis results is irreversible. All data and backups will be permanently removed and cannot be recovered. You can skip this confirmation step by providing '-y' or '--yes' flag to 'cloudos job results --delete'. Please confirm that you want to delete final results of this analysis? [y/n]
1404
+ ```
1405
+
1406
+ Type `y` to proceed with deletion or `n` to cancel:
1407
+
1408
+ ```console
1409
+ y
1410
+
1411
+ Results directories deleted successfully.
1412
+ ```
1413
+
1414
+ **Skip Confirmation Prompt**
1415
+
1416
+ For automated workflows or when you're certain about deletion, you can skip the confirmation prompt using the `-y` or `--yes` flag:
1417
+
1418
+ ```bash
1419
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete --yes
1420
+ ```
1421
+
1422
+ This will immediately proceed with deletion without prompting for confirmation:
1423
+
1424
+ ```console
1425
+ Executing results...
1426
+ Results: s3://lifebit-featured-datasets/results/62c83a1191fe06013b7ef355
1427
+
1428
+ Results directories deleted successfully.
1429
+ ```
1430
+
1431
+ **Error Handling**
1432
+
1433
+ The deletion command handles various scenarios with specific error messages:
1434
+
1435
+ - **Job not found**: If the specified job ID doesn't exist or is not accessible
1436
+ - **No results directory**: If the job doesn't have a results directory associated with it
1437
+ - **Permission denied**: If your API key doesn't have permission to delete the results
1438
+ - **Resource conflict**: If the folder cannot be deleted due to dependencies
1439
+
1440
+ Example when a job has no results:
1441
+
1442
+ ```bash
1443
+ cloudos job results --profile my_profile --job-id 62c83a1191fe06013b7ef355 --delete
1444
+ ```
1445
+
1446
+ ```console
1447
+ Executing results...
1448
+ Selected job does not have 'Results' information.
1449
+ ```
1450
+
1451
+ > [!NOTE]
1452
+ > The `--delete` flag is compatible with other `job results` options. You can combine it with `--verbose` for detailed logging, but cannot be used together with `--link` or `--status` flags.
1453
+
1454
+
1381
1455
  ### Bash Jobs
1382
1456
  Execute bash scripts on CloudOS for custom processing workflows. Bash jobs allow you to run shell commands with custom parameters and are ideal for data preprocessing or simple computational tasks.
1383
1457
 
@@ -17,6 +17,8 @@ cloudos_cli/cost/__init__.py
17
17
  cloudos_cli/cost/cost.py
18
18
  cloudos_cli/datasets/__init__.py
19
19
  cloudos_cli/datasets/datasets.py
20
+ cloudos_cli/delete/__init__.py
21
+ cloudos_cli/delete/results.py
20
22
  cloudos_cli/import_wf/__init__.py
21
23
  cloudos_cli/import_wf/import_wf.py
22
24
  cloudos_cli/jobs/__init__.py
@@ -1 +0,0 @@
1
- __version__ = '2.69.1'
File without changes
File without changes
File without changes