cloudos-cli 2.93.1__tar.gz → 2.94.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.
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/PKG-INFO +31 -1
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/README.md +30 -0
- cloudos_cli-2.94.0/cloudos_cli/_version.py +1 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/queue/__init__.py +1 -1
- cloudos_cli-2.94.0/cloudos_cli/queue/cli.py +290 -0
- cloudos_cli-2.94.0/cloudos_cli/queue/queue.py +426 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/errors.py +19 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/PKG-INFO +31 -1
- cloudos_cli-2.93.1/cloudos_cli/_version.py +0 -1
- cloudos_cli-2.93.1/cloudos_cli/queue/cli.py +0 -95
- cloudos_cli-2.93.1/cloudos_cli/queue/queue.py +0 -166
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/LICENSE +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/__main__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/bash/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/bash/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/clos.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/configure/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/configure/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/configure/configure.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/constants.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/cost/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/cost/cost.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/cromwell/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/cromwell/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/datasets/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/datasets/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/datasets/datasets.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/import_wf/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/import_wf/import_wf.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/interactive_session/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/interactive_session/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/interactive_session/interactive_session.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/interactive_session/link.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/jobs/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/jobs/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/jobs/job.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/logging/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/logging/logger.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/procurement/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/procurement/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/procurement/images.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/projects/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/projects/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/related_analyses/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/related_analyses/related_analyses.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/array_job.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/cli_helpers.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/cloud.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/details.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/last_wf.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/nextflow_version.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/requests.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/utils/resources.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/workflows/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli/workflows/cli.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/SOURCES.txt +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/requires.txt +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/cloudos_cli.egg-info/top_level.txt +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/setup.cfg +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/setup.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/functions_for_pytest.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_cli_project_create.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_cost/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_cost/test_job_cost.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_details.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_error_messages.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/test_create_session.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/test_link_error_handling.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/test_link_session.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/test_list_sessions.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_interactive_session/test_normalize_path.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_logging/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_logging/test_logger.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_nextflow_version.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.0}/tests/test_related_analyses/__init__.py +0 -0
- {cloudos_cli-2.93.1 → cloudos_cli-2.94.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.
|
|
3
|
+
Version: 2.94.0
|
|
4
4
|
Summary: Python package for interacting with the Lifebit Platform
|
|
5
5
|
Home-page: https://github.com/lifebit-ai/cloudos-cli
|
|
6
6
|
Author: David Piñeyro
|
|
@@ -64,6 +64,7 @@ Python package for interacting with Lifebit Platform
|
|
|
64
64
|
- [Create Projects](#create-projects)
|
|
65
65
|
- [Queue](#queue)
|
|
66
66
|
- [List Queues](#list-queues)
|
|
67
|
+
- [Create Queue](#create-queue)
|
|
67
68
|
- [Workflow](#workflow)
|
|
68
69
|
- [List All Available Workflows](#list-all-available-workflows)
|
|
69
70
|
- [Import a Nextflow Workflow](#import-a-nextflow-workflow)
|
|
@@ -476,6 +477,35 @@ cloudos queue list --profile my_profile --output-format csv
|
|
|
476
477
|
|
|
477
478
|
> NOTE: The queue name that is visible in Lifebit Platform and must be used with the `--job-queue` parameter is the one in the `label` field.
|
|
478
479
|
|
|
480
|
+
#### Create Queue
|
|
481
|
+
|
|
482
|
+
You can create a new AWS batch job queue in your Lifebit Platform workspace using the `queue create` command. By default the queue is built from a preset template, selected with the `--preset` option. Available presets are:
|
|
483
|
+
|
|
484
|
+
- **standard-stable** (default): On-demand stable instances
|
|
485
|
+
- **standard-cost-saving**: Spot instances (up to ~80% cheaper, at risk of premature termination)
|
|
486
|
+
- **read-write-optimised**: On-demand instances with increased disk I/O performance
|
|
487
|
+
- **standard-gpu**: On-demand standard instances plus GPU instances
|
|
488
|
+
|
|
489
|
+
To create a queue from a preset:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
cloudos queue create --profile my_profile --label "my-new-queue" --description "Queue for RNA-seq jobs" --preset standard-stable
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Before creating the queue, a summary is shown and confirmation is requested. To skip the confirmation prompt, add the `-y`/`--yes` flag. You can also set the new queue as the workspace default with `--set-default`.
|
|
496
|
+
|
|
497
|
+
The expected output is something similar to:
|
|
498
|
+
|
|
499
|
+
```console
|
|
500
|
+
Executing queue create...
|
|
501
|
+
Queue "my-new-queue" created successfully.
|
|
502
|
+
Queue ID : 64f1a23b8e4c9d001234abcd
|
|
503
|
+
View at : https://cloudos.lifebit.ai/app/job-queues/64f1a23b8e4c9d001234abcd
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
> [!NOTE]
|
|
507
|
+
> **Azure Platform**: Batch job queues are an AWS-only feature and are not available in Azure or HPC workspaces.
|
|
508
|
+
|
|
479
509
|
**Job queues for platform workflows**
|
|
480
510
|
|
|
481
511
|
Platform workflows (those provided by Lifebit Platform in your workspace as modules) run on separate and specific AWS batch queues (system queues). Therefore, Lifebit Platform 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.
|
|
@@ -29,6 +29,7 @@ Python package for interacting with Lifebit Platform
|
|
|
29
29
|
- [Create Projects](#create-projects)
|
|
30
30
|
- [Queue](#queue)
|
|
31
31
|
- [List Queues](#list-queues)
|
|
32
|
+
- [Create Queue](#create-queue)
|
|
32
33
|
- [Workflow](#workflow)
|
|
33
34
|
- [List All Available Workflows](#list-all-available-workflows)
|
|
34
35
|
- [Import a Nextflow Workflow](#import-a-nextflow-workflow)
|
|
@@ -441,6 +442,35 @@ cloudos queue list --profile my_profile --output-format csv
|
|
|
441
442
|
|
|
442
443
|
> NOTE: The queue name that is visible in Lifebit Platform and must be used with the `--job-queue` parameter is the one in the `label` field.
|
|
443
444
|
|
|
445
|
+
#### Create Queue
|
|
446
|
+
|
|
447
|
+
You can create a new AWS batch job queue in your Lifebit Platform workspace using the `queue create` command. By default the queue is built from a preset template, selected with the `--preset` option. Available presets are:
|
|
448
|
+
|
|
449
|
+
- **standard-stable** (default): On-demand stable instances
|
|
450
|
+
- **standard-cost-saving**: Spot instances (up to ~80% cheaper, at risk of premature termination)
|
|
451
|
+
- **read-write-optimised**: On-demand instances with increased disk I/O performance
|
|
452
|
+
- **standard-gpu**: On-demand standard instances plus GPU instances
|
|
453
|
+
|
|
454
|
+
To create a queue from a preset:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
cloudos queue create --profile my_profile --label "my-new-queue" --description "Queue for RNA-seq jobs" --preset standard-stable
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Before creating the queue, a summary is shown and confirmation is requested. To skip the confirmation prompt, add the `-y`/`--yes` flag. You can also set the new queue as the workspace default with `--set-default`.
|
|
461
|
+
|
|
462
|
+
The expected output is something similar to:
|
|
463
|
+
|
|
464
|
+
```console
|
|
465
|
+
Executing queue create...
|
|
466
|
+
Queue "my-new-queue" created successfully.
|
|
467
|
+
Queue ID : 64f1a23b8e4c9d001234abcd
|
|
468
|
+
View at : https://cloudos.lifebit.ai/app/job-queues/64f1a23b8e4c9d001234abcd
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
> [!NOTE]
|
|
472
|
+
> **Azure Platform**: Batch job queues are an AWS-only feature and are not available in Azure or HPC workspaces.
|
|
473
|
+
|
|
444
474
|
**Job queues for platform workflows**
|
|
445
475
|
|
|
446
476
|
Platform workflows (those provided by Lifebit Platform in your workspace as modules) run on separate and specific AWS batch queues (system queues). Therefore, Lifebit Platform 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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.94.0'
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"""CLI commands for Lifebit Platform job queue management."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import rich_click as click
|
|
5
|
+
import json
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
from cloudos_cli.queue.queue import (
|
|
8
|
+
Queue,
|
|
9
|
+
QUEUE_PRESETS,
|
|
10
|
+
MAX_WORKSPACE_COMPUTE_ENVS,
|
|
11
|
+
WORKSPACE_CE_LIMIT_REACHED_MESSAGE,
|
|
12
|
+
)
|
|
13
|
+
from cloudos_cli.utils.resources import ssl_selector
|
|
14
|
+
from cloudos_cli.configure.configure import with_profile_config, CLOUDOS_URL
|
|
15
|
+
from cloudos_cli.utils.cli_helpers import pass_debug_to_subcommands
|
|
16
|
+
from cloudos_cli.utils.details import create_queue_list_table
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Workflow executors supported for job queues.
|
|
20
|
+
_EXECUTORS = ["nextflow", "cromwell"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _check_workspace_ce_limit(console, j_queue, queues=None):
|
|
24
|
+
"""Exit with a warning if the workspace has reached its CE limit.
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
console : rich.console.Console
|
|
29
|
+
The console used for rich output.
|
|
30
|
+
j_queue : Queue
|
|
31
|
+
The queue client used to count compute environments.
|
|
32
|
+
queues : list or None, optional
|
|
33
|
+
A pre-fetched list of job queue dicts. If ``None``, the queues are
|
|
34
|
+
fetched.
|
|
35
|
+
"""
|
|
36
|
+
count = j_queue.count_workspace_compute_environments(queues=queues)
|
|
37
|
+
if count >= MAX_WORKSPACE_COMPUTE_ENVS:
|
|
38
|
+
console.print(
|
|
39
|
+
f"[yellow]Warning:[/yellow] {WORKSPACE_CE_LIMIT_REACHED_MESSAGE}"
|
|
40
|
+
)
|
|
41
|
+
sys.exit(0)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Create the queue group
|
|
47
|
+
@click.group(cls=pass_debug_to_subcommands())
|
|
48
|
+
def queue():
|
|
49
|
+
"""Lifebit Platform job queue functionality."""
|
|
50
|
+
print(queue.__doc__ + '\n')
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@queue.command('list')
|
|
54
|
+
@click.option('-k',
|
|
55
|
+
'--apikey',
|
|
56
|
+
help='Your Lifebit Platform API key',
|
|
57
|
+
required=True)
|
|
58
|
+
@click.option('-c',
|
|
59
|
+
'--cloudos-url',
|
|
60
|
+
help=(f'The Lifebit Platform url you are trying to access to. Default={CLOUDOS_URL}.'),
|
|
61
|
+
default=CLOUDOS_URL,
|
|
62
|
+
required=True)
|
|
63
|
+
@click.option('--workspace-id',
|
|
64
|
+
help='The specific Lifebit Platform workspace id.',
|
|
65
|
+
required=True)
|
|
66
|
+
@click.option('--output-basename',
|
|
67
|
+
help=('Output file base name to save job queue list. ' +
|
|
68
|
+
'Default=job_queue_list'),
|
|
69
|
+
default='job_queue_list',
|
|
70
|
+
required=False)
|
|
71
|
+
@click.option('--output-format',
|
|
72
|
+
help=('Output format for queue list. Options: '
|
|
73
|
+
'stdout (display as interactive table in terminal), '
|
|
74
|
+
'csv (save as comma-separated values file), '
|
|
75
|
+
'json (save as JSON file with full API response). '
|
|
76
|
+
'Default=stdout.'),
|
|
77
|
+
type=click.Choice(['stdout', 'csv', 'json'], case_sensitive=False),
|
|
78
|
+
default='stdout')
|
|
79
|
+
@click.option('--all-fields',
|
|
80
|
+
help=('Whether to collect all available fields from queues or ' +
|
|
81
|
+
'just the preconfigured selected fields. Only applicable ' +
|
|
82
|
+
'when --output-format=csv'),
|
|
83
|
+
is_flag=True)
|
|
84
|
+
@click.option('--exclude-system-queues',
|
|
85
|
+
help='Exclude system job queues from the list.',
|
|
86
|
+
is_flag=True)
|
|
87
|
+
@click.option('--execution-platform',
|
|
88
|
+
help='Name of the execution platform implemented in your Lifebit Platform. Default=aws.',
|
|
89
|
+
type=click.Choice(['aws', 'azure', 'hpc']),
|
|
90
|
+
default='aws')
|
|
91
|
+
@click.option('--disable-ssl-verification',
|
|
92
|
+
help=('Disable SSL certificate verification. Please, remember that this option is ' +
|
|
93
|
+
'not generally recommended for security reasons.'),
|
|
94
|
+
is_flag=True)
|
|
95
|
+
@click.option('--ssl-cert',
|
|
96
|
+
help='Path to your SSL certificate file.')
|
|
97
|
+
@click.option('--profile', help='Profile to use from the config file', default=None)
|
|
98
|
+
@click.pass_context
|
|
99
|
+
@with_profile_config(required_params=['apikey', 'workspace_id'])
|
|
100
|
+
def list_queues(ctx,
|
|
101
|
+
apikey,
|
|
102
|
+
cloudos_url,
|
|
103
|
+
workspace_id,
|
|
104
|
+
output_basename,
|
|
105
|
+
output_format,
|
|
106
|
+
all_fields,
|
|
107
|
+
exclude_system_queues,
|
|
108
|
+
execution_platform,
|
|
109
|
+
disable_ssl_verification,
|
|
110
|
+
ssl_cert,
|
|
111
|
+
profile):
|
|
112
|
+
"""Collect and display all available job queues from a Lifebit Platform workspace."""
|
|
113
|
+
# apikey, cloudos_url, and workspace_id are now automatically resolved by the decorator
|
|
114
|
+
|
|
115
|
+
verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
|
|
116
|
+
|
|
117
|
+
# Batch job queues are an AWS-only feature; they are not available in
|
|
118
|
+
# Azure or HPC workspaces.
|
|
119
|
+
if execution_platform in ('azure', 'hpc'):
|
|
120
|
+
Console().print(
|
|
121
|
+
'[yellow]Warning:[/yellow] Batch job queues are not available in '
|
|
122
|
+
f'{execution_platform.upper()} workspaces.'
|
|
123
|
+
)
|
|
124
|
+
sys.exit(0)
|
|
125
|
+
|
|
126
|
+
print('Executing list...')
|
|
127
|
+
j_queue = Queue(cloudos_url, apikey, None, workspace_id, verify=verify_ssl)
|
|
128
|
+
my_queues = j_queue.get_job_queues(exclude_system_queues=exclude_system_queues)
|
|
129
|
+
if len(my_queues) == 0:
|
|
130
|
+
raise ValueError('No AWS batch queues found. Please, make sure that your Lifebit Platform supports AWS batch queues')
|
|
131
|
+
if output_format == 'stdout':
|
|
132
|
+
create_queue_list_table(my_queues, cloudos_url)
|
|
133
|
+
elif output_format == 'csv':
|
|
134
|
+
outfile = output_basename + '.' + output_format
|
|
135
|
+
queues_processed = j_queue.process_queue_list(my_queues, all_fields)
|
|
136
|
+
queues_processed.to_csv(outfile, index=False)
|
|
137
|
+
print(f'\tJob queue list collected with a total of {queues_processed.shape[0]} queues.')
|
|
138
|
+
print(f'\tJob queue list saved to {outfile}')
|
|
139
|
+
elif output_format == 'json':
|
|
140
|
+
outfile = output_basename + '.' + output_format
|
|
141
|
+
with open(outfile, 'w') as o:
|
|
142
|
+
o.write(json.dumps(my_queues))
|
|
143
|
+
print(f'\tJob queue list collected with a total of {len(my_queues)} queues.')
|
|
144
|
+
print(f'\tJob queue list saved to {outfile}')
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@queue.command('create')
|
|
148
|
+
@click.option('-k',
|
|
149
|
+
'--apikey',
|
|
150
|
+
help='Your Lifebit Platform API key',
|
|
151
|
+
required=True)
|
|
152
|
+
@click.option('-c',
|
|
153
|
+
'--cloudos-url',
|
|
154
|
+
help=(f'The Lifebit Platform url you are trying to access to. Default={CLOUDOS_URL}.'),
|
|
155
|
+
default=CLOUDOS_URL,
|
|
156
|
+
required=True)
|
|
157
|
+
@click.option('--workspace-id',
|
|
158
|
+
help='The specific Lifebit Platform workspace id.',
|
|
159
|
+
required=True)
|
|
160
|
+
@click.option('--label',
|
|
161
|
+
help='Name (label) for the new job queue.',
|
|
162
|
+
required=False,
|
|
163
|
+
default=None)
|
|
164
|
+
@click.option('--description',
|
|
165
|
+
help='Short description of the new job queue.',
|
|
166
|
+
default='',
|
|
167
|
+
required=False)
|
|
168
|
+
@click.option('--preset',
|
|
169
|
+
help=(
|
|
170
|
+
'Preset template to use. Choices: '
|
|
171
|
+
+ ', '.join(QUEUE_PRESETS.keys())
|
|
172
|
+
+ '. Default=standard-stable.'
|
|
173
|
+
),
|
|
174
|
+
type=click.Choice(list(QUEUE_PRESETS.keys()), case_sensitive=False),
|
|
175
|
+
default='standard-stable',
|
|
176
|
+
show_default=True,
|
|
177
|
+
required=False)
|
|
178
|
+
@click.option('--executor',
|
|
179
|
+
help='Workflow executor for the queue. Default=nextflow.',
|
|
180
|
+
type=click.Choice(_EXECUTORS, case_sensitive=False),
|
|
181
|
+
default='nextflow',
|
|
182
|
+
show_default=True,
|
|
183
|
+
required=False)
|
|
184
|
+
@click.option('-y',
|
|
185
|
+
'--yes',
|
|
186
|
+
'skip_confirmation',
|
|
187
|
+
help='Skip the confirmation prompt and proceed immediately.',
|
|
188
|
+
is_flag=True)
|
|
189
|
+
@click.option('--set-default',
|
|
190
|
+
help='Set the new job queue as the workspace default. Default=False.',
|
|
191
|
+
is_flag=True)
|
|
192
|
+
@click.option('--execution-platform',
|
|
193
|
+
help='Name of the execution platform implemented in your Lifebit Platform. Default=aws.',
|
|
194
|
+
type=click.Choice(['aws', 'azure', 'hpc']),
|
|
195
|
+
default='aws')
|
|
196
|
+
@click.option('--disable-ssl-verification',
|
|
197
|
+
help=('Disable SSL certificate verification. Please, remember that this option is '
|
|
198
|
+
'not generally recommended for security reasons.'),
|
|
199
|
+
is_flag=True)
|
|
200
|
+
@click.option('--ssl-cert',
|
|
201
|
+
help='Path to your SSL certificate file.')
|
|
202
|
+
@click.option('--profile', help='Profile to use from the config file', default=None)
|
|
203
|
+
@click.pass_context
|
|
204
|
+
@with_profile_config(required_params=['apikey', 'workspace_id'])
|
|
205
|
+
def create_queue(ctx,
|
|
206
|
+
apikey,
|
|
207
|
+
cloudos_url,
|
|
208
|
+
workspace_id,
|
|
209
|
+
label,
|
|
210
|
+
description,
|
|
211
|
+
preset,
|
|
212
|
+
executor,
|
|
213
|
+
skip_confirmation,
|
|
214
|
+
set_default,
|
|
215
|
+
execution_platform,
|
|
216
|
+
disable_ssl_verification,
|
|
217
|
+
ssl_cert,
|
|
218
|
+
profile):
|
|
219
|
+
"""Create a new job queue in a Lifebit Platform workspace.
|
|
220
|
+
|
|
221
|
+
A preset template is used to create the queue.
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
|
|
225
|
+
|
|
226
|
+
# Batch job queues are an AWS-only feature; they are not available in
|
|
227
|
+
# Azure or HPC workspaces.
|
|
228
|
+
if execution_platform in ('azure', 'hpc'):
|
|
229
|
+
Console().print(
|
|
230
|
+
'[yellow]Warning:[/yellow] Batch job queues are not available in '
|
|
231
|
+
f'{execution_platform.upper()} workspaces.'
|
|
232
|
+
)
|
|
233
|
+
sys.exit(0)
|
|
234
|
+
|
|
235
|
+
# --description is required when creating a queue.
|
|
236
|
+
if not description:
|
|
237
|
+
raise click.UsageError('Missing option --description.')
|
|
238
|
+
|
|
239
|
+
if label is None:
|
|
240
|
+
raise click.UsageError('Missing option --label.')
|
|
241
|
+
|
|
242
|
+
# Resolve the preset to show the user what will be created
|
|
243
|
+
preset_info = QUEUE_PRESETS[preset]
|
|
244
|
+
ce_name = preset_info['computeEnvironmentName']
|
|
245
|
+
cr = preset_info['computeResources']
|
|
246
|
+
resource_type = cr.get('type', 'EC2')
|
|
247
|
+
max_vcpus_preset = cr.get('maxvCpus', 'N/A')
|
|
248
|
+
instance_count = len(cr.get('instanceTypes', []))
|
|
249
|
+
template_name = preset_info['templateName']
|
|
250
|
+
|
|
251
|
+
j_queue = Queue(cloudos_url, apikey, None, workspace_id, verify=verify_ssl)
|
|
252
|
+
|
|
253
|
+
# Creating a queue creates a compute environment; enforce the workspace limit.
|
|
254
|
+
_check_workspace_ce_limit(Console(), j_queue)
|
|
255
|
+
|
|
256
|
+
if not skip_confirmation:
|
|
257
|
+
click.echo('\nYou are about to create the following job queue:')
|
|
258
|
+
click.echo(f' Label : {label}')
|
|
259
|
+
click.echo(f' Description : {description or "(none)"}')
|
|
260
|
+
click.echo(f' Preset : {template_name}')
|
|
261
|
+
click.echo(f' Compute env name : {ce_name}')
|
|
262
|
+
click.echo(f' Resource type : {resource_type}')
|
|
263
|
+
click.echo(f' Max vCPUs : {max_vcpus_preset}')
|
|
264
|
+
click.echo(f' Instance types : {instance_count} types')
|
|
265
|
+
click.echo(f' Executor : {executor}')
|
|
266
|
+
click.echo(f' Set as default : {set_default}')
|
|
267
|
+
click.echo(f' Workspace : {workspace_id}')
|
|
268
|
+
click.echo('')
|
|
269
|
+
if not click.confirm('Proceed with queue creation?'):
|
|
270
|
+
click.echo('Aborted.')
|
|
271
|
+
sys.exit(0)
|
|
272
|
+
|
|
273
|
+
console = Console()
|
|
274
|
+
print('Executing queue create...')
|
|
275
|
+
|
|
276
|
+
try:
|
|
277
|
+
queue_id = j_queue.create_job_queue(
|
|
278
|
+
label=label,
|
|
279
|
+
description=description,
|
|
280
|
+
preset_name=preset,
|
|
281
|
+
executor=executor,
|
|
282
|
+
is_default=set_default,
|
|
283
|
+
)
|
|
284
|
+
console.print(f'\t[green]Queue "{label}" created successfully.[/green]')
|
|
285
|
+
print(f'\tQueue ID : {queue_id}')
|
|
286
|
+
print(f'\tView at : {cloudos_url}/app/job-queues/{queue_id}')
|
|
287
|
+
except Exception as e:
|
|
288
|
+
console.print(f'\t[red]Error creating queue:[/red] {str(e)}')
|
|
289
|
+
sys.exit(1)
|
|
290
|
+
|