cloudos-cli 2.53.0__tar.gz → 2.57.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 (44) hide show
  1. cloudos_cli-2.57.0/PKG-INFO +1658 -0
  2. cloudos_cli-2.57.0/README.md +1623 -0
  3. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/__main__.py +186 -25
  4. cloudos_cli-2.57.0/cloudos_cli/_version.py +1 -0
  5. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/clos.py +120 -1
  6. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/jobs/job.py +45 -9
  7. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/errors.py +18 -0
  8. cloudos_cli-2.57.0/cloudos_cli.egg-info/PKG-INFO +1658 -0
  9. cloudos_cli-2.53.0/PKG-INFO +0 -1718
  10. cloudos_cli-2.53.0/README.md +0 -1683
  11. cloudos_cli-2.53.0/cloudos_cli/_version.py +0 -1
  12. cloudos_cli-2.53.0/cloudos_cli.egg-info/PKG-INFO +0 -1718
  13. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/LICENSE +0 -0
  14. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/__init__.py +0 -0
  15. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/configure/__init__.py +0 -0
  16. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/configure/configure.py +0 -0
  17. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/datasets/__init__.py +0 -0
  18. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/datasets/datasets.py +0 -0
  19. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/import_wf/__init__.py +0 -0
  20. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/import_wf/import_wf.py +0 -0
  21. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/jobs/__init__.py +0 -0
  22. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/link/__init__.py +0 -0
  23. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/link/link.py +0 -0
  24. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/procurement/__init__.py +0 -0
  25. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/procurement/images.py +0 -0
  26. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/queue/__init__.py +0 -0
  27. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/queue/queue.py +0 -0
  28. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/__init__.py +0 -0
  29. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/array_job.py +0 -0
  30. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/cloud.py +0 -0
  31. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/details.py +0 -0
  32. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/last_wf.py +0 -0
  33. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/requests.py +0 -0
  34. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli/utils/resources.py +0 -0
  35. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli.egg-info/SOURCES.txt +0 -0
  36. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli.egg-info/dependency_links.txt +0 -0
  37. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli.egg-info/entry_points.txt +0 -0
  38. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli.egg-info/requires.txt +0 -0
  39. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/cloudos_cli.egg-info/top_level.txt +0 -0
  40. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/setup.cfg +0 -0
  41. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/setup.py +0 -0
  42. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/tests/__init__.py +0 -0
  43. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/tests/functions_for_pytest.py +0 -0
  44. {cloudos_cli-2.53.0 → cloudos_cli-2.57.0}/tests/test_cli_project_create.py +0 -0
