cloudos-cli 2.81.2__tar.gz → 2.82.1__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 (70) hide show
  1. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/PKG-INFO +55 -16
  2. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/README.md +54 -15
  3. cloudos_cli-2.82.1/cloudos_cli/_version.py +1 -0
  4. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/clos.py +39 -28
  5. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/projects/cli.py +22 -9
  6. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/queue/cli.py +18 -11
  7. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/details.py +374 -0
  8. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/workflows/cli.py +20 -8
  9. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/PKG-INFO +55 -16
  10. cloudos_cli-2.81.2/cloudos_cli/_version.py +0 -1
  11. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/LICENSE +0 -0
  12. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/__init__.py +0 -0
  13. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/__main__.py +0 -0
  14. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/bash/__init__.py +0 -0
  15. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/bash/cli.py +0 -0
  16. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/configure/__init__.py +0 -0
  17. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/configure/cli.py +0 -0
  18. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/configure/configure.py +0 -0
  19. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/constants.py +0 -0
  20. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/cost/__init__.py +0 -0
  21. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/cost/cost.py +0 -0
  22. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/cromwell/__init__.py +0 -0
  23. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/cromwell/cli.py +0 -0
  24. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/datasets/__init__.py +0 -0
  25. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/datasets/cli.py +0 -0
  26. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/datasets/datasets.py +0 -0
  27. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/import_wf/__init__.py +0 -0
  28. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/import_wf/import_wf.py +0 -0
  29. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/jobs/__init__.py +0 -0
  30. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/jobs/cli.py +0 -0
  31. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/jobs/job.py +0 -0
  32. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/link/__init__.py +0 -0
  33. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/link/cli.py +0 -0
  34. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/link/link.py +0 -0
  35. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/logging/__init__.py +0 -0
  36. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/logging/logger.py +0 -0
  37. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/procurement/__init__.py +0 -0
  38. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/procurement/cli.py +0 -0
  39. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/procurement/images.py +0 -0
  40. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/projects/__init__.py +0 -0
  41. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/queue/__init__.py +0 -0
  42. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/queue/queue.py +0 -0
  43. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/related_analyses/__init__.py +0 -0
  44. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/related_analyses/related_analyses.py +0 -0
  45. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/__init__.py +0 -0
  46. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/array_job.py +0 -0
  47. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/cli_helpers.py +0 -0
  48. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/cloud.py +0 -0
  49. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/errors.py +0 -0
  50. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/last_wf.py +0 -0
  51. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/requests.py +0 -0
  52. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/utils/resources.py +0 -0
  53. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli/workflows/__init__.py +0 -0
  54. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/SOURCES.txt +0 -0
  55. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  56. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/entry_points.txt +0 -0
  57. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/requires.txt +0 -0
  58. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/cloudos_cli.egg-info/top_level.txt +0 -0
  59. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/setup.cfg +0 -0
  60. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/setup.py +0 -0
  61. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/__init__.py +0 -0
  62. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/functions_for_pytest.py +0 -0
  63. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_cli_project_create.py +0 -0
  64. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_cost/__init__.py +0 -0
  65. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_cost/test_job_cost.py +0 -0
  66. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_error_messages.py +0 -0
  67. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_logging/__init__.py +0 -0
  68. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_logging/test_logger.py +0 -0
  69. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/tests/test_related_analyses/__init__.py +0 -0
  70. {cloudos_cli-2.81.2 → cloudos_cli-2.82.1}/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.81.2
3
+ Version: 2.82.1
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
@@ -365,11 +365,21 @@ Projects in CloudOS provide logical separation of datasets, workflows, and resul
365
365
 
366
366
  #### List Projects
367
367
 
368
- You can get a summary of all available workspace projects in two different formats:
369
- - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
370
- - **JSON**: All available information from projects in JSON format
368
+ You can get a summary of all available workspace projects in three different output formats using the `--output-format` option:
371
369
 
372
- To get a CSV table with all available projects for a given workspace:
370
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
371
+ - **csv**: Saves project data to a CSV file with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
372
+ - **json**: Saves complete project information to a JSON file with all available fields
373
+
374
+ To display projects as a formatted table in the terminal:
375
+
376
+ ```bash
377
+ cloudos project list --profile my_profile
378
+ # or explicitly:
379
+ cloudos project list --profile my_profile --output-format stdout
380
+ ```
381
+
382
+ To save projects to a CSV file with all available fields:
373
383
 
