cloudos-cli 2.86.0__tar.gz → 2.87.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.
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/PKG-INFO +10 -4
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/README.md +9 -3
- cloudos_cli-2.87.1/cloudos_cli/_version.py +1 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/clos.py +15 -5
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/interactive_session/cli.py +2 -2
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/interactive_session/interactive_session.py +2 -1
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/jobs/cli.py +38 -3
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/jobs/job.py +151 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/queue/cli.py +5 -1
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/queue/queue.py +29 -2
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/details.py +307 -191
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/PKG-INFO +10 -4
- cloudos_cli-2.86.0/cloudos_cli/_version.py +0 -1
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/LICENSE +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/__main__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/bash/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/bash/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/configure/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/configure/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/configure/configure.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/constants.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/cost/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/cost/cost.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/cromwell/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/cromwell/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/datasets/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/datasets/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/datasets/datasets.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/import_wf/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/import_wf/import_wf.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/interactive_session/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/jobs/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/link/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/link/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/link/link.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/logging/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/logging/logger.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/procurement/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/procurement/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/procurement/images.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/projects/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/projects/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/queue/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/related_analyses/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/related_analyses/related_analyses.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/array_job.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/cli_helpers.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/cloud.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/errors.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/last_wf.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/requests.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/utils/resources.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/workflows/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/workflows/cli.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/SOURCES.txt +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/dependency_links.txt +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/entry_points.txt +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/requires.txt +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli.egg-info/top_level.txt +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/setup.cfg +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/setup.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/functions_for_pytest.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_cli_project_create.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_cost/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_cost/test_job_cost.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_error_messages.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_interactive_session/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_interactive_session/test_create_session.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_interactive_session/test_list_sessions.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_logging/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_logging/test_logger.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/tests/test_related_analyses/__init__.py +0 -0
- {cloudos_cli-2.86.0 → cloudos_cli-2.87.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.
|
|
3
|
+
Version: 2.87.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
|
|
@@ -436,7 +436,7 @@ Job queues are required for running jobs using AWS batch executor. The available
|
|
|
436
436
|
|
|
437
437
|
#### List Queues
|
|
438
438
|
|
|
439
|
-
This command allows you to view available computational queues and their configurations. You can get a summary of all available
|
|
439
|
+
This command allows you to view available computational queues and their configurations. By default, both regular workspace queues and system queues are displayed. You can get a summary of all available job queues in three different output formats using the `--output-format` option:
|
|
440
440
|
|
|
441
441
|
- **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
|
|
442
442
|
- **csv**: Saves queue data to a CSV file with a selection of available queue information, or all information using the `--all-fields` flag
|
|
@@ -450,6 +450,12 @@ cloudos queue list --profile my_profile
|
|
|
450
450
|
cloudos queue list --profile my_profile --output-format stdout
|
|
451
451
|
```
|
|
452
452
|
|
|
453
|
+
To exclude system queues and show only workspace queues:
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
cloudos queue list --profile my_profile --exclude-system-queues
|
|
457
|
+
```
|
|
458
|
+
|
|
453
459
|
To save all available job queues in JSON format:
|
|
454
460
|
|
|
455
461
|
```bash
|
|
@@ -472,7 +478,7 @@ cloudos queue list --profile my_profile --output-format csv
|
|
|
472
478
|
|
|
473
479
|
**Job queues for platform workflows**
|
|
474
480
|
|
|
475
|
-
Platform workflows (those provided by CloudOS in your workspace as modules) run on separate and specific AWS batch queues. Therefore, CloudOS will automatically assign the valid queue and you should not specify any queue using the `--job-queue` parameter. Any attempt to use this parameter will be ignored. Examples of such platform workflows are "System Tools" and "Data Factory" workflows.
|
|
481
|
+
Platform workflows (those provided by CloudOS in your workspace as modules) run on separate and specific AWS batch queues (system queues). Therefore, CloudOS will automatically assign the valid queue and you should not specify any queue using the `--job-queue` parameter. Any attempt to use this parameter will be ignored. Examples of such platform workflows are "System Tools" and "Data Factory" workflows.
|
|
476
482
|
|
|
477
483
|
|
|
478
484
|
### Workflow
|
|
@@ -886,7 +892,7 @@ You can find specific jobs within your workspace using the filtering options. Fi
|
|
|
886
892
|
- **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
|
|
887
893
|
- **`--filter-only-mine`**: Show only jobs belonging to the current user
|
|
888
894
|
- **`--filter-owner`**: Show only jobs for the specified owner (exact match required, e.g., "John Doe")
|
|
889
|
-
- **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
|
|
895
|
+
- **`--filter-queue`**: Filter jobs by queue name (works with both regular and system queues; only applies to batch jobs)
|
|
890
896
|
|
|
891
897
|
**Filtering Examples**
|
|
892
898
|
|
|
@@ -401,7 +401,7 @@ Job queues are required for running jobs using AWS batch executor. The available
|
|
|
401
401
|
|
|
402
402
|
#### List Queues
|
|
403
403
|
|
|
404
|
-
This command allows you to view available computational queues and their configurations. You can get a summary of all available
|
|
404
|
+
This command allows you to view available computational queues and their configurations. By default, both regular workspace queues and system queues are displayed. You can get a summary of all available job queues in three different output formats using the `--output-format` option:
|
|
405
405
|
|
|
406
406
|
- **stdout** (default): Displays a rich formatted table directly in the terminal with pagination and visual formatting
|
|
407
407
|
- **csv**: Saves queue data to a CSV file with a selection of available queue information, or all information using the `--all-fields` flag
|
|
@@ -415,6 +415,12 @@ cloudos queue list --profile my_profile
|
|
|
415
415
|
cloudos queue list --profile my_profile --output-format stdout
|
|
416
416
|
```
|
|
417
417
|
|
|
418
|
+
To exclude system queues and show only workspace queues:
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
cloudos queue list --profile my_profile --exclude-system-queues
|
|
422
|
+
```
|
|
423
|
+
|
|
418
424
|
To save all available job queues in JSON format:
|
|
419
425
|
|
|
420
426
|
```bash
|
|
@@ -437,7 +443,7 @@ cloudos queue list --profile my_profile --output-format csv
|
|
|
437
443
|
|
|
438
444
|
**Job queues for platform workflows**
|
|
439
445
|
|
|
440
|
-
Platform workflows (those provided by CloudOS in your workspace as modules) run on separate and specific AWS batch queues. Therefore, CloudOS will automatically assign the valid queue and you should not specify any queue using the `--job-queue` parameter. Any attempt to use this parameter will be ignored. Examples of such platform workflows are "System Tools" and "Data Factory" workflows.
|
|
446
|
+
Platform workflows (those provided by CloudOS in your workspace as modules) run on separate and specific AWS batch queues (system queues). Therefore, CloudOS will automatically assign the valid queue and you should not specify any queue using the `--job-queue` parameter. Any attempt to use this parameter will be ignored. Examples of such platform workflows are "System Tools" and "Data Factory" workflows.
|
|
441
447
|
|
|
442
448
|
|
|
443
449
|
### Workflow
|
|
@@ -851,7 +857,7 @@ You can find specific jobs within your workspace using the filtering options. Fi
|
|
|
851
857
|
- **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
|
|
852
858
|
- **`--filter-only-mine`**: Show only jobs belonging to the current user
|
|
853
859
|
- **`--filter-owner`**: Show only jobs for the specified owner (exact match required, e.g., "John Doe")
|
|
854
|
-
- **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
|
|
860
|
+
- **`--filter-queue`**: Filter jobs by queue name (works with both regular and system queues; only applies to batch jobs)
|
|
855
861
|
|
|
856
862
|
**Filtering Examples**
|
|
857
863
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.87.1'
|
|
@@ -1239,9 +1239,7 @@ class Cloudos:
|
|
|
1239
1239
|
if target_job_count != 'all' and len(all_jobs) >= target_job_count:
|
|
1240
1240
|
break
|
|
1241
1241
|
else:
|
|
1242
|
-
|
|
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:
|
|
1242
|
+
if not filter_queue and len(all_jobs) >= current_page_size:
|
|
1245
1243
|
break
|
|
1246
1244
|
|
|
1247
1245
|
# Check if we reached the last page (fewer jobs than requested page size)
|
|
@@ -1257,6 +1255,18 @@ class Cloudos:
|
|
|
1257
1255
|
if use_pagination_mode and target_job_count != 'all' and isinstance(target_job_count, int) and target_job_count > 0:
|
|
1258
1256
|
all_jobs = all_jobs[:target_job_count]
|
|
1259
1257
|
|
|
1258
|
+
# --- Adjust pagination metadata for client-side filtering ---
|
|
1259
|
+
# When filter_queue is applied, we've fetched multiple API pages and filtered them.
|
|
1260
|
+
# We need to return all filtered jobs so the CLI can handle pagination client-side.
|
|
1261
|
+
if filter_queue and last_pagination_metadata:
|
|
1262
|
+
# Mark this as client-filtered so the CLI knows to handle pagination differently
|
|
1263
|
+
last_pagination_metadata = {
|
|
1264
|
+
'Pagination-Count': len(all_jobs), # Total filtered jobs collected
|
|
1265
|
+
'Pagination-Page': page, # The initial page requested
|
|
1266
|
+
'Pagination-Limit': current_page_size, # Page size
|
|
1267
|
+
'_client_filtered': True # Flag indicating client-side pagination needed
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1260
1270
|
return {'jobs': all_jobs, 'pagination_metadata': last_pagination_metadata}
|
|
1261
1271
|
|
|
1262
1272
|
@staticmethod
|
|
@@ -2321,8 +2331,8 @@ class Cloudos:
|
|
|
2321
2331
|
# The API uses various names: 'ready' and 'aborted' but we display them as 'running' and 'stopped' to users
|
|
2322
2332
|
status_mapping = {
|
|
2323
2333
|
'setup': 'setup',
|
|
2324
|
-
'initialising': '
|
|
2325
|
-
'initializing': '
|
|
2334
|
+
'initialising': 'initializing',
|
|
2335
|
+
'initializing': 'initializing', # Accept both spellings
|
|
2326
2336
|
'running': 'ready', # API uses 'ready' for running sessions
|
|
2327
2337
|
'scheduled': 'scheduled',
|
|
2328
2338
|
'stopped': 'aborted',
|
|
@@ -58,8 +58,8 @@ def interactive_session():
|
|
|
58
58
|
required=True)
|
|
59
59
|
@click.option('--filter-status',
|
|
60
60
|
multiple=True,
|
|
61
|
-
type=click.Choice(['setup', 'initialising', 'running', 'scheduled', 'paused'], case_sensitive=False),
|
|
62
|
-
help='Filter sessions by status. Can be specified multiple times to filter by multiple statuses.')
|
|
61
|
+
type=click.Choice(['setup', 'initialising', 'initializing', 'running', 'scheduled', 'paused'], case_sensitive=False),
|
|
62
|
+
help='Filter sessions by status. Can be specified multiple times to filter by multiple statuses. (Supports both initialising and initializing spellings)')
|
|
63
63
|
@click.option('--limit',
|
|
64
64
|
type=int,
|
|
65
65
|
default=10,
|
{cloudos_cli-2.86.0 → cloudos_cli-2.87.1}/cloudos_cli/interactive_session/interactive_session.py
RENAMED
|
@@ -1296,7 +1296,8 @@ API_STATUS_MAPPING = {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
|
|
1298
1298
|
# Pre-running statuses (watch mode only valid for these)
|
|
1299
|
-
|
|
1299
|
+
# Includes both British (initialising) and American (initializing) spellings
|
|
1300
|
+
PRE_RUNNING_STATUSES = {'setup', 'initialising', 'initializing', 'scheduled'}
|
|
1300
1301
|
|
|
1301
1302
|
|
|
1302
1303
|
def format_duration(seconds: int) -> str:
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import rich_click as click
|
|
4
4
|
import cloudos_cli.jobs.job as jb
|
|
5
|
+
from cloudos_cli.jobs.job import (
|
|
6
|
+
fetch_job_page,
|
|
7
|
+
create_api_pagination_callback,
|
|
8
|
+
create_client_pagination_callback
|
|
9
|
+
)
|
|
5
10
|
from cloudos_cli.clos import Cloudos
|
|
6
11
|
from cloudos_cli.utils.errors import BadRequestException
|
|
7
12
|
from cloudos_cli.utils.resources import ssl_selector
|
|
@@ -1335,7 +1340,13 @@ def list_jobs(ctx,
|
|
|
1335
1340
|
])
|
|
1336
1341
|
if output_format == 'stdout':
|
|
1337
1342
|
# For stdout, always show a user-friendly message
|
|
1338
|
-
|
|
1343
|
+
# Create callback for interactive pagination using helper function
|
|
1344
|
+
fetch_page = create_api_pagination_callback(
|
|
1345
|
+
cl, workspace_id, page_size, archived, verify_ssl,
|
|
1346
|
+
filter_status, filter_job_name, filter_project, filter_workflow,
|
|
1347
|
+
filter_job_id, filter_only_mine, filter_owner, filter_queue, last
|
|
1348
|
+
)
|
|
1349
|
+
create_job_list_table([], cloudos_url, pagination_metadata, selected_columns, fetch_page_callback=fetch_page)
|
|
1339
1350
|
else:
|
|
1340
1351
|
if filters_used:
|
|
1341
1352
|
print('A total of 0 jobs collected.')
|
|
@@ -1347,8 +1358,32 @@ def list_jobs(ctx,
|
|
|
1347
1358
|
'does not exist. Please, try a smaller number for --page or collect all the jobs by not ' +
|
|
1348
1359
|
'using --page parameter.')
|
|
1349
1360
|
elif output_format == 'stdout':
|
|
1350
|
-
# Display as table
|
|
1351
|
-
|
|
1361
|
+
# Display as table with interactive pagination
|
|
1362
|
+
|
|
1363
|
+
# Check if results are client-side filtered (e.g., by queue)
|
|
1364
|
+
is_client_filtered = pagination_metadata and pagination_metadata.get('_client_filtered', False)
|
|
1365
|
+
|
|
1366
|
+
if is_client_filtered:
|
|
1367
|
+
# For client-filtered results, we have all jobs already
|
|
1368
|
+
# Create a callback that paginates them client-side using helper function
|
|
1369
|
+
fetch_page = create_client_pagination_callback(my_jobs_r, page_size)
|
|
1370
|
+
|
|
1371
|
+
# Show first page of filtered results
|
|
1372
|
+
first_page_jobs = my_jobs_r[:page_size]
|
|
1373
|
+
first_page_metadata = {
|
|
1374
|
+
'Pagination-Count': len(my_jobs_r),
|
|
1375
|
+
'Pagination-Page': 1,
|
|
1376
|
+
'Pagination-Limit': page_size
|
|
1377
|
+
}
|
|
1378
|
+
create_job_list_table(first_page_jobs, cloudos_url, first_page_metadata, selected_columns, fetch_page_callback=fetch_page)
|
|
1379
|
+
else:
|
|
1380
|
+
# For normal (non-filtered) results, use API pagination with helper function
|
|
1381
|
+
fetch_page = create_api_pagination_callback(
|
|
1382
|
+
cl, workspace_id, page_size, archived, verify_ssl,
|
|
1383
|
+
filter_status, filter_job_name, filter_project, filter_workflow,
|
|
1384
|
+
filter_job_id, filter_only_mine, filter_owner, filter_queue, last
|
|
1385
|
+
)
|
|
1386
|
+
create_job_list_table(my_jobs_r, cloudos_url, pagination_metadata, selected_columns, fetch_page_callback=fetch_page)
|
|
1352
1387
|
elif output_format == 'csv':
|
|
1353
1388
|
my_jobs = cl.process_job_list(my_jobs_r, all_fields)
|
|
1354
1389
|
cl.save_job_list_to_csv(my_jobs, outfile)
|
|
@@ -1727,3 +1727,154 @@ class Job(Cloudos):
|
|
|
1727
1727
|
|
|
1728
1728
|
return {"branches": all_branches, "total": total or len(all_branches)}
|
|
1729
1729
|
|
|
1730
|
+
|
|
1731
|
+
def fetch_job_page(cl, workspace_id, page_num, page_size, last_n_jobs, archived, verify_ssl,
|
|
1732
|
+
filter_status, filter_job_name, filter_project, filter_workflow,
|
|
1733
|
+
filter_job_id, filter_only_mine, filter_owner, filter_queue, last):
|
|
1734
|
+
"""Helper function to fetch a specific page of jobs.
|
|
1735
|
+
Parameters
|
|
1736
|
+
----------
|
|
1737
|
+
cl : Cloudos
|
|
1738
|
+
CloudOS API client instance
|
|
1739
|
+
workspace_id : str
|
|
1740
|
+
The CloudOS workspace ID
|
|
1741
|
+
page_num : int
|
|
1742
|
+
Page number to fetch (1-indexed)
|
|
1743
|
+
page_size : int
|
|
1744
|
+
Number of jobs per page
|
|
1745
|
+
last_n_jobs : int or None
|
|
1746
|
+
Last N jobs parameter (should be None for pagination mode)
|
|
1747
|
+
archived : bool
|
|
1748
|
+
Whether to include archived jobs
|
|
1749
|
+
verify_ssl : bool or str
|
|
1750
|
+
SSL verification setting
|
|
1751
|
+
filter_status : str or None
|
|
1752
|
+
Status filter
|
|
1753
|
+
filter_job_name : str or None
|
|
1754
|
+
Job name filter
|
|
1755
|
+
filter_project : str or None
|
|
1756
|
+
Project filter
|
|
1757
|
+
filter_workflow : str or None
|
|
1758
|
+
Workflow filter
|
|
1759
|
+
filter_job_id : str or None
|
|
1760
|
+
Job ID filter
|
|
1761
|
+
filter_only_mine : bool
|
|
1762
|
+
Filter for user's own jobs
|
|
1763
|
+
filter_owner : str or None
|
|
1764
|
+
Owner filter
|
|
1765
|
+
filter_queue : str or None
|
|
1766
|
+
Queue filter
|
|
1767
|
+
last : bool
|
|
1768
|
+
Use latest workflow for duplicates
|
|
1769
|
+
Returns
|
|
1770
|
+
-------
|
|
1771
|
+
dict
|
|
1772
|
+
Dictionary with 'jobs' list and 'pagination_metadata' dict
|
|
1773
|
+
"""
|
|
1774
|
+
result = cl.get_job_list(
|
|
1775
|
+
workspace_id,
|
|
1776
|
+
last_n_jobs=last_n_jobs,
|
|
1777
|
+
page=page_num,
|
|
1778
|
+
page_size=page_size,
|
|
1779
|
+
archived=archived,
|
|
1780
|
+
verify=verify_ssl,
|
|
1781
|
+
filter_status=filter_status,
|
|
1782
|
+
filter_job_name=filter_job_name,
|
|
1783
|
+
filter_project=filter_project,
|
|
1784
|
+
filter_workflow=filter_workflow,
|
|
1785
|
+
filter_job_id=filter_job_id,
|
|
1786
|
+
filter_only_mine=filter_only_mine,
|
|
1787
|
+
filter_owner=filter_owner,
|
|
1788
|
+
filter_queue=filter_queue,
|
|
1789
|
+
last=last
|
|
1790
|
+
)
|
|
1791
|
+
return result
|
|
1792
|
+
|
|
1793
|
+
|
|
1794
|
+
def create_api_pagination_callback(cl, workspace_id, page_size, archived, verify_ssl,
|
|
1795
|
+
filter_status, filter_job_name, filter_project, filter_workflow,
|
|
1796
|
+
filter_job_id, filter_only_mine, filter_owner, filter_queue, last):
|
|
1797
|
+
"""Create a pagination callback that fetches pages from the API.
|
|
1798
|
+
|
|
1799
|
+
Parameters
|
|
1800
|
+
----------
|
|
1801
|
+
cl : Cloudos
|
|
1802
|
+
CloudOS API client instance
|
|
1803
|
+
workspace_id : str
|
|
1804
|
+
The CloudOS workspace ID
|
|
1805
|
+
page_size : int
|
|
1806
|
+
Number of jobs per page
|
|
1807
|
+
archived : bool
|
|
1808
|
+
Whether to include archived jobs
|
|
1809
|
+
verify_ssl : bool or str
|
|
1810
|
+
SSL verification setting
|
|
1811
|
+
filter_status : str or None
|
|
1812
|
+
Status filter
|
|
1813
|
+
filter_job_name : str or None
|
|
1814
|
+
Job name filter
|
|
1815
|
+
filter_project : str or None
|
|
1816
|
+
Project filter
|
|
1817
|
+
filter_workflow : str or None
|
|
1818
|
+
Workflow filter
|
|
1819
|
+
filter_job_id : str or None
|
|
1820
|
+
Job ID filter
|
|
1821
|
+
filter_only_mine : bool
|
|
1822
|
+
Filter for user's own jobs
|
|
1823
|
+
filter_owner : str or None
|
|
1824
|
+
Owner filter
|
|
1825
|
+
filter_queue : str or None
|
|
1826
|
+
Queue filter
|
|
1827
|
+
last : bool
|
|
1828
|
+
Use latest workflow for duplicates
|
|
1829
|
+
|
|
1830
|
+
Returns
|
|
1831
|
+
-------
|
|
1832
|
+
callable
|
|
1833
|
+
Callback function that takes page_num and returns job page data
|
|
1834
|
+
"""
|
|
1835
|
+
def api_fetch_callback(page_num):
|
|
1836
|
+
return fetch_job_page(
|
|
1837
|
+
cl, workspace_id, page_num, page_size, None, archived, verify_ssl,
|
|
1838
|
+
filter_status, filter_job_name, filter_project, filter_workflow,
|
|
1839
|
+
filter_job_id, filter_only_mine, filter_owner, filter_queue, last
|
|
1840
|
+
)
|
|
1841
|
+
return api_fetch_callback
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
def create_client_pagination_callback(all_jobs, page_size):
|
|
1845
|
+
"""Create a pagination callback that paginates already-fetched jobs client-side.
|
|
1846
|
+
|
|
1847
|
+
Used when jobs have been pre-filtered client-side (e.g., by queue) and we
|
|
1848
|
+
want to paginate through the cached results.
|
|
1849
|
+
|
|
1850
|
+
Parameters
|
|
1851
|
+
----------
|
|
1852
|
+
all_jobs : list
|
|
1853
|
+
List of all jobs to paginate through
|
|
1854
|
+
page_size : int
|
|
1855
|
+
Number of jobs per page
|
|
1856
|
+
|
|
1857
|
+
Returns
|
|
1858
|
+
-------
|
|
1859
|
+
callable
|
|
1860
|
+
Callback function that takes page_num and returns job page data
|
|
1861
|
+
"""
|
|
1862
|
+
def client_fetch_callback(page_num):
|
|
1863
|
+
"""Paginate client-side filtered results"""
|
|
1864
|
+
start_idx = (page_num - 1) * page_size
|
|
1865
|
+
end_idx = start_idx + page_size
|
|
1866
|
+
page_jobs = all_jobs[start_idx:end_idx]
|
|
1867
|
+
|
|
1868
|
+
# Return with updated pagination metadata
|
|
1869
|
+
return {
|
|
1870
|
+
'jobs': page_jobs,
|
|
1871
|
+
'pagination_metadata': {
|
|
1872
|
+
'Pagination-Count': len(all_jobs),
|
|
1873
|
+
'Pagination-Page': page_num,
|
|
1874
|
+
'Pagination-Limit': page_size,
|
|
1875
|
+
'_client_filtered': True
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
return client_fetch_callback
|
|
1879
|
+
|
|
1880
|
+
|
|
@@ -47,6 +47,9 @@ def queue():
|
|
|
47
47
|
'just the preconfigured selected fields. Only applicable ' +
|
|
48
48
|
'when --output-format=csv'),
|
|
49
49
|
is_flag=True)
|
|
50
|
+
@click.option('--exclude-system-queues',
|
|
51
|
+
help='Exclude system job queues from the list.',
|
|
52
|
+
is_flag=True)
|
|
50
53
|
@click.option('--disable-ssl-verification',
|
|
51
54
|
help=('Disable SSL certificate verification. Please, remember that this option is ' +
|
|
52
55
|
'not generally recommended for security reasons.'),
|
|
@@ -63,6 +66,7 @@ def list_queues(ctx,
|
|
|
63
66
|
output_basename,
|
|
64
67
|
output_format,
|
|
65
68
|
all_fields,
|
|
69
|
+
exclude_system_queues,
|
|
66
70
|
disable_ssl_verification,
|
|
67
71
|
ssl_cert,
|
|
68
72
|
profile):
|
|
@@ -72,7 +76,7 @@ def list_queues(ctx,
|
|
|
72
76
|
verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
|
|
73
77
|
print('Executing list...')
|
|
74
78
|
j_queue = Queue(cloudos_url, apikey, None, workspace_id, verify=verify_ssl)
|
|
75
|
-
my_queues = j_queue.get_job_queues()
|
|
79
|
+
my_queues = j_queue.get_job_queues(exclude_system_queues=exclude_system_queues)
|
|
76
80
|
if len(my_queues) == 0:
|
|
77
81
|
raise ValueError('No AWS batch queues found. Please, make sure that your CloudOS supports AWS batch queues')
|
|
78
82
|
if output_format == 'stdout':
|
|
@@ -33,9 +33,14 @@ class Queue(Cloudos):
|
|
|
33
33
|
workspace_id: str
|
|
34
34
|
verify: Union[bool, str] = True
|
|
35
35
|
|
|
36
|
-
def get_job_queues(self):
|
|
36
|
+
def get_job_queues(self, exclude_system_queues=False):
|
|
37
37
|
"""Get all the job queues from a CloudOS workspace.
|
|
38
38
|
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
exclude_system_queues : bool, default=False
|
|
42
|
+
Whether to exclude system job queues from the result.
|
|
43
|
+
|
|
39
44
|
Returns
|
|
40
45
|
-------
|
|
41
46
|
r : list
|
|
@@ -47,6 +52,28 @@ class Queue(Cloudos):
|
|
|
47
52
|
headers=headers, verify=self.verify)
|
|
48
53
|
if r.status_code >= 400:
|
|
49
54
|
raise BadRequestException(r)
|
|
55
|
+
queues = json.loads(r.content)
|
|
56
|
+
# By default, include system queues unless excluded
|
|
57
|
+
if not exclude_system_queues:
|
|
58
|
+
system_queues = self.get_system_job_queues()
|
|
59
|
+
queues.extend(system_queues)
|
|
60
|
+
|
|
61
|
+
return queues
|
|
62
|
+
|
|
63
|
+
def get_system_job_queues(self):
|
|
64
|
+
"""Get all the system job queues from CloudOS.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
r : list
|
|
69
|
+
A list of dicts, each corresponding to a system job queue.
|
|
70
|
+
"""
|
|
71
|
+
headers = {"apikey": self.apikey}
|
|
72
|
+
r = requests.get("{}/api/v1/teams/aws/v2/system-job-queues?teamId={}".format(self.cloudos_url,
|
|
73
|
+
self.workspace_id),
|
|
74
|
+
headers=headers, verify=self.verify)
|
|
75
|
+
if r.status_code >= 400:
|
|
76
|
+
raise BadRequestException(r)
|
|
50
77
|
return json.loads(r.content)
|
|
51
78
|
|
|
52
79
|
@staticmethod
|
|
@@ -118,7 +145,7 @@ class Queue(Cloudos):
|
|
|
118
145
|
if len(available_queues) == 0:
|
|
119
146
|
raise Exception(f'There are no available job queues for {workflow_type} ' +
|
|
120
147
|
'workflows. Consider creating one using CloudOS UI.')
|
|
121
|
-
default_queue = [q for q in available_queues if q
|
|
148
|
+
default_queue = [q for q in available_queues if q.get('isDefault', False)]
|
|
122
149
|
if len(default_queue) > 0:
|
|
123
150
|
default_queue_id = default_queue[0]['id']
|
|
124
151
|
default_queue_name = default_queue[0]['label']
|