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