374
384
  ```bash
375
385
  cloudos project list --profile my_profile --output-format csv --all-fields
@@ -383,7 +393,7 @@ Executing list...
383
393
  Project list saved to project_list.csv
384
394
  ```
385
395
 
386
- To get the same information in JSON format:
396
+ To save the same information in JSON format:
387
397
 
388
398
  ```bash
389
399
  cloudos project list --profile my_profile --output-format json
@@ -406,13 +416,28 @@ The expected output is something similar to:
406
416
 
407
417
  ### Queue
408
418
 
409
- Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are listed in the "Compute Resources" section in "Settings". You can get a summary of all available workspace job queues in two formats:
410
- - **CSV**: A table with a selection of the available job queue information. You can get all information using the `--all-fields` flag
411
- - **JSON**: All available information from job queues in JSON format
419
+ Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are listed in the "Compute Resources" section in "Settings".
420
+
421
+ > [!NOTE]
422
+ > **Azure Platform**: Queue listing is not available for CloudOS workspaces configured to use Azure execution platform, as Azure does not use AWS batch queues.
412
423
 
413
424
  #### List Queues
414
425
 
415
- This command allows you to view available computational queues and their configurations. Example command for getting all available job queues in JSON format:
426
+ This command allows you to view available computational queues and their configurations. You can get a summary of all available workspace job queues in three different output formats using the `--output-format` option:
427
+
428
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
429
+ - **csv**: Saves queue data to a CSV file with a selection of available queue information, or all information using the `--all-fields` flag
430
+ - **json**: Saves complete queue information to a JSON file with all available fields
431
+
432
+ To display queues as a formatted table in the terminal:
433
+
434
+ ```bash
435
+ cloudos queue list --profile my_profile
436
+ # or explicitly:
437
+ cloudos queue list --profile my_profile --output-format stdout
438
+ ```
439
+
440
+ To save all available job queues in JSON format:
416
441
 
417
442
  ```bash
418
443
  cloudos queue list --profile my_profile --output-format json --output-basename "available_queues"
@@ -424,7 +449,11 @@ Executing list...
424
449
  Job queue list saved to available_queues.json
425
450
  ```
426
451
 
427
- This command will output the list of available job queues in JSON format and save it to a file named `available_queues.json`. You can use `--output-format csv` for a CSV file, or omit `--output-basename` to print to the console.
452
+ To save queue data to a CSV file:
453
+
454
+ ```bash
455
+ cloudos queue list --profile my_profile --output-format csv
456
+ ```
428
457
 
429
458
  > NOTE: The queue name that is visible in CloudOS and must be used with the `--job-queue` parameter is the one in the `label` field.
430
459
 
@@ -437,11 +466,21 @@ Platform workflows (those provided by CloudOS in your workspace as modules) run
437
466
 
438
467
  #### List All Available Workflows
439
468
 
440
- You can get a summary of all available workspace workflows in two different formats:
441
- - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
442
- - **JSON**: All available information from workflows in JSON format
469
+ You can get a list of all available workspace workflows in three different output formats using the `--output-format` option:
470
+
471
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
472
+ - **csv**: Saves workflow data to a CSV file with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
473
+ - **json**: Saves complete workflow information to a JSON file with all available fields
474
+
475
+ To display the list of workflows as a formatted table in the terminal:
476
+
477
+ ```bash
478
+ cloudos workflow list --profile my_profile
479
+ # or explicitly:
480
+ cloudos workflow list --profile my_profile --output-format stdout
481
+ ```
443
482
 
444
- To get a CSV table with all available workflows for a given workspace:
483
+ To save the list of workflows to a CSV file with all available fields:
445
484
 
446
485
  ```bash
447
486
  cloudos workflow list --profile my_profile --output-format csv --all-fields
@@ -455,7 +494,7 @@ Executing list...
455
494
  Workflow list saved to workflow_list.csv
456
495
  ```
457
496
 
458
- To get the same information in JSON format:
497
+ To save the same information in JSON format:
459
498
 
460
499
  ```bash
461
500
  cloudos workflow list --profile my_profile --output-format json
@@ -330,11 +330,21 @@ Projects in CloudOS provide logical separation of datasets, workflows, and resul
330
330
 
331
331
  #### List Projects
332
332
 