@@ -0,0 +1,1658 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloudos_cli
3
+ Version: 2.57.0
4
+ Summary: Python package for interacting with CloudOS
5
+ Home-page: https://github.com/lifebit-ai/cloudos-cli
6
+ Author: David Piñeyro
7
+ Author-email: david.pineyro@lifebit.ai
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: click>=8.0.1
15
+ Requires-Dist: rich-click>=1.8.2
16
+ Requires-Dist: pandas>=1.3.4
17
+ Requires-Dist: numpy>=1.26.4
18
+ Requires-Dist: requests>=2.26.0
19
+ Provides-Extra: test
20
+ Requires-Dist: pytest; extra == "test"
21
+ Requires-Dist: mock; extra == "test"
22
+ Requires-Dist: responses; extra == "test"
23
+ Requires-Dist: requests_mock; extra == "test"
24
+ Dynamic: author
25
+ Dynamic: author-email
26
+ Dynamic: classifier
27
+ Dynamic: description
28
+ Dynamic: description-content-type
29
+ Dynamic: home-page
30
+ Dynamic: license-file
31
+ Dynamic: provides-extra
32
+ Dynamic: requires-dist
33
+ Dynamic: requires-python
34
+ Dynamic: summary
35
+
36
+ # cloudos-cli
37
+
38
+ [![CI_tests](https://github.com/lifebit-ai/cloudos-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/lifebit-ai/cloudos-cli/actions/workflows/ci.yml)
39
+
40
+ Python package for interacting with CloudOS
41
+
42
+ ---
43
+
44
+ ## Table of Contents
45
+
46
+ - [Requirements](#requirements)
47
+ - [Installation](#installation)
48
+ - [From PyPI](#from-pypi)
49
+ - [Docker Image](#docker-image)
50
+ - [From Github](#from-github)
51
+ - [Usage](#usage)
52
+ - [Configuration](#configuration)
53
+ - [Configure Default Profile](#configure-default-profile)
54
+ - [Configure Named Profile](#configure-named-profile)
55
+ - [Change the Default Profile](#change-the-default-profile)
56
+ - [List Profiles](#list-profiles)
57
+ - [Remove Profile](#remove-profile)
58
+ - [Commands](#commands)
59
+ - [Configure](#configure)
60
+ - [Project](#project)
61
+ - [List Projects](#list-projects)
62
+ - [Create Projects](#create-projects)
63
+ - [Queue](#queue)
64
+ - [List Queues](#list-queues)
65
+ - [Workflow](#workflow)
66
+ - [List All Available Workflows](#list-all-available-workflows)
67
+ - [Import a Nextflow Workflow](#import-a-nextflow-workflow)
68
+ - [Nextflow Jobs](#nextflow-jobs)
69
+ - [Submit a Job](#submit-a-job)
70
+ - [Get Job Logs](#get-job-logs)
71
+ - [Get Job Results](#get-job-results)
72
+ - [Clone or Resume Job](#clone-or-resume-job)
73
+ - [Abort Jobs](#abort-jobs)
74
+ - [Check Job Status](#check-job-status)
75
+ - [Get Job Details](#get-job-details)
76
+ - [Get Job Workdir](#get-job-workdir)
77
+ - [List Jobs](#list-jobs)
78
+ - [Bash Jobs](#bash-jobs)
79
+ - [Send Array Job](#send-array-job)
80
+ - [Submit a Bash Array Job](#submit-a-bash-array-job)
81
+ - [Use multiple projects for files in --parameter option](#use-multiple-projects-for-files-in---parameter-option)
82
+ - [Datasets](#datasets)
83
+ - [List Files](#list-files)
84
+ - [Move Files](#move-files)
85
+ - [Rename Files](#rename-files)
86
+ - [Copy Files](#copy-files)
87
+ - [Link S3 Folders to Interactive Analysis](#link-s3-folders-to-interactive-analysis)
88
+ - [Create Folder](#create-folder)
89
+ - [Remove Files or Folders](#remove-files-or-folders)
90
+ - [Procurement](#procurement)
91
+ - [List Procurement Images](#list-procurement-images)
92
+ - [Set Procurement Organization Image](#set-procurement-organization-image)
93
+ - [Reset Procurement Organization Image](#reset-procurement-organization-image)
94
+ - [Cromwell and WDL Pipeline Support](#cromwell-and-wdl-pipeline-support)
95
+ - [Manage Cromwell Server](#manage-cromwell-server)
96
+ - [Run WDL Workflows](#run-wdl-workflows)
97
+ - [Python API Usage](#python-api-usage)
98
+ - [Running WDL pipelines using your own scripts](#running-wdl-pipelines-using-your-own-scripts)
99
+ - [Unit Testing](#unit-testing)
100
+
101
+ ---
102
+
103
+ ## Requirements
104
+
105
+ CloudOS CLI requires Python 3.9 or higher and several key dependencies for API communication, data processing, and user interface functionality.
106
+
107
+ ```
108
+ click>=8.0.1
109
+ pandas>=1.3.4
110
+ numpy>=1.26.4
111
+ requests>=2.26.0
112
+ rich_click>=1.8.2
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Installation
118
+
119
+ CloudOS CLI can be installed in multiple ways depending on your needs and environment. Choose the method that best fits your workflow.
120
+
121
+ ### From PyPI
122
+
123
+ The repository is also available from [PyPI](https://pypi.org/project/cloudos-cli/):
124
+
125
+ ```bash
126
+ pip install cloudos-cli
127
+ ```
128
+
129
+ To update CloudOS CLI to the latest version using pip, you can run:
130
+
131
+ ```bash
132
+ pip install --upgrade cloudos-cli
133
+ ```
134
+
135
+ To check your current version:
136
+
137
+ ```bash
138
+ cloudos --version
139
+ ```
140
+
141
+ ### Docker Image
142
+
143
+ It is recommended to install it as a docker image using the `Dockerfile` and the `environment.yml` files provided.
144
+
145
+ To run the existing docker image at `quay.io`:
146
+
147
+ ```bash
148
+ docker run --rm -it quay.io/lifebitaiorg/cloudos-cli:latest
149
+ ```
150
+
151
+
152
+ ### From Github
153
+
154
+ You will need Python >= 3.9 and pip installed.
155
+
156
+ Clone the repo and install it using pip:
157
+
158
+ ```bash
159
+ git clone https://github.com/lifebit-ai/cloudos-cli
160
+ cd cloudos-cli
161
+ pip install -r requirements.txt
162
+ pip install .
163
+ ```
164
+
165
+ > NOTE: To be able to call the `cloudos` executable, ensure that the local clone of the `cloudos-cli` folder is included in the `PATH` variable, using for example the command `export PATH="/absolute/path/to/cloudos-cli:$PATH"`.
166
+
167
+ ---
168
+
169
+ ## Usage
170
+
171
+ CloudOS CLI can be used both as a command-line interface tool for interactive work and as a Python package for scripting and automation.
172
+
173
+ To get general information about the tool:
174
+
175
+ ```bash
176
+ cloudos --help
177
+ ```
178
+ ```console
179
+
180
+ Usage: cloudos [OPTIONS] COMMAND [ARGS]...
181
+
182
+ CloudOS python package: a package for interacting with CloudOS.
183
+
184
+ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
185
+ │ --debug Show detailed error information and tracebacks │
186
+ │ --version Show the version and exit. │
187
+ │ --help Show this message and exit. │
188
+ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
189
+ ╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
190
+ │ bash CloudOS bash functionality. │
191
+ │ configure CloudOS configuration. │
192
+ │ cromwell Cromwell server functionality: check status, start and stop. │
193
+ │ datasets CloudOS datasets functionality. │
194
+ │ job CloudOS job functionality: run, check and abort jobs in CloudOS. │
195
+ │ procurement CloudOS procurement functionality. │
196
+ │ project CloudOS project functionality: list and create projects in CloudOS. │
197
+ │ queue CloudOS job queue functionality. │
198
+ │ workflow CloudOS workflow functionality: list and import workflows. │
199
+ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
200
+ ```
201
+
202
+ This will tell you the implemented commands. Each implemented command has its own subcommands with its own `--help`:
203
+
204
+ ```bash
205
+ cloudos job list --help
206
+ ```
207
+ ```console
208
+ CloudOS python package: a package for interacting with CloudOS.
209
+
210
+ Version: 2.55.0
211
+
212
+ CloudOS job functionality: run, check and abort jobs in CloudOS.
213
+
214
+
215
+ Usage: cloudos job list [OPTIONS]
216
+
217
+ Collect workspace jobs from a CloudOS workspace in CSV or JSON format.
218
+
219
+ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────╮
220
+ │ * --apikey -k TEXT Your CloudOS API key [required] │
221
+ │ * --cloudos-url -c TEXT The CloudOS url you are trying to access to. │
222
+ │ Default=https://cloudos.lifebit.ai. │
223
+ │ [required] │
224
+ │ * --workspace-id TEXT The specific CloudOS workspace id. [required] │
225
+ │ --output-basename TEXT Output file base name to save jobs list. Default=joblist │
226
+ │ --output-format [csv|json] The desired file format (file extension) for the output. │
227
+ │ For json option --all-fields will be automatically set to │
228
+ │ True. Default=csv. │
229
+ │ --all-fields Whether to collect all available fields from jobs or just │
230
+ │ the preconfigured selected fields. Only applicable when │
231
+ │ --output-format=csv. Automatically enabled for json │
232
+ │ output. │
233
+ │ --last-n-jobs TEXT The number of last workspace jobs to retrieve. You can │
234
+ │ use 'all' to retrieve all workspace jobs. Default=30. │
235
+ │ --page INTEGER Response page to retrieve. If --last-n-jobs is set, then │
236
+ │ --page value corresponds to the first page to retrieve. │
237
+ │ Default=1. │
238
+ │ --archived When this flag is used, only archived jobs list is │
239
+ │ collected. │
240
+ │ --filter-status TEXT Filter jobs by status (e.g., completed, running, failed, │
241
+ │ aborted). │
242
+ │ --filter-job-name TEXT Filter jobs by job name ( case insensitive ). │
243
+ │ --filter-project TEXT Filter jobs by project name. │
244
+ │ --filter-workflow TEXT Filter jobs by workflow/pipeline name. │
245
+ │ --last When workflows are duplicated, use the latest imported │
246
+ │ workflow (by date). │
247
+ │ --filter-job-id TEXT Filter jobs by specific job ID. │
248
+ │ --filter-only-mine Filter to show only jobs belonging to the current user. │
249
+ │ --filter-queue TEXT Filter jobs by queue name. Only applies to jobs running │
250
+ │ in batch environment. Non-batch jobs are preserved in │
251
+ │ results. │
252
+ │ --verbose Whether to print information messages or not. │
253
+ │ --disable-ssl-verification Disable SSL certificate verification. Please, remember │
254
+ │ that this option is not generally recommended for │
255
+ │ security reasons. │
256
+ │ --ssl-cert TEXT Path to your SSL certificate file. │
257
+ │ --profile TEXT Profile to use from the config file │
258
+ │ --help Show this message and exit. │
259
+ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
260
+ ```
261
+
262
+ ---
263
+
264
+ ## Configuration
265
+
266
+ CloudOS CLI uses a profile-based configuration system to store your credentials and settings securely. This eliminates the need to provide authentication details with every command and allows you to work with multiple CloudOS environments.
267
+
268
+ Configuration will be saved in the $HOME path folder regardless of operating system. Here, a new folder named `.cloudos` will be created, with files `credentials` and `config` also being created. The structure will look like:
269
+
270
+ ```console
271
+ $HOME
272
+ └── .cloudos/
273
+ ├── credentials # Stores API keys
274
+ └── config # Stores all other parameters
275
+ ```
276
+
277
+ ### Configure Default Profile
278
+
279
+ To facilitate the reuse of required parameters, you can create profiles.
280
+
281
+ To generate a profile called `default`, use the following command:
282
+
283
+ ```bash
284
+ cloudos configure
285
+ ```
286
+
287
+ This will prompt you for API key, platform URL, project name, platform executor, repository provider, workflow name (if any), and session ID for interactive analysis. This becomes the default profile if no other profile is explicitly set. The default profile allows running all subcommands without adding the `--profile` option.
288
+
289
+ ### Configure Named Profile
290
+
291
+ To generate a named profile, use the following command:
292
+
293
+ ```bash
294
+ cloudos configure --profile {profile-name}
295
+ ```
296
+
297
+ The same prompts will appear. If a profile with the same name already exists, the current parameters will appear in square brackets and can be overwritten or left unchanged by pressing Enter/Return.
298
+
299
+ > [!NOTE]
300
+ > When there is already at least 1 previous profile defined, a new question will appear asking to make the current profile as default
301
+
302
+ ### Change the Default Profile
303
+
304
+ Change the default profile with:
305
+
306
+ ```bash
307
+ cloudos configure --profile {other-profile} --make-default
308
+ ```
309
+
310
+ ### List Profiles
311
+
312
+ View all configured profiles and identify the default:
313
+
314
+ ```bash
315
+ cloudos configure list-profiles
316
+ ```
317
+
318
+ The response will look like:
319
+
320
+ ```console
321
+ Available profiles:
322
+ - default (default)
323
+ - second-profile
324
+ - third-profile
325
+ ```
326
+
327
+ ### Remove Profile
328
+
329
+ Remove any profile with:
330
+
331
+ ```bash
332
+ cloudos configure remove-profile --profile second-profile
333
+ ```
334
+
335
+ ---
336
+
337
+ ## Commands
338
+
339
+ ### Configure
340
+
341
+ See [Configuration](#configuration) section above for detailed information on setting up profiles and managing your CloudOS CLI configuration.
342
+
343
+
344
+
345
+ ### Project
346
+
347
+ Projects in CloudOS provide logical separation of datasets, workflows, and results, making it easier to manage complex research initiatives. You can list all available projects or create new ones using the CLI.
348
+
349
+ #### List Projects
350
+
351
+ You can get a summary of all available workspace projects in two different formats:
352
+ - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
353
+ - **JSON**: All available information from projects in JSON format
354
+
355
+ To get a CSV table with all available projects for a given workspace:
356
+
357
+ ```bash
358
+ cloudos project list --profile my_profile --output-format csv --all-fields
359
+ ```
360
+
361
+ The expected output is something similar to:
362
+
363
+ ```console
364
+ Executing list...
365
+ Project list collected with a total of 320 projects.
366
+ Project list saved to project_list.csv
367
+ ```
368
+
369
+ To get the same information in JSON format:
370
+
371
+ ```bash
372
+ cloudos project list --profile my_profile --output-format json
373
+ ```
374
+
375
+ #### Create Projects
376
+
377
+ You can create a new project in your CloudOS workspace using the `project create` command. This command requires the name of the new project and will return the project ID upon successful creation.
378
+
379
+ ```bash
380
+ cloudos project create --profile my_profile --new-project "My New Project"
381
+ ```
382
+
383
+ The expected output is something similar to:
384
+
385
+ ```console
386
+ Project "My New Project" created successfully with ID: 64f1a23b8e4c9d001234abcd
387
+ ```
388
+
389
+
390
+ ### Queue
391
+
392
+ 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:
393
+ - **CSV**: A table with a selection of the available job queue information. You can get all information using the `--all-fields` flag
394
+ - **JSON**: All available information from job queues in JSON format
395
+
396
+ #### List Queues
397
+
398
+ This command allows you to view available computational queues and their configurations. Example command for getting all available job queues in JSON format:
399
+
400
+ ```bash
401
+ cloudos queue list --profile my_profile --output-format json --output-basename "available_queues"
402
+ ```
403
+
404
+ ```console
405
+ Executing list...
406
+ Job queue list collected with a total of 5 queues.
407
+ Job queue list saved to available_queues.json
408
+ ```
409
+
410
+ 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.
411
+
412
+ > 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.
413
+
414
+ **Job queues for platform workflows**
415
+
416
+ 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.
417
+
418
+
419
+ ### Workflow
420
+
421
+ #### List All Available Workflows
422
+
423
+ You can get a summary of all available workspace workflows in two different formats:
424
+ - **CSV**: A table with a minimum predefined set of columns by default, or all available columns using the `--all-fields` parameter
425
+ - **JSON**: All available information from workflows in JSON format
426
+
427
+ To get a CSV table with all available workflows for a given workspace:
428
+
429
+ ```bash
430
+ cloudos workflow list --profile my_profile --output-format csv --all-fields
431
+ ```
432
+
433
+ The expected output is something similar to:
434
+
435
+ ```console
436
+ Executing list...
437
+ Workflow list collected with a total of 609 workflows.
438
+ Workflow list saved to workflow_list.csv
439
+ ```
440
+
441
+ To get the same information in JSON format:
442
+
443
+ ```bash
444
+ cloudos workflow list --profile my_profile --output-format json
445
+ ```
446
+
447
+ ```console
448
+ Executing list...
449
+ Workflow list collected with a total of 609 workflows.
450
+ Workflow list saved to workflow_list.json
451
+ ```
452
+
453
+ The collected workflows are those that can be found in the "WORKSPACE TOOLS" section in CloudOS.
454
+
455
+ #### Import a Nextflow Workflow
456
+
457
+ You can import new workflows to your CloudOS workspaces. The requirements are:
458
+
459
+ - The workflow must be a Nextflow pipeline
460
+ - The workflow repository must be located at GitHub, GitLab or BitBucket Server (specified by the `--repository-platform` option. Available options: `github`, `gitlab` and `bitbucketServer`)
461
+ - If your repository is private, you must have access to the repository and have linked your GitHub, Gitlab or Bitbucket server accounts to CloudOS
462
+
463
+ **Usage of the workflow import command**
464
+
465
+ To import GitHub workflows to CloudOS:
466
+
467
+ ```bash
468
+ # Example workflow to import: https://github.com/lifebit-ai/DeepVariant
469
+ cloudos workflow import --profile my_profile --workflow-url "https://github.com/lifebit-ai/DeepVariant" --workflow-name "new_name_for_the_github_workflow" --repository-platform github
470
+ ```
471
+
472
+ The expected output will be:
473
+
474
+ ```console
475
+ CloudOS workflow functionality: list and import workflows.
476
+
477
+ Executing workflow import...
478
+
479
+ [Message] Only Nextflow workflows are currently supported.
480
+
481
+ Workflow test_import_github_3 was imported successfully with the following ID: 6616a8cb454b09bbb3d9dc20
482
+ ```
483
+
484
+ Optionally, you can add a link to your workflow documentation by providing the URL using the `--workflow-docs-link` parameter:
485
+
486
+ ```bash
487
+ cloudos workflow import --profile my_profile --workflow-url "https://github.com/lifebit-ai/DeepVariant" --workflow-name "new_name_for_the_github_workflow" --workflow-docs-link "https://github.com/lifebit-ai/DeepVariant/blob/master/README.md" --repository-platform github
488
+ ```
489
+
490
+ > NOTE: Importing workflows using cloudos-cli is not yet available in all CloudOS workspaces. If you try to use this feature in a non-prepared workspace you will get the following error message: `It seems your API key is not authorised. Please check if your workspace has support for importing workflows using cloudos-cli`.
491
+
492
+
493
+ ### Nextflow Jobs
494
+
495
+ The job commands allow you to submit, monitor, and manage computational workflows on CloudOS. This includes both Nextflow pipelines and bash scripts, with support for various execution platforms.
496
+
497
+ #### Submit a Job
498
+
499
+ You can submit Nextflow workflows to CloudOS using either configuration files or command-line parameters. Jobs can be configured with specific compute resources, execution platforms, parameters, etc.
500
+
501
+ First, configure your local environment to ease parameter input. We will try to submit a small toy example already available:
502
+
503
+ ```bash
504
+ cloudos job run --profile my_profile --workflow-name rnatoy --job-config cloudos_cli/examples/rnatoy.config --resumable
505
+ ```
506
+
507
+ As you can see, a file with the job parameters is used to configure the job. This file could be a regular `nextflow.config` file or any file with the following structure:
508
+
509
+ ```
510
+ params {
511
+ reads = s3://lifebit-featured-datasets/pipelines/rnatoy-data
512
+ annot = s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.bed.gff
513
+ }
514
+ ```
515
+
516
+ In addition, parameters can also be specified using the command-line `-p` or `--parameter`. For instance:
517
+
518
+ ```bash
519
+ cloudos job run \
520
+ --profile my_profile \
521
+ --workflow-name rnatoy \
522
+ --parameter reads=s3://lifebit-featured-datasets/pipelines/rnatoy-data \
523
+ --parameter genome=s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.Ggal71.500bpflank.fa \
524
+ --parameter annot=s3://lifebit-featured-datasets/pipelines/rnatoy-data/ggal_1_48850000_49020000.bed.gff \
525
+ --resumable
526
+ ```
527
+
528
+ > NOTE: options `--job-config` and `--parameter` are completely compatible and complementary, so you can use a `--job-config` and add additional parameters using `--parameter` in the same call.
529
+
530
+ If everything went well, you should see something like:
531
+
532
+ ```console
533
+ Executing run...
534
+ Job successfully launched to CloudOS, please check the following link: https://cloudos.lifebit.ai/app/advanced-analytics/analyses/62c83a1191fe06013b7ef355
535
+ Your assigned job id is: 62c83a1191fe06013b7ef355
536
+ Your current job status is: initializing
537
+ To further check your job status you can either go to https://cloudos.lifebit.ai/app/advanced-analytics/analyses/62c83a1191fe06013b7ef355 or use the following command:
538
+ cloudos job status \
539
+ --apikey $MY_API_KEY \
540
+ --cloudos-url https://cloudos.lifebit.ai \
541
+ --job-id 62c83a1191fe06013b7ef355
542
+ ```
543
+
544
+ As you can see, the current status is `initializing`. This will change while the job progresses. To check the status, just apply the suggested command.
545
+
546
+ Another option is to set the `--wait-completion` parameter, which runs the same job run command but waits for its completion:
547
+
548
+ ```bash
549
+ cloudos job run --profile my_profile --workflow-name rnatoy --job-config cloudos_cli/examples/rnatoy.config --resumable --wait-completion
550
+ ```
551
+
552
+ When setting this parameter, you can also set `--request-interval` to a bigger number (default is 30s) if the job is quite large. This will ensure that the status requests are not sent too close from each other and recognized as spam by the API.
553
+
554
+ If the job takes less than `--wait-time` (3600 seconds by default), the previous command should have an output similar to:
555
+
556
+ ```console
557
+ Executing run...
558
+ Job successfully launched to CloudOS, please check the following link: https://cloudos.lifebit.ai/app/advanced-analytics/analyses/62c83a6191fe06013b7ef363
559
+ Your assigned job id is: 62c83a6191fe06013b7ef363
560
+ Please, wait until job completion or max wait time of 3600 seconds is reached.
561
+ Your current job status is: initializing.
562
+ Your current job status is: running.
563
+ Your job took 420 seconds to complete successfully.
564
+ ```
565
+
566
+ When there are duplicate `--workflow-name` in the platform, you can add the `--last` flag to use the latest import of that pipeline in the workspace, based on the date.
567
+
568
+ _For example, the pipeline `lifebit-process` was imported on May 23 2025 and again on May 30 2025; with the `--last` flag, it will use the import of May 30, 2025._
569
+
570
+ **AWS Executor Support**
571
+
572
+ CloudOS supports [AWS batch](https://www.nextflow.io/docs/latest/executor.html?highlight=executors#aws-batch) executor by default.
573
+ You can specify the AWS batch queue to use from the ones available in your workspace (see [here](#list-job-queues)) by specifying its name with the `--job-queue` parameter. If none is specified, the most recent suitable queue in your workspace will be selected by default.
574
+
575
+ Example command:
576
+
577
+ ```bash
578
+ cloudos job run --profile my_profile --workflow-name rnatoy --job-config cloudos_cli/examples/rnatoy.config --resumable
579
+ ```
580
+
581
+ > Note: From cloudos-cli 2.7.0, the default executor is AWS batch. The previous Apache [ignite](https://www.nextflow.io/docs/latest/ignite.html#apache-ignite) executor is being removed progressively from CloudOS, so most likely will not be available in your CloudOS. Cloudos-cli still supports ignite during this period by adding the `--ignite` flag to the `cloudos job run` command. Please note that if you use the `--ignite` flag in a CloudOS without ignite support, the command will fail.
582
+
583
+ **Azure Execution Platform Support**
584
+
585
+ CloudOS can also be configured to use Microsoft Azure compute platforms. If your CloudOS is configured to use Azure, you will need to take into consideration the following:
586
+
587
+ - When sending jobs to CloudOS using `cloudos job run` command, please use the option `--execution-platform azure`
588
+ - Due to the lack of AWS batch queues in Azure, `cloudos queue list` command is not working
589
+
590
+ Other than that, `cloudos-cli` will work very similarly. For instance, this is a typical send job command:
591
+
592
+ ```bash
593
+ cloudos job run --profile my_profile --workflow-name rnatoy --job-config cloudos_cli/examples/rnatoy.config --resumable --execution-platform azure
594
+ ```
595
+
596
+ **HPC Execution Support**
597
+
598
+ CloudOS is also prepared to use an HPC compute infrastructure. For such cases, you will need to take into account the following for your job submissions using `cloudos job run` command:
599
+
600
+ - Use the following parameter: `--execution-platform hpc`
601
+ - Indicate the HPC ID using: `--hpc-id XXXX`
602
+
603
+ Example command:
604
+
605
+ ```bash
606
+ cloudos job run --profile my_profile --workflow-name rnatoy --job-config cloudos_cli/examples/rnatoy.config --execution-platform hpc --hpc-id $YOUR_HPC_ID
607
+ ```
608
+
609
+ Please note that HPC execution does not support the following parameters and all of them will be ignored:
610
+
611
+ - `--job-queue`
612
+ - `--resumable | --do-not-save-logs`
613
+ - `--instance-type` | `--instance-disk` | `--cost-limit`
614
+ - `--storage-mode` | `--lustre-size`
615
+ - `--wdl-mainfile` | `--wdl-importsfile` | `--cromwell-token`
616
+
617
+ #### Get Job Logs
618
+
619
+ The following command allows you to get the path to "Nextflow logs", "Nextflow standard output", and "trace" files. It can be used only on your user's jobs, with any status.
620
+
621
+ Example:
622
+ ```bash
623
+ cloudos job logs --profile my_profile --job-id "12345678910"
624
+ ```
625
+ ```console
626
+ Executing logs...
627
+ Logs URI: s3://path/to/location/of/logs
628
+
629
+ Nextflow log: s3://path/to/location/of/logs/.nextflow.log
630
+
631
+ Nextflow standard output: s3://path/to/location/of/logs/stdout.txt
632
+
633
+ Trace file: s3://path/to/location/of/logs/trace.txt
634
+ ```
635
+
636
+ #### Get Job Results
637
+
638
+ The following command allows you to get the path where CloudOS stores the output files for a job. This can be used only on your user's jobs and for jobs with "completed" status.
639
+
640
+ Example:
641
+ ```bash
642
+ cloudos job results --profile my_profile --job-id "12345678910"
643
+ ```
644
+ ```console
645
+ Executing results...
646
+ results: s3://path/to/location/of/results/results/
647
+ ```
648
+
649
+
650
+ #### Clone or Resume job
651
+
652
+ #### Query working directory of job
653
+
654
+ To get the working directory of a job submitted to CloudOS:
655
+
656
+ ```shell
657
+ cloudos job workdir \
658
+ --apikey $MY_API_KEY \
659
+ --cloudos-url $CLOUDOS \
660
+ --job-id 62c83a1191fe06013b7ef355
661
+ ```
662
+
663
+ Or with a defined profile:
664
+
665
+ ```shell
666
+ cloudos job workdir \
667
+ --profile profile-name \
668
+ --job-id 62c83a1191fe06013b7ef355
669
+ ```
670
+
671
+ The output should be something similar to:
672
+
673
+ ```console
674
+ CloudOS job functionality: run, check and abort jobs in CloudOS.
675
+
676
+ Finding working directory path...
677
+ Working directory for job 68747bac9e7fe38ec6e022ad: az://123456789000.blob.core.windows.net/cloudos-987652349087/projects/455654676/jobs/54678856765/work
678
+ ```
679
+
680
+ #### Abort single or multiple jobs from CloudOS
681
+
682
+ The `clone` command allows you to create a new job based on an existing job's configuration, with the ability to override specific parameters.
683
+ The `resume` command allow you to create a new job (with the ability to override specific parameters) withour re-running every step but only the ones failed/where changes are applied.
684
+ These commands are particularly useful for re-running jobs with slight modifications without having to specify all parameters or starting again from scratch.
685
+
686
+ > [!NOTE]
687
+ > Only job initially run with `--resumable` can be resumed.
688
+
689
+
690
+
691
+ Cloning basic usage:
692
+
693
+ Aborting jobs...
694
+ Job 680a3cf80e56949775c02f16 aborted successfully.
695
+ ```
696
+
697
+
698
+ #### Clone/resume a job with optional parameter overrides
699
+
700
+ The `clone` and `resume` commands allows you to create a new job based on an existing job's configuration, with the ability to override specific parameters. This is useful for re-running jobs with slight modifications without having to specify all parameters from scratch.
701
+
702
+ Basic usage:
703
+ ```console
704
+ cloudos job clone/resume \
705
+ --profile MY_PROFILE
706
+ --job-id "60a7b8c9d0e1f2g3h4i5j6k7"
707
+ ```
708
+
709
+
710
+ Cloning with parameter overrides:
711
+
712
+ Clone/resume with parameter overrides:
713
+ ```console
714
+ cloudos job clone/resume \
715
+ --profile MY_PROFILE
716
+ --job-id "60a7b8c9d0e1f2g3h4i5j6k7" \
717
+ --job-queue "high-priority-queue" \
718
+ --cost-limit 50.0 \
719
+ --instance-type "c5.2xlarge" \
720
+ --job-name "cloned_analysis_v2" \
721
+ --nextflow-version "24.04.4" \
722
+ --git-branch "dev" \
723
+ --nextflow-profile "production" \
724
+ --do-not-save-logs true \
725
+ --accelerate-file-staging true \
726
+ --workflow-name "updated-workflow" \
727
+ -p "input=s3://new-bucket/input.csv" \
728
+ -p "output_dir=s3://new-bucket/results"
729
+ ```
730
+
731
+ Resuming a job without parameter overrides
732
+ ```console
733
+ cloudos job resume \
734
+ --profile MY_PROFILE
735
+ --job-id JOB_ID
736
+ ```
737
+
738
+ Resuming with parameter overrides:
739
+ ```console
740
+ cloudos job resume \
741
+ --profile MY_PROFILE
742
+ --job-id "60a7b8c9d0e1f2g3h4i5j6k7" \
743
+ --job-queue "high-priority-queue" \
744
+ --cost-limit 50.0 \
745
+ --instance-type "c5.2xlarge" \
746
+ --job-name "cloned_analysis_v2" \
747
+ --nextflow-version "24.04.4" \
748
+ --git-branch "dev" \
749
+ --nextflow-profile "production" \
750
+ --do-not-save-logs true \
751
+ --accelerate-file-staging true \
752
+ --workflow-name "updated-workflow" \
753
+ -p "input=s3://new-bucket/input.csv" \
754
+ -p "output_dir=s3://new-bucket/results"
755
+ ```
756
+
757
+ Available override options:
758
+ - `--job-queue`: Specify a different job queue
759
+ - `--cost-limit`: Set a new cost limit (use -1 for no limit)
760
+ - `--instance-type`: Change the master instance type
761
+ - `--job-name`: Assign a custom name to the cloned/resumed job
762
+ - `--nextflow-version`: Use a different Nextflow version
763
+ - `--git-branch`: Switch to a different git branch
764
+ - `--nextflow-profile`: Change the Nextflow profile
765
+ - `--do-not-save-logs`: Enable/disable log saving
766
+ - `--accelerate-file-staging`: Enable/disable fusion filesystem
767
+ - `--workflow-name`: Use a different workflow
768
+ - `-p, --parameter`: Override or add parameters (can be used multiple times)
769
+
770
+ > [!NOTE]
771
+ > Parameters can be overridden or new ones can be added using `-p` option
772
+
773
+
774
+ #### Abort Jobs
775
+
776
+ Aborts jobs in the CloudOS workspace that are either running or initializing. It can be used with one or more job IDs provided as a comma-separated string using the `--job-ids` parameter.
777
+
778
+ Example:
779
+ ```bash
780
+ cloudos job abort --profile my_profile --job-ids "680a3cf80e56949775c02f16"
781
+ ```
782
+
783
+ ```console
784
+ Aborting jobs...
785
+ Job 680a3cf80e56949775c02f16 aborted successfully.
786
+ ```
787
+
788
+ #### Check Job Status
789
+
790
+ To check the status of a submitted job, use the following command:
791
+
792
+ ```bash
793
+ cloudos job status --profile my_profile --job-id 62c83a1191fe06013b7ef355
794
+ ```
795
+
796
+ The expected output should be something similar to:
797
+
798
+ ```console
799
+ Executing status...
800
+ Your current job status is: completed
801
+
802
+ To further check your job status you can either go to https://cloudos.lifebit.ai/app/advanced-analytics/analyses/62c83a1191fe06013b7ef355 or repeat the command you just used.
803
+ ```
804
+
805
+ #### Get Job Details
806
+
807
+ Details of a job, including cost, status, and timestamps, can be retrieved with:
808
+
809
+ ```bash
810
+ cloudos job details --profile my_profile --job-id 62c83a1191fe06013b7ef355
811
+ ```
812
+ ```bash
813
+ cloudos job details \
814
+ --profile job-details \
815
+ --job-id 62c83a1191fe06013b7ef355
816
+ ```
817
+
818
+ The expected output should be something similar to when using the defaults and the details are displayed in the standard output console:
819
+
820
+ ```console
821
+ Executing details...
822
+ Job Details
823
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
824
+ ┃ Field ┃ Value ┃
825
+ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
826
+ │ Parameters │ -test=value │
827
+ │ │ --gaq=test │
828
+ │ │ cryo=yes │
829
+ │ Command │ echo 'test' > new_file.txt │
830
+ │ Revision │ sha256:6015f66923d7afbc53558d7ccffd325d43b4e249f41a6e93eef074c9505d2233 │
831
+ │ Nextflow Version │ None │
832
+ │ Execution Platform │ Batch AWS │
833
+ │ Profile │ None │
834
+ │ Master Instance │ c5.xlarge │
835
+ │ Storage │ 500 │
836
+ │ Job Queue │ nextflow-job-queue-5c6d3e9bd954e800b23f8c62-feee │
837
+ │ Accelerated File Staging │ None │
838
+ │ Task Resources │ 1 CPUs, 4 GB RAM │
839
+ └──────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
840
+ ```
841
+
842
+ To change this behaviour and save the details into a local JSON, the parameter `--output-format` needs to be set as `--output-format=json`.
843
+
844
+ By default, all details are saved in a file with the basename as `job_details`, for example `job_details.json` or `job_details.config.`. This can be changed with the parameter `--output-basename=new_filename`.
845
+
846
+ The `details` subcommand, can also take `--parameters` as an argument flag, which will create a new file `*.config` that holds all parameters as a Nexflow configuration file, example:
847
+
848
+ ```console
849
+ params {
850
+ parameter_one = value_one
851
+ parameter_two = value_two
852
+ parameter_three = value_three
853
+ }
854
+ ```
855
+
856
+ This file can later be used when running a job with `cloudos job run --job-config job_details.config ...`.
857
+
858
+ > [!NOTE]
859
+ > Job details can only be retrieved for a single user, cannot see other user's job details.
860
+
861
+ #### Get Job Workdir
862
+
863
+ To get the working directory of a job submitted to CloudOS:
864
+
865
+ ```shell
866
+ cloudos job workdir \
867
+ --profile profile-name \
868
+ --job-id 62c83a1191fe06013b7ef355
869
+ ```
870
+
871
+ The output should be something similar to:
872
+
873
+ ```console
874
+ CloudOS job functionality: run, check and abort jobs in CloudOS.
875
+
876
+ Finding working directory path...
877
+ Working directory for job 68747bac9e7fe38ec6e022ad: az://123456789000.blob.core.windows.net/cloudos-987652349087/projects/455654676/jobs/54678856765/work
878
+ ```
879
+
880
+ #### List Jobs
881
+
882
+ You can get a summary of the workspace's last 30 submitted jobs (or a selected number of last jobs using `--last-n-jobs n` parameter) in two different formats:
883
+
884
+ - CSV: this is a table with a minimum predefined set of columns by default, or all the available columns using the `--all-fields` argument.
885
+ - JSON: all the available information from the workspace jobs, in JSON format (`--all-fields` is always enabled for this format).
886
+
887
+ To get a list with the workspace's last 30 submitted jobs, in CSV format, use:
888
+
889
+ ```bash
890
+ cloudos job list --profile my_profile--output-format csv --all-fields
891
+ ```
892
+
893
+ The expected output is something similar to:
894
+
895
+ ```console
896
+ Executing list...
897
+ Job list collected with a total of 30 jobs.
898
+ Job list saved to joblist.csv
899
+ ```
900
+
901
+ In addition, a file named `joblist.csv` is created.
902
+
903
+ To get the same information, but for all the workspace's jobs and in JSON format, use the following command:
904
+
905
+ ```bash
906
+ cloudos job list \
907
+ --cloudos-url $CLOUDOS \
908
+ --apikey $MY_API_KEY \
909
+ --workspace-id $WORKSPACE_ID \
910
+ --last-n-jobs all \
911
+ --output-format json
912
+ ```
913
+ ```console
914
+ Executing list...
915
+ Job list collected with a total of 276 jobs.
916
+ Job list saved to joblist.json
917
+ ```
918
+
919
+ You find specific jobs within your workspace using the listing filtering options. Filters can be combined to narrow down results and all filtering is performed after retrieving jobs from the server.
920
+
921
+ **Available filters:**
922
+
923
+ - **`--filter-status`**: Filter jobs by execution status (e.g., completed, running, failed, aborted, queued, pending, initializing)
924
+ - **`--filter-job-name`**: Filter jobs by job name (case insensitive partial matching)
925
+ - **`--filter-project`**: Filter jobs by project name (exact match required)
926
+ - **`--filter-workflow`**: Filter jobs by workflow/pipeline name (exact match required)
927
+ - **`--filter-job-id`**: Filter jobs by specific job ID (exact match required)
928
+ - **`--filter-only-mine`**: Show only jobs belonging to the current user
929
+ - **`--filter-queue`**: Filter jobs by queue name (only applies to batch jobs)
930
+
931
+ Here following are some examples:
932
+
933
+ Get all completed jobs from the last 50 jobs:
934
+ ```bash
935
+ cloudos job list --profile my_profile --last-n-jobs 50 --filter-status completed
936
+ ```
937
+
938
+ Find jobs with "analysis" in the name from a specific project:
939
+ ```bash
940
+ cloudos job list --profile my_profile --filter-job-name analysis --filter-project "My Research Project"
941
+ ```
942
+
943
+ Get all jobs using a specific workflow and queue:
944
+ ```bash
945
+ cloudos job list --profile my_profile --filter-workflow rnatoy --filter-queue high-priority-queue
946
+ ```
947
+
948
+ > [!NOTE]
949
+ > - Project and workflow names must match exactly (case sensitive)
950
+ > - Job name filtering is case insensitive and supports partial matches
951
+ > - The `--last` flag can be used with `--filter-workflow` when multiple workflows have the same name
952
+
953
+
954
+
955
+ ### Bash Jobs
956
+ 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.
957
+
958
+ #### Send Array Job
959
+
960
+
961
+ A bash job can be sent to CloudOS using the command `bash` and the subcommand `job`. In this case, the `--workflow-name` must be a bash job already present in the platform. Bash jobs are identified by bash icon (unlike Nextflow jobs, which are identified with Nextflow icon).
962
+
963
+ ```bash
964
+ cloudos bash job \
965
+ --profile my_profile \
966
+ --workflow-name ubuntu \
967
+ --parameter -test_variable=value \
968
+ --parameter --flag=activate \
969
+ --parameter send="yes" \
970
+ --job-name $JOB_NAME \
971
+ --command "echo 'send' > new_file.txt" \
972
+ --resumable
973
+ ```
974
+
975
+ The `--command` parameter is required and will setup the command for the parameters to run.
976
+
977
+ Each `--parameter` can have a different prefix, either '--', '-', or '', depending on the use case. These can be used as many times as needed.
978
+
979
+ > [!NOTE]
980
+ > At the moment only string values are allowed to the `--parameter` options, adding a filepath at the moment does not upload/download the file. This feature will be available in a future implementation.
981
+
982
+ If everything went well, you should see something like:
983
+
984
+ ```console
985
+ CloudOS bash functionality.
986
+
987
+ Job successfully launched to CloudOS, please check the following link: https://cloudos.lifebit.ai/app/advanced-analytics/analyses/682622d09f305de717327334
988
+ Your assigned job id is: 682622d09f305de717327334
989
+
990
+ Your current job status is: initializing
991
+ To further check your job status you can either go to https://cloudos.lifebit.ai/app/advanced-analytics/analyses/682622d09f305de717327334 or use the following command:
992
+ cloudos job status \
993
+ --apikey $MY_API_KEY \
994
+ --cloudos-url https://cloudos.lifebit.ai \
995
+ --job-id 682622d09f305de717327334
996
+ ```
997
+
998
+ As you can see, the current status is `initializing`. This will change while the job progresses. To check the status, just apply the suggested command.
999
+
1000
+ Other options like `--wait-completion` are also available and work in the same way as for the `cloudos job run` command.
1001
+ Check `cloudos bash job --help` for more details.
1002
+
1003
+ #### Submit a Bash Array Job
1004
+
1005
+ Run parallel bash jobs across multiple samples or datasets using array files. This is particularly useful for processing large datasets where each row represents a separate computational task.
1006
+
1007
+ When running a bash array job, you can specify an array file containing sample information and process each row in parallel. The CLI validates column names and provides flexible parameter mapping.
1008
+
1009
+ ```bash
1010
+ cloudos bash array-job --profile my_profile --command "echo {file}" --array-file my_array.csv --separator ,
1011
+ ```
1012
+
1013
+ ##### Options
1014
+
1015
+ ###### Array File
1016
+ - **`--array-file`**: Specifies the path to a file containing a set of columns useful in running the bash job. This option is **required** when using the command `bash array-job`.
1017
+
1018
+ ###### Separator
1019
+ - **`--separator`**: Defines the separator to use in the array file. Supported separators include:
1020
+ - `,` (comma)
1021
+ - `;` (semicolon)
1022
+ - `tab`
1023
+ - `space`
1024
+ - `|` (pipe)
1025
+ This option is **required** when using the command `bash array-job`.
1026
+
1027
+ ###### List Columns
1028
+ - **`--list-columns`**: Lists the columns available in the array file. This is useful for inspecting the structure of the file. This flag disables sending the job, it just prints the column list, one per line:
1029
+
1030
+ ```console
1031
+ Columns:
1032
+ - column1
1033
+ - column2
1034
+ - column3
1035
+ ```
1036
+
1037
+ ###### Array File Project
1038
+ - **`--array-file-project`**: Specifies the name of the project in which the array file is placed, if it is different from the project specified by `--project-name`.
1039
+
1040
+ ###### Disable Column Check
1041
+ - **`--disable-column-check`**: Disables the validation of columns in the array file. This implies that each `--array-parameter` value is not checked against the header of the `--array-file`. For example, `--array-parameter --bar=foo`, without `--disable-column-check`, expects the array file to have column 'foo' inside the file header. If the column is not present, the CLI will throw an error. When `--disable-column-check` flag is added, the column check is not performed and the bash array job is sent to the platform.
1042
+
1043
+ > [!NOTE]
1044
+ > Adding `--disable-column-check` will make the CLI command run without errors, but the errors might appear when checking the job in the platform, if the columns in the array file do not exists, as depicted with `--array-parameter`.
1045
+
1046
+ ###### Array Parameter
1047
+ - **`-a` / `--array-parameter`**: Allows specifying the column name present in the header of the array file. Each parameter should be in the format `arary_parameter_name=array_file_column`. For example:
1048
+ - `-a --test=value` or
1049
+ - `--array-parameter -test=value`
1050
+ specify a column named 'value' in the array file header. Adding array parameters not present in the header will cause an error. This option can be used multiple times to include as many array parameters as needed. This type of parameter is similar to `-p, --parameter`, both parameters can be interpolated in the bash array job command (either with `--command` or `--custom-script-path`), but this parameter can only be used to name the column present in the header of the array file.
1051
+
1052
+ For example, the array file has the following header:
1053
+
1054
+ ```console
1055
+ id,bgen,csv
1056
+ 1,s3://data/adipose.bgen,s3://data/adipose.csv
1057
+ 2,s3://data/blood.bgen,s3://data/blood.csv
1058
+ 3,s3://data/brain.bgen,s3://data/brain.csv
1059
+ ...
1060
+ ```
1061
+ and in the command there is need to go over the `bgen` column, this can be specified as `--array-parameter file=bgen`, refering to the column in the header.
1062
+
1063
+ ###### Custom Script Path
1064
+ - **`--custom-script-path`**: Specifies the path to a custom script to run in the bash array job instead of a command. When adding this command, parameter `--command` is ignored. To ensure the script runs successfully, you must either:
1065
+
1066
+ 1. Use a Shebang Line at the Top of the Script
1067
+
1068
+ The shebang (#!) tells the system which interpreter to use to run the script. The path should match absolute path to python or other interpreter installed inside the docker container.
1069
+
1070
+ Examples:
1071
+ `#!/usr/bin/python3` –-> for Python scripts
1072
+ `#!/usr/bin/Rscript` –-> for R scripts
1073
+ `#!/bin/bash` –-> for Bash scripts
1074
+
1075
+ Example Python Script:
1076
+
1077
+ ```python
1078
+ #!/usr/bin/python3
1079
+ print("Hello world")
1080
+ ```
1081
+
1082
+ 2. Or use an interpreter command in the executable field
1083
+
1084
+ If your script doesn’t have a shebang line, you can execute it by explicitly specifying the interpreter in the executable command:
1085
+
1086
+ ```console
1087
+ python my_script.py
1088
+ Rscript my_script.R
1089
+ bash my_script.sh
1090
+ ```
1091
+ This assumes the interpreter is available on the container’s $PATH. If not, you can use the full absolute path instead:
1092
+
1093
+ ```console
1094
+ /usr/bin/python3 my_script.py
1095
+ /usr/local/bin/Rscript my_script.R
1096
+ ```
1097
+
1098
+ ###### Custom Script Project
1099
+ - **`--custom-script-project`**: Specifies the name of the project in which the custom script is placed, if it is different from the project specified by `--project-name`.
1100
+
1101
+ These options provide flexibility for configuring and running bash array jobs, allowing to tailor the execution for specific requirements.
1102
+
1103
+ #### Use multiple projects for files in `--parameter` option
1104
+
1105
+ The option `--parameter` could specify a file input located in a different project than option `--project-name`. The files can only be located inside the project's `Data` subfolder, not `Cohorts` or `Analyses Results`. The accepted structures for different parameter projects are:
1106
+ - `-p/--parameter "--file=<project>/Data/file.txt"`
1107
+ - `-p/--parameter "--file=<project>/Data/subfolder/file.txt"`
1108
+ - `-p/--parameter "--file=Data/subfolder/file.txt"` (the same project as `--project-name`)
1109
+ - `-p/--parameter "--file=<project>/Data/subfolder/*.txt"`
1110
+ - `-p/--parameter "--file=<project>/Data/*.txt"`
1111
+ - `-p/--parameter "--file=Data/*.txt"` (the same project as `--project-name`)
1112
+
1113
+ The project should be specified at the beginning of the file path. For example:
1114
+
1115
+ ```bash
1116
+ cloudos bash array-job --profile my_profile -p file=Data/input.csv
1117
+ ```
1118
+ This will point to the global project, specified with `--project-name`. In contrast:
1119
+
1120
+ ```bash
1121
+ cloudos bash array-job \
1122
+ --profile my_profile \
1123
+ -p data=Data/input.csv \
1124
+ -p exp=PROJECT_EXPRESSION/Data/input.csv \
1125
+ --project-name "ADIPOSE"
1126
+ ```
1127
+ for parameter `exp` it will point to a project named `PROJECT_EXPRESSION` in the File Explorer, and `data` parameter will be found in the global project `ADIPOSE`.
1128
+
1129
+ Apart from files, the parameter can also take glob patterns, for example:
1130
+
1131
+ ```bash
1132
+ cloudos bash array-job \
1133
+ --profile my_profile \
1134
+ -p data=Data/input.csv \
1135
+ -p exp="PROJECT_EXPRESSION/Data/*.csv" \
1136
+ --project-name "ADIPOSE"
1137
+ ```
1138
+ will take all `csv` file extensions in the specified folder.
1139
+
1140
+ > [!NOTE]
1141
+ > When specifying glob patterns, depending on the terminal it is best to add it in double quotes to avoid the terminal searching for the glob pattern locally, e.g. `-p exp="PROJECT_EXPRESSION/Data/*.csv"`.
1142
+
1143
+ > [!NOTE]
1144
+ > Project names in the `--parameter` option can start with either forward slash `/` or without. The following are the same: `-p data=/PROJECT1/Data/input.csv` and `-p data=PROJECT1/Data/input.csv`.
1145
+
1146
+ ---
1147
+
1148
+ ### Datasets
1149
+
1150
+ Manage files and folders within your CloudOS File Explorer programmatically. These commands provide comprehensive file management capabilities for organizing research data and results.
1151
+
1152
+ #### List Files
1153
+
1154
+ Browse files and folders within your CloudOS projects. Use the `--details` flag to get comprehensive information about file ownership, sizes, and modification dates.
1155
+
1156
+ ```bash
1157
+ cloudos datasets ls <path> --profile <profile>
1158
+ ```
1159
+ The output of this command is a list of files and folders present in the specified project.
1160
+
1161
+ > [!NOTE]
1162
+ > If the `<path>` is left empty, the command will return the list of folders present in the selected project.
1163
+
1164
+ If you require more information on the files and folder listed, you can use the `--details` flag that will output a table containing the following columns:
1165
+ - Type (folder or file)
1166
+ - Owner
1167
+ - Size (in human readable format)
1168
+ - Last updated
1169
+ - Virtual Name (the file or folder name)
1170
+ - Storage Path
1171
+
1172
+ #### Move Files
1173
+
1174
+ Relocate files and folders within the same project or across different projects. This is useful for reorganizing data and moving results to appropriate locations.
1175
+
1176
+ > [!NOTE]
1177
+ > Files and folders can be moved **from** `Data` or any of its subfolders (i.e `Data`, `Data/folder/file.txt`) **to** `Data` or any of its subfolders programmatically. Furthermore, only virtual folders can be destination folders.
1178
+
1179
+ The move can happen **within the same project**
1180
+
1181
+ ```bash
1182
+ cloudos datasets mv <source_path> <destination_path> --profile <profile>
1183
+ ```
1184
+
1185
+ But it can also happen **across different projects** within the same workspace by specifying the destination project name.
1186
+
1187
+ ```bash
1188
+ cloudos datasets mv <source_path> <destination_path> --profile <profile> --destination-project-name <project>
1189
+ ```
1190
+
1191
+ Any of the `source_path` must be a full path, starting from the `Data` datasets and its folder; any `destination_path` must be a path starting with `Data` and finishing with the folder where to move the file/folder.
1192
+
1193
+ An example of such command is:
1194
+
1195
+ ```
1196
+ cloudos datasets mv Data/results/my_plot.png Data/plots
1197
+ ```
1198
+
1199
+ #### Rename Files
1200
+
1201
+ Change file and folder names while keeping them in the same location. This helps maintain organized file structures and clear naming conventions.
1202
+
1203
+ > [!NOTE]
1204
+ > Files and folders within the `Data` dataset can be renamed using the following command
1205
+
1206
+ ```bash
1207
+ cloudos datasets rename <path> <new_name> --profile my_profile
1208
+ ```
1209
+ where `path` is the full path to the file/folder to be renamed and `new_name` is just the name, no path required, as the file will not be moved.
1210
+
1211
+ > [!NOTE]
1212
+ > Renaming can only happen in files and folders that are present in the `Data` datasets and that were created or uploaded by your user.
1213
+
1214
+ #### Copy Files
1215
+
1216
+ Create copies of files and folders for backup purposes or to share data across projects without moving the original files.
1217
+
1218
+ > [!NOTE]
1219
+ > Files and folders can be copied **from** anywhere in the project **to** `Data` or any of its subfolders programmatically (i.e `Data`, `Data/folder/file.txt`). Furthermore, only virtual folders can be destination folders.
1220
+
1221
+
1222
+ The copy can happen **within the same project**
1223
+ ```bash
1224
+ cloudos datasets cp <source_path> <destination_path> --profile <profile>
1225
+ ```
1226
+
1227
+ or it can happen **across different projects** within the same workspace
1228
+
1229
+ ```bash
1230
+ cloudos datasets cp <source_path> <destination_path> --profile <profile> --destination-project-name <project>
1231
+ ```
1232
+
1233
+ Any of the `source_path` must be a full path; any `destination_path` must be a path starting with `Data` and finishing with the folder where to move the file/folder.
1234
+
1235
+ An example of such command is:
1236
+
1237
+ ```
1238
+ cloudos datasets cp AnalysesResults/my_analysis/results/my_plot.png Data/plots
1239
+ ```
1240
+
1241
+
1242
+ #### Link S3 Folders to Interactive Analysis
1243
+
1244
+ Connect external S3 buckets or internal File Explorer folders to your interactive analysis sessions. This provides direct access to data without needing to copy files.
1245
+
1246
+ This subcommand is using the option `--session-id` to access the correct interactive session. This option can be added to the CLI or defined in a profile, for convenience.
1247
+
1248
+ ```bash
1249
+ cloudos datasets link <S3_FOLDER_COMPLETE_PATH_OR_VIRTUAL_FOLDER_PATH> --profile <profile> --session-id <SESSION_ID>
1250
+ ```
1251
+
1252
+ For example, an s3 folder can be linked like follows
1253
+ ```console
1254
+ cloudos datasets link s3://bucket/path/folder --profile test --session-id 1234
1255
+ ```
1256
+
1257
+ A virtual folder can be linked like
1258
+ ``` concole
1259
+ cloudos datasets link "Analyses Results/HLA" --session-id 1234
1260
+ ```
1261
+
1262
+ > [!NOTE]
1263
+ > If running the CLI inside a jupyter session, the pre-configured CLI installation will have the session ID already installed and only the `--apikey` needs to be added.
1264
+
1265
+ > [!NOTE]
1266
+ > Virtual folders in File Explorer, the ones a user has created in File explorer and are not actual storage locations, cannot be linked.
1267
+
1268
+ #### Create Folder
1269
+
1270
+ Create new organizational folders within your projects to maintain structured data hierarchies.
1271
+
1272
+ > [!NOTE]
1273
+ > New folders can be created within the `Data` dataset and its subfolders.
1274
+
1275
+ ```bash
1276
+ cloudos datasets mkdir <new_folder_path> --profile my_profile
1277
+ ```
1278
+
1279
+ #### Remove Files or Folders
1280
+
1281
+ Remove unnecessary files or empty folders from your File Explorer. Note that this removes files from CloudOS but not from underlying cloud storage.
1282
+
1283
+ > [!NOTE]
1284
+ > Files and folders can be removed from file explorer (in the `Data` datasets and its subfolders) and not from the corresponding cloud storage.
1285
+
1286
+ ```bash
1287
+ cloudos datasets rm <path> --profile my_profile
1288
+ ```
1289
+
1290
+ ---
1291
+
1292
+ ### Procurement
1293
+
1294
+ CloudOS supports procurement functionality to manage and list images associated with organizations within a given procurement. This feature is useful for administrators and users who need to view available container images across different organizations in their procurement.
1295
+
1296
+ #### List Procurement Images
1297
+
1298
+ You can get a list of images associated with organizations of a given procurement using the `cloudos procurement images ls` command. This command provides paginated results showing image configurations and metadata.
1299
+
1300
+ To list images for a specific procurement, use the following command:
1301
+
1302
+ ```bash
1303
+ cloudos procurement images ls \
1304
+ -- profile procurement_profile
1305
+ --procurement-id "your_procurement_id_here"
1306
+ ```
1307
+
1308
+ **Command options:**
1309
+
1310
+ - `--apikey` / `-k`: Your CloudOS API key (required)
1311
+ - `--cloudos-url` / `-c`: The CloudOS URL you are trying to access (default: https://cloudos.lifebit.ai)
1312
+ - `--procurement-id`: The specific CloudOS procurement ID (required)
1313
+ - `--page`: The response page number (default: 1)
1314
+ - `--limit`: The page size limit (default: 10)
1315
+ - `--disable-ssl-verification`: Disable SSL certificate verification
1316
+ - `--ssl-cert`: Path to your SSL certificate file
1317
+ - `--profile`: Profile to use from the config file
1318
+
1319
+ **Example usage:**
1320
+
1321
+ ```bash
1322
+ # List images for the procurement (first page, 10 items)
1323
+ cloudos procurement images ls --profile procurement_profile --procurement-id "your_procurement_id_here"
1324
+ ```
1325
+
1326
+ To get more results per page or navigate to different pages:
1327
+
1328
+ ```bash
1329
+ # Get 25 images from page 2
1330
+ cloudos procurement images ls --profile procurement_profile --page 2 --limit 25 --procurement-id "your_procurement_id_here"
1331
+ ```
1332
+
1333
+
1334
+
1335
+ **Output format:**
1336
+
1337
+ The command returns detailed information about image configurations and pagination metadata in JSON format, including:
1338
+
1339
+ - **Image configurations**: Details about available container images
1340
+ - **Pagination metadata**: Information about total pages, current page, and available items
1341
+
1342
+ This is particularly useful for understanding what container images are available across different organizations within your procurement and for programmatic access to image inventory.
1343
+
1344
+ #### Set Procurement Organization Image
1345
+
1346
+ You can set a custom image ID or name for an organization within a procurement using the `cloudos procurement images set` command. This allows you to override the default CloudOS images with your own custom images for specific organizations.
1347
+
1348
+ To set a custom image for an organization, use the following command:
1349
+
1350
+ ```bash
1351
+ cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "custom-image-name" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
1352
+ ```
1353
+
1354
+ **Set command options:**
1355
+
1356
+ - `--apikey` / `-k`: Your CloudOS API key (required)
1357
+ - `--cloudos-url` / `-c`: The CloudOS URL you are trying to access (default: https://cloudos.lifebit.ai)
1358
+ - `--procurement-id`: The specific CloudOS procurement ID (required)
1359
+ - `--organisation-id`: The organization ID where the change will be applied (required)
1360
+ - `--image-type`: The CloudOS resource image type (required). Possible values:
1361
+ - `RegularInteractiveSessions`
1362
+ - `SparkInteractiveSessions`
1363
+ - `RStudioInteractiveSessions`
1364
+ - `JupyterInteractiveSessions`
1365
+ - `JobDefault`
1366
+ - `NextflowBatchComputeEnvironment`
1367
+ - `--provider`: The cloud provider (required). Currently only `aws` is supported
1368
+ - `--region`: The cloud region (required). Currently only AWS regions are supported
1369
+ - `--image-id`: The new image ID value (required)
1370
+ - `--image-name`: The new image name value (optional)
1371
+ - `--disable-ssl-verification`: Disable SSL certificate verification
1372
+ - `--ssl-cert`: Path to your SSL certificate file
1373
+ - `--profile`: Profile to use from the config file
1374
+
1375
+ **Set command example:**
1376
+
1377
+ ```bash
1378
+ # Set custom image for job execution
1379
+ cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "my-custom-job-image" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
1380
+ ```
1381
+
1382
+ #### Reset Procurement Organization Image
1383
+
1384
+ You can reset an organization's image configuration back to CloudOS defaults using the `cloudos procurement images reset` command. This removes any custom image configurations and restores the original CloudOS defaults.
1385
+
1386
+ To reset an organization's image to defaults, use the following command:
1387
+
1388
+ ```bash
1389
+ cloudos procurement images reset --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
1390
+ ```
1391
+
1392
+ **Reset command options:**
1393
+
1394
+ - `--apikey` / `-k`: Your CloudOS API key (required)
1395
+ - `--cloudos-url` / `-c`: The CloudOS URL you are trying to access (default: https://cloudos.lifebit.ai)
1396
+ - `--procurement-id`: The specific CloudOS procurement ID (required)
1397
+ - `--organisation-id`: The organization ID where the change will be applied (required)
1398
+ - `--image-type`: The CloudOS resource image type (required). Same values as for `set` command
1399
+ - `--provider`: The cloud provider (required). Currently only `aws` is supported
1400
+ - `--region`: The cloud region (required). Currently only AWS regions are supported
1401
+ - `--disable-ssl-verification`: Disable SSL certificate verification
1402
+ - `--ssl-cert`: Path to your SSL certificate file
1403
+ - `--profile`: Profile to use from the config file
1404
+
1405
+ **Reset command example:**
1406
+
1407
+ ```bash
1408
+ # Reset image configuration to CloudOS defaults
1409
+ cloudos procurement images reset --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
1410
+ ```
1411
+
1412
+
1413
+ ### Cromwell and WDL Pipeline Support
1414
+
1415
+ #### Manage Cromwell Server
1416
+
1417
+ In order to run WDL pipelines, a Cromwell server in CloudOS should be running. This server can be accessed to check its status, restart it or stop it, using the following commands:
1418
+
1419
+ ```bash
1420
+ # Check Cromwell status
1421
+ cloudos cromwell status --profile my_profile
1422
+ ```
1423
+
1424
+ ```console
1425
+ Executing status...
1426
+ Current Cromwell server status is: Stopped
1427
+ ```
1428
+
1429
+ ```bash
1430
+ # Cromwell start
1431
+ cloudos cromwell start --profile my_profile
1432
+ ```
1433
+
1434
+ ```console
1435
+ Starting Cromwell server...
1436
+ Current Cromwell server status is: Initializing
1437
+
1438
+ Current Cromwell server status is: Running
1439
+ ```
1440
+
1441
+ ```bash
1442
+ # Cromwell stop
1443
+ cloudos cromwell stop --profile my_profile
1444
+ ```
1445
+
1446
+ ```console
1447
+ Stopping Cromwell server...
1448
+ Current Cromwell server status is: Stopped
1449
+ ```
1450
+
1451
+ #### Run WDL Workflows
1452
+
1453
+ To run WDL workflows, `cloudos job run` command can be used normally, but adding two extra parameters:
1454
+
1455
+ - `--wdl-mainfile`: name of the mainFile (*.wdl) file used by the CloudOS workflow.
1456
+ - `--wdl-importsfile` [Optional]: name of the workflow imported file (importsFile, *.zip).
1457
+
1458
+ All the rest of the `cloudos job run` functionality is available.
1459
+
1460
+ > NOTE: WDL does not support `profiles` and therefore, `--nextflow-profile` option is not available. Instead, use `--job-config` and/or `--parameter`. The format of the job config file is expected to be the same as for nextflow pipelines.
1461
+
1462
+ Example of job config file for WDL workflows:
1463
+
1464
+ ```bash
1465
+ params {
1466
+ test.hello.name = aasdajdad
1467
+ test.bye.nameTwo = asijdadads
1468
+ test.number.x = 2
1469
+ test.greeter.morning = true
1470
+ test.wf_hello_in = bomba
1471
+ test.arrayTest = ["lala"]
1472
+ test.mapTest = {"some":"props"}
1473
+ }
1474
+ ```
1475
+
1476
+ > NOTE: when using `--parameter` option, if the value needs quotes (`"`) you will need to escape them. E.g.: `--parameter test.arrayTest=[\"lala\"]`
1477
+
1478
+ ```bash
1479
+ cloudos job run --profile my_profile --project-name wdl-test --workflow-name "wdl-test" --wdl-mainfile hello.wdl --wdl-importsfile imports_7mb.zip --job-config cloudos/examples/wdl.config --wait-completion
1480
+ ```
1481
+
1482
+ ```console
1483
+ Executing run...
1484
+ WDL workflow detected
1485
+
1486
+ Current Cromwell server status is: Stopped
1487
+
1488
+ Starting Cromwell server...
1489
+
1490
+ Current Cromwell server status is: Initializing
1491
+
1492
+
1493
+ Current Cromwell server status is: Running
1494
+
1495
+ *******************************************************************************
1496
+ [WARNING] Cromwell server is now running. Plase, remember to stop it when your
1497
+ job finishes. You can use the following command:
1498
+ cloudos cromwell stop \
1499
+ --cromwell-token $CROMWELL_TOKEN \
1500
+ --cloudos-url $CLOUDOS \
1501
+ --workspace-id $WORKSPACE_ID
1502
+ *******************************************************************************
1503
+
1504
+ Job successfully launched to CloudOS, please check the following link: ****
1505
+ Your assigned job id is: ****
1506
+ Please, wait until job completion or max wait time of 3600 seconds is reached.
1507
+ Your current job status is: initializing.
1508
+ Your current job status is: running.
1509
+ Your job took 60 seconds to complete successfully.
1510
+ ```
1511
+
1512
+ ---
1513
+
1514
+ ## Python API Usage
1515
+
1516
+ To illustrate how to import the package and use its functionality inside
1517
+ your own python scripts, we will perform a job submission and check its
1518
+ status from inside a python script.
1519
+
1520
+ Again, we will set up the environment to ease the work:
1521
+
1522
+ ```python
1523
+ import cloudos_cli.jobs.job as jb
1524
+ import json
1525
+
1526
+
1527
+ # GLOBAL VARS.
1528
+ apikey = 'xxxxx'
1529
+ cloudos_url = 'https://cloudos.lifebit.ai'
1530
+ workspace_id = 'xxxxx'
1531
+ project_name = 'API jobs'
1532
+ workflow_name = 'rnatoy'
1533
+ job_config = 'cloudos/examples/rnatoy.config'
1534
+ ```
1535
+
1536
+ First, create the `Job` object:
1537
+
1538
+ ```python
1539
+ j = jb.Job(cloudos_url, apikey, None, workspace_id, project_name, workflow_name)
1540
+ print(j)
1541
+ ```
1542
+
1543
+ Then, send the job:
1544
+
1545
+ ```python
1546
+ j_id = j.send_job(job_config)
1547
+ ```
1548
+
1549
+ To check the status:
1550
+
1551
+ ```python
1552
+ j_status = j.get_job_status(j_id)
1553
+ j_status_h = json.loads(j_status.content)["status"]
1554
+ print(j_status_h)
1555
+ ```
1556
+
1557
+ The status will change while your job progresses, so to check again just
1558
+ repeat the above code.
1559
+
1560
+ You can also collect your last 30 submitted jobs for a given workspace using the
1561
+ following command.
1562
+
1563
+ ```python
1564
+ my_jobs_r = j.get_job_list(workspace_id)
1565
+ my_jobs = j.process_job_list(my_jobs_r)
1566
+ print(my_jobs)
1567
+ ```
1568
+
1569
+ Or inspect all the available workflows for a given workspace using the
1570
+ following command.
1571
+
1572
+ ```python
1573
+ my_workflows_r = j.get_workflow_list(workspace_id)
1574
+ my_workflows = j.process_workflow_list(my_workflows_r)
1575
+ print(my_workflows)
1576
+ ```
1577
+
1578
+ Similarly, you can inspect all the available projects for a given workspace using the
1579
+ following command.
1580
+
1581
+ ```python
1582
+ my_projects_r = j.get_project_list(workspace_id)
1583
+ my_projects = j.process_project_list(my_projects_r)
1584
+ print(my_projects)
1585
+ ```
1586
+
1587
+ #### Running WDL pipelines using your own scripts
1588
+
1589
+ You can even run WDL pipelines. First check the Cromwell server status and restart it if Stopped:
1590
+
1591
+ ```python
1592
+ import cloudos_cli.clos as cl
1593
+ import cloudos_cli.jobs.job as jb
1594
+ import json
1595
+
1596
+
1597
+ # GLOBAL VARS.
1598
+ apikey = 'xxxxx'
1599
+ cloudos_url = 'https://cloudos.lifebit.ai'
1600
+ workspace_id = 'xxxxx'
1601
+ project_name = 'wdl-test'
1602
+ workflow_name = 'wdl- test'
1603
+ mainfile = 'hello.wdl'
1604
+ importsfile = 'imports_7mb.zip'
1605
+ job_config = 'cloudos/examples/wdl.config'
1606
+
1607
+ # First create cloudos object
1608
+ cl = cl.Cloudos(cloudos_url, apikey, None)
1609
+
1610
+ # Then, check Cromwell status
1611
+ c_status = cl.get_cromwell_status(workspace_id)
1612
+ c_status_h = json.loads(c_status.content)["status"]
1613
+ print(c_status_h)
1614
+
1615
+ # Start Cromwell server
1616
+ cl.cromwell_switch(workspace_id, 'restart')
1617
+
1618
+ # Check again Cromwell status (wait until status: 'Running')
1619
+ c_status = cl.get_cromwell_status(workspace_id)
1620
+ c_status_h = json.loads(c_status.content)["status"]
1621
+ print(c_status_h)
1622
+
1623
+ # Send a job (wait until job has status: 'Completed')
1624
+ j = jb.Job(cloudos_url, apikey, None, workspace_id, project_name, workflow_name, True, mainfile,
1625
+ importsfile)
1626
+ j_id = j.send_job(job_config, workflow_type='wdl', cromwell_id=json.loads(c_status.content)["_id"])
1627
+ j_status = j.get_job_status(j_id)
1628
+ j_status_h = json.loads(j_status.content)["status"]
1629
+ print(j_status_h)
1630
+
1631
+ # Stop Cromwell server
1632
+ cl.cromwell_switch(workspace_id, 'stop')
1633
+
1634
+ # Check again Cromwell status
1635
+ c_status = cl.get_cromwell_status(workspace_id)
1636
+ c_status_h = json.loads(c_status.content)["status"]
1637
+ print(c_status_h)
1638
+ ```
1639
+
1640
+
1641
+ ---
1642
+
1643
+ ## Unit Testing
1644
+
1645
+ Unit tests require 4 additional packages:
1646
+
1647
+ ```
1648
+ pytest>=6.2.5
1649
+ requests-mock>=1.9.3
1650
+ responses>=0.21.0
1651
+ mock>=3.0.5
1652
+ ```
1653
+
1654
+ Command to run tests from the `cloudos-cli` main folder:
1655
+
1656
+ ```
1657
+ python -m pytest -s -v
1658
+ ```