333
- You can get a summary of all available workspace projects in two different formats:
334
- - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
335
- - **JSON**: All available information from projects in JSON format
333
+ You can get a summary of all available workspace projects in three different output formats using the `--output-format` option:
336
334
 
337
- To get a CSV table with all available projects for a given workspace:
335
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
336
+ - **csv**: Saves project data to a CSV file with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
337
+ - **json**: Saves complete project information to a JSON file with all available fields
338
+
339
+ To display projects as a formatted table in the terminal:
340
+
341
+ ```bash
342
+ cloudos project list --profile my_profile
343
+ # or explicitly:
344
+ cloudos project list --profile my_profile --output-format stdout
345
+ ```
346
+
347
+ To save projects to a CSV file with all available fields:
338
348
 
339
349
  ```bash
340
350
  cloudos project list --profile my_profile --output-format csv --all-fields
@@ -348,7 +358,7 @@ Executing list...
348
358
  Project list saved to project_list.csv
349
359
  ```
350
360
 
351
- To get the same information in JSON format:
361
+ To save the same information in JSON format:
352
362
 
353
363
  ```bash
354
364
  cloudos project list --profile my_profile --output-format json
@@ -371,13 +381,28 @@ The expected output is something similar to:
371
381
 
372
382
  ### Queue
373
383
 
374
- Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are listed in the "Compute Resources" section in "Settings". You can get a summary of all available workspace job queues in two formats:
375
- - **CSV**: A table with a selection of the available job queue information. You can get all information using the `--all-fields` flag
376
- - **JSON**: All available information from job queues in JSON format
384
+ Job queues are required for running jobs using AWS batch executor. The available job queues in your CloudOS workspace are listed in the "Compute Resources" section in "Settings".
385
+
386
+ > [!NOTE]
387
+ > **Azure Platform**: Queue listing is not available for CloudOS workspaces configured to use Azure execution platform, as Azure does not use AWS batch queues.
377
388
 
378
389
  #### List Queues
379
390
 
380
- This command allows you to view available computational queues and their configurations. Example command for getting all available job queues in JSON format:
391
+ This command allows you to view available computational queues and their configurations. You can get a summary of all available workspace job queues in three different output formats using the `--output-format` option:
392
+
393
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
394
+ - **csv**: Saves queue data to a CSV file with a selection of available queue information, or all information using the `--all-fields` flag
395
+ - **json**: Saves complete queue information to a JSON file with all available fields
396
+
397
+ To display queues as a formatted table in the terminal:
398
+
399
+ ```bash
400
+ cloudos queue list --profile my_profile
401
+ # or explicitly:
402
+ cloudos queue list --profile my_profile --output-format stdout
403
+ ```
404
+
405
+ To save all available job queues in JSON format:
381
406
 
382
407
  ```bash
383
408
  cloudos queue list --profile my_profile --output-format json --output-basename "available_queues"
@@ -389,7 +414,11 @@ Executing list...
389
414
  Job queue list saved to available_queues.json
390
415
  ```
391
416
 
392
- This command will output the list of available job queues in JSON format and save it to a file named `available_queues.json`. You can use `--output-format csv` for a CSV file, or omit `--output-basename` to print to the console.
417
+ To save queue data to a CSV file:
418
+
419
+ ```bash
420
+ cloudos queue list --profile my_profile --output-format csv
421
+ ```
393
422
 
394
423
  > NOTE: The queue name that is visible in CloudOS and must be used with the `--job-queue` parameter is the one in the `label` field.
395
424
 
@@ -402,11 +431,21 @@ Platform workflows (those provided by CloudOS in your workspace as modules) run
402
431
 
403
432
  #### List All Available Workflows
404
433
 
405
- You can get a summary of all available workspace workflows in two different formats:
406
- - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
407
- - **JSON**: All available information from workflows in JSON format
434
+ You can get a list of all available workspace workflows in three different output formats using the `--output-format` option:
435
+
436
+ - **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
437
+ - **csv**: Saves workflow data to a CSV file with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
438
+ - **json**: Saves complete workflow information to a JSON file with all available fields
439
+
440
+ To display the list of workflows as a formatted table in the terminal:
441
+
442
+ ```bash
443
+ cloudos workflow list --profile my_profile
444
+ # or explicitly:
445
+ cloudos workflow list --profile my_profile --output-format stdout
446
+ ```
408
447
 
409
- To get a CSV table with all available workflows for a given workspace:
448
+ To save the list of workflows to a CSV file with all available fields:
410
449
 
411
450
  ```bash
412
451
  cloudos workflow list --profile my_profile --output-format csv --all-fields
@@ -420,7 +459,7 @@ Executing list...
420
459
  Workflow list saved to workflow_list.csv
421
460
  ```
422
461
 
423
- To get the same information in JSON format:
462
+ To save the same information in JSON format:
424
463
 
425
464
  ```bash
426
465
  cloudos workflow list --profile my_profile --output-format json
@@ -0,0 +1 @@
1
+ __version__ = '2.82.1'
@@ -1179,6 +1179,24 @@ class Cloudos:
1179
1179
  user_id = self.resolve_user_id(filter_owner, workspace_id, verify)
1180
1180
  params["user.id"] = user_id
1181
1181
 
1182
+ # --- Resolve queue ID before pagination (for local filtering during pagination) ---
1183
+ queue_id = None
1184
+ if filter_queue:
1185
+ try:
1186
+ from cloudos_cli.queue.queue import Queue
1187
+ queue_api = Queue(self.cloudos_url, self.apikey, self.cromwell_token, workspace_id, verify)
1188
+ queues = queue_api.get_job_queues()
1189
+
1190
+ for queue in queues:
1191
+ if queue.get("label") == filter_queue or queue.get("name") == filter_queue:
1192
+ queue_id = queue.get("id") or queue.get("_id")
1193
+ break
1194
+
1195
+ if not queue_id:
1196
+ raise ValueError(f"Queue with name '{filter_queue}' not found in workspace '{workspace_id}'")
1197
+ except Exception as e:
1198
+ raise ValueError(f"Error resolving queue '{filter_queue}'. {str(e)}")
1199
+
1182
1200
  # --- Fetch jobs page by page ---
1183
1201
  all_jobs = []
1184
1202
  params["limit"] = current_page_size
@@ -1201,47 +1219,40 @@ class Cloudos:
1201
1219
  if not page_jobs:
1202
1220
  break
1203
1221
 
1222
+ # Apply queue filter during pagination (if specified)
1223
+ # jobQueue is a dict with "id" and "name" keys, extract the id for comparison
1224
+ if filter_queue and queue_id:
1225
+ filtered_jobs = []
1226
+ for job in page_jobs:
1227
+ job_queue = job.get("batch", {}).get("jobQueue", {})
1228
+ # jobQueue is a dict like {"id": "...", "name": "...", ...}
1229
+ job_queue_id = job_queue.get("id") if isinstance(job_queue, dict) else job_queue
1230
+ if job_queue_id == queue_id:
1231
+ filtered_jobs.append(job)
1232
+ page_jobs = filtered_jobs
1233
+
1204
1234
  all_jobs.extend(page_jobs)
1205
1235
 
1206
1236
  # Check stopping conditions based on mode
1207
1237
  if use_pagination_mode:
1208
- # In pagination mode (last_n_jobs), continue until we have enough jobs
1238
+ # In pagination mode (last_n_jobs), continue until we have enough jobs (after filtering)
1209
1239
  if target_job_count != 'all' and len(all_jobs) >= target_job_count:
1210
1240
  break
1211
1241
  else:
1212
- # In direct mode (page/page_size), only get one page
1213
- break
1242
+ # In direct mode (page/page_size), only get one page unless filter_queue is used
1243
+ # When filter_queue is used, continue fetching pages until we have enough filtered results
1244
+ if not filter_queue or len(all_jobs) >= current_page_size:
1245
+ break
1214
1246
 
1215
1247
  # Check if we reached the last page (fewer jobs than requested page size)
1216
- if len(page_jobs) < params["limit"]:
1248
+ # Note: For queue filter, we check the unfiltered page_jobs count from the API
1249
+ # This ensures we stop when the API has exhausted results
1250
+ raw_page_jobs = content.get('jobs', [])
1251
+ if len(raw_page_jobs) < params["limit"]:
1217
1252
  break # Last page
1218
1253
 
1219
1254
  current_page += 1
1220
1255
 
1221
- # --- Local queue filtering (not supported by API) ---
1222
- if filter_queue:
1223
- try:
1224
- batch_jobs=[job for job in all_jobs if job.get("batch", {})]
1225
- if batch_jobs:
1226
- from cloudos_cli.queue.queue import Queue
1227
- queue_api = Queue(self.cloudos_url, self.apikey, self.cromwell_token, workspace_id, verify)
1228
- queues = queue_api.get_job_queues()
1229
-
1230
- queue_id = None
1231
- for queue in queues:
1232
- if queue.get("label") == filter_queue or queue.get("name") == filter_queue:
1233
- queue_id = queue.get("id") or queue.get("_id")
1234
- break
1235
-
1236
- if not queue_id:
1237
- raise ValueError(f"Queue with name '{filter_queue}' not found in workspace '{workspace_id}'")
1238
-
1239
- all_jobs = [job for job in all_jobs if job.get("batch", {}).get("jobQueue", {}) == queue_id]
1240
- else:
1241
- raise ValueError(f"The environment is not a batch environment so queues do not exist. Please remove the --filter-queue option.")
1242
- except Exception as e:
1243
- raise ValueError(f"Error filtering by queue '{filter_queue}'. {str(e)}")
1244
-
1245
1256
  # --- Apply limit after all filtering ---
1246
1257
  if use_pagination_mode and target_job_count != 'all' and isinstance(target_job_count, int) and target_job_count > 0:
1247
1258
  all_jobs = all_jobs[:target_job_count]
@@ -7,6 +7,7 @@ from cloudos_cli.clos import Cloudos
7
7
  from cloudos_cli.utils.resources import ssl_selector
8
8
  from cloudos_cli.configure.configure import with_profile_config, CLOUDOS_URL
9
9
  from cloudos_cli.utils.cli_helpers import pass_debug_to_subcommands
10
+ from cloudos_cli.utils.details import create_project_list_table
10
11
 
11
12
 
12
13
  @click.group(cls=pass_debug_to_subcommands())
@@ -34,9 +35,13 @@ def project():
34
35
  default='project_list',
35
36
  required=False)
36
37
  @click.option('--output-format',
37
- help='The desired file format (file extension) for the output. Default=csv.',
38
- type=click.Choice(['csv', 'json'], case_sensitive=False),
39
- default='csv')
38
+ help=('Output format for project list. Options: '
39
+ 'stdout (display as interactive table in terminal), '
40
+ 'csv (save as comma-separated values file), '
41
+ 'json (save as JSON file with full API response). '
42
+ 'Default=stdout.'),
43
+ type=click.Choice(['stdout', 'csv', 'json'], case_sensitive=False),
44
+ default='stdout')
40
45
  @click.option('--all-fields',
41
46
  help=('Whether to collect all available fields from projects or ' +
42
47
  'just the preconfigured selected fields. Only applicable ' +
@@ -70,11 +75,12 @@ def list_projects(ctx,
70
75
  disable_ssl_verification,
71
76
  ssl_cert,
72
77
  profile):
73
- """Collect all projects from a CloudOS workspace in CSV format."""
78
+ """Collect and display all projects from a CloudOS workspace."""
74
79
  # apikey, cloudos_url, and workspace_id are now automatically resolved by the decorator
75
80
 
76
81
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
77
- outfile = output_basename + '.' + output_format
82
+ if output_format != 'stdout':
83
+ outfile = output_basename + '.' + output_format
78
84
  print('Executing list...')
79
85
  if verbose:
80
86
  print('\t...Preparing objects')
@@ -93,25 +99,32 @@ def list_projects(ctx,
93
99
  if not isinstance(page, int) or page < 1:
94
100
  raise ValueError('Please, use a positive integer (>= 1) for the --page parameter')
95
101
  my_projects_r = cl.get_project_list(workspace_id, verify_ssl, page=page, get_all=get_all)
102
+
103
+ # Print informative message if no projects found
96
104
  if len(my_projects_r) == 0:
97
105
  if ctx.get_parameter_source('page') == click.core.ParameterSource.DEFAULT:
98
- print('A total of 0 projects collected. This is likely because your workspace ' +
106
+ print('\tA total of 0 projects collected. This is likely because your workspace ' +
99
107
  'has no projects created yet.')
100
108
  else:
101
- print('A total of 0 projects collected. This is likely because the --page you ' +
109
+ print('\tA total of 0 projects collected. This is likely because the --page you ' +
102
110
  'requested does not exist. Please, try a smaller number for --page or collect all the ' +
103
111
  'projects by not using --page parameter.')
112
+
113
+ # Generate output files (even if empty, for consistency with automation)
114
+ if output_format == 'stdout':
115
+ create_project_list_table(my_projects_r, cloudos_url)
104
116
  elif output_format == 'csv':
105
117
  my_projects = cl.process_project_list(my_projects_r, all_fields)
106
118
  my_projects.to_csv(outfile, index=False)
107
119
  print(f'\tProject list collected with a total of {my_projects.shape[0]} projects.')
120
+ print(f'\tProject list saved to {outfile}')
108
121
  elif output_format == 'json':
109
122
  with open(outfile, 'w') as o:
110
123
  o.write(json.dumps(my_projects_r))
111
124
  print(f'\tProject list collected with a total of {len(my_projects_r)} projects.')
125
+ print(f'\tProject list saved to {outfile}')
112
126
  else:
113
- raise ValueError('Unrecognised output format. Please use one of [csv|json]')
114
- print(f'\tProject list saved to {outfile}')
127
+ raise ValueError('Unrecognised output format. Please use one of [stdout|csv|json]')
115
128
 
116
129
 
117
130
  @project.command('create')
@@ -6,6 +6,7 @@ from cloudos_cli.queue.queue import Queue
6
6
  from cloudos_cli.utils.resources import ssl_selector
7
7
  from cloudos_cli.configure.configure import with_profile_config, CLOUDOS_URL
8
8
  from cloudos_cli.utils.cli_helpers import pass_debug_to_subcommands
9
+ from cloudos_cli.utils.details import create_queue_list_table
9
10
 
10
11
 
11
12
  # Create the queue group
@@ -34,11 +35,15 @@ def queue():
34
35
  default='job_queue_list',
35
36
  required=False)
36
37
  @click.option('--output-format',
37
- help='The desired file format (file extension) for the output. Default=csv.',
38
- type=click.Choice(['csv', 'json'], case_sensitive=False),
39
- default='csv')
38
+ help=('Output format for queue list. Options: '
39
+ 'stdout (display as interactive table in terminal), '
40
+ 'csv (save as comma-separated values file), '
41
+ 'json (save as JSON file with full API response). '
42
+ 'Default=stdout.'),
43
+ type=click.Choice(['stdout', 'csv', 'json'], case_sensitive=False),
44
+ default='stdout')
40
45
  @click.option('--all-fields',
41
- help=('Whether to collect all available fields from workflows or ' +
46
+ help=('Whether to collect all available fields from queues or ' +
42
47
  'just the preconfigured selected fields. Only applicable ' +
43
48
  'when --output-format=csv'),
44
49
  is_flag=True)
@@ -61,24 +66,26 @@ def list_queues(ctx,
61
66
  disable_ssl_verification,
62
67
  ssl_cert,
63
68
  profile):
64
- """Collect all available job queues from a CloudOS workspace."""
69
+ """Collect and display all available job queues from a CloudOS workspace."""
65
70
  # apikey, cloudos_url, and workspace_id are now automatically resolved by the decorator
66
71
 
67
72
  verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
68
- outfile = output_basename + '.' + output_format
69
73
  print('Executing list...')
70
74
  j_queue = Queue(cloudos_url, apikey, None, workspace_id, verify=verify_ssl)
71
75
  my_queues = j_queue.get_job_queues()
72
76
  if len(my_queues) == 0:
73
- raise ValueError('No AWS batch queues found. Please, make sure that your CloudOS supports AWS bath queues')
74
- if output_format == 'csv':
77
+ raise ValueError('No AWS batch queues found. Please, make sure that your CloudOS supports AWS batch queues')
78
+ if output_format == 'stdout':
79
+ create_queue_list_table(my_queues, cloudos_url)
80
+ elif output_format == 'csv':
81
+ outfile = output_basename + '.' + output_format
75
82
  queues_processed = j_queue.process_queue_list(my_queues, all_fields)
76
83
  queues_processed.to_csv(outfile, index=False)
77
84
  print(f'\tJob queue list collected with a total of {queues_processed.shape[0]} queues.')
85
+ print(f'\tJob queue list saved to {outfile}')
78
86
  elif output_format == 'json':
87
+ outfile = output_basename + '.' + output_format
79
88
  with open(outfile, 'w') as o:
80
89
  o.write(json.dumps(my_queues))
81
90
  print(f'\tJob queue list collected with a total of {len(my_queues)} queues.')
82
- else:
83
- raise ValueError('Unrecognised output format. Please use one of [csv|json]')
84
- print(f'\tJob queue list saved to {outfile}')
91
+ print(f'\tJob queue list saved to {outfile}')