Skip to content

Commit a77c88e

Browse files
committed
Add more missing functionality
1 parent f25c9a3 commit a77c88e

File tree

9 files changed

+622
-19
lines changed

9 files changed

+622
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $ seqera info
4646

4747
### Commands
4848

49-
```
49+
```text
5050
pipelines Manage workspace pipelines
5151
runs Manage pipeline runs
5252
compute-envs Manage compute environments

SDK.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ from itertools import islice
7171
first_10 = list(islice(client.pipelines.list(), 10))
7272
```
7373

74-
## Workspaces
74+
## Workspace Parameter
7575

7676
All operations accept an optional `workspace` parameter. If omitted, uses the default workspace.
7777

@@ -172,6 +172,9 @@ result = client.pipelines.launch(
172172
pull_latest=True,
173173
resume=False,
174174
stub_run=False,
175+
head_job_container="quay.io/seqeralabs/nf-launcher:j17", # BETA
176+
user_secrets=["MY_SECRET"],
177+
workspace_secrets=["SHARED_SECRET"],
175178
)
176179
```
177180

@@ -270,6 +273,20 @@ new_workflow_id = client.runs.relaunch(
270273
work_dir="s3://bucket/new-work",
271274
compute_env="different-ce",
272275
)
276+
277+
# Relaunch with additional options
278+
new_workflow_id = client.runs.relaunch(
279+
"abc123",
280+
resume=True,
281+
pull_latest=True,
282+
stub_run=False,
283+
head_job_container="quay.io/seqeralabs/nf-launcher:j17", # BETA
284+
main_script="main.nf",
285+
entry_name="my_workflow",
286+
schema_name="nextflow_schema.json",
287+
user_secrets=["MY_SECRET"],
288+
workspace_secrets=["SHARED_SECRET"],
289+
)
273290
```
274291

275292
### Dump run details
@@ -861,8 +878,21 @@ studio = client.studios.create(
861878
gpu=0,
862879
description="My data analysis environment",
863880
auto_start=True, # Start immediately
881+
lifespan=24, # Hours until auto-stop
882+
mount_data=[{"dataLinkId": "v1-user-abc123"}],
864883
)
865884
print(f"Created studio: {studio.session_id}")
885+
886+
# Create studio and wait for it to be running
887+
studio = client.studios.create(
888+
name="My Analysis Studio",
889+
compute_env_id="ce-123",
890+
template_url="cr.seqera.io/public/data-studio-jupyter:1.0",
891+
auto_start=True,
892+
wait="RUNNING", # Wait for studio to reach RUNNING status
893+
wait_timeout=600, # Max seconds to wait (default 600)
894+
)
895+
print(f"Studio running: {studio.status}")
866896
```
867897

868898
### Create studio from existing
@@ -874,8 +904,20 @@ studio = client.studios.create_from_existing(
874904
parent_studio_id="parent-studio-id",
875905
parent_checkpoint_id=123, # Optional, uses most recent if not specified
876906
auto_start=True,
907+
lifespan=48, # Hours until auto-stop
908+
mount_data=[{"dataLinkId": "v1-user-abc123"}],
877909
)
878910
print(f"Cloned studio: {studio.session_id}")
911+
912+
# Clone and wait for running status
913+
studio = client.studios.create_from_existing(
914+
name="Cloned Studio",
915+
parent_studio_id="parent-studio-id",
916+
auto_start=True,
917+
wait="RUNNING",
918+
wait_timeout=600,
919+
)
920+
print(f"Cloned studio running: {studio.status}")
879921
```
880922

881923
---

USAGE.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,21 @@ $ seqera launch https://github.com/nf-core/rnaseq --params-file=./custom_rnaseq_
256256

257257
> **Note**: CLI users are bound to the same user permissions that apply in the Platform UI. Launch users can launch pre-configured pipelines in the workspaces they have access to, but they cannot add or run new pipelines.
258258
259+
### Additional launch options
260+
261+
The `launch` command supports additional options for advanced use cases:
262+
263+
```console
264+
$ seqera launch my_pipeline \
265+
--launch-container="quay.io/seqeralabs/nf-launcher:j17" \
266+
--user-secrets="MY_SECRET,OTHER_SECRET" \
267+
--workspace-secrets="SHARED_SECRET"
268+
```
269+
270+
- `--launch-container`: Specify a custom container image for the Nextflow head job (BETA feature)
271+
- `--user-secrets`: Comma-separated list of user secrets to make available during pipeline execution
272+
- `--workspace-secrets`: Comma-separated list of workspace secrets to make available during pipeline execution
273+
259274
## Runs
260275

261276
Run `seqera runs -h` to view supported runs operations.
@@ -386,6 +401,37 @@ $ seqera runs list --filter="*man/rnaseq-*"
386401

387402
Run `seqera runs relaunch -h` to view all the required and optional fields for relaunching a run in a workspace.
388403

404+
```console
405+
$ seqera runs relaunch -i 5z4AMshti4g0GK
406+
407+
Workflow 6ABCxX0vCX8xhx submitted at user workspace.
408+
409+
https://cloud.seqera.io/user/abhinav/watch/6ABCxX0vCX8xhx
410+
```
411+
412+
Additional options for relaunch:
413+
414+
```console
415+
$ seqera runs relaunch -i 5z4AMshti4g0GK \
416+
--no-resume \
417+
--pull-latest \
418+
--launch-container="quay.io/seqeralabs/nf-launcher:j17" \
419+
--main-script="custom_main.nf" \
420+
--entry-name="my_workflow" \
421+
--user-secrets="MY_SECRET" \
422+
--workspace-secrets="SHARED_SECRET"
423+
```
424+
425+
- `--no-resume`: Start fresh instead of resuming from the previous run
426+
- `--pull-latest`: Pull the latest pipeline code before running
427+
- `--stub-run`: Execute in stub/dry-run mode
428+
- `--launch-container`: Custom container for the Nextflow head job (BETA)
429+
- `--main-script`: Main script file if different from main.nf
430+
- `--entry-name`: Main workflow name for DLS2 syntax
431+
- `--schema-name`: Schema name for the pipeline
432+
- `--user-secrets`: Comma-separated user secrets for the execution
433+
- `--workspace-secrets`: Comma-separated workspace secrets for the execution
434+
389435
### Cancel a run
390436

391437
Run `seqera runs cancel -h` to view all the required and optional fields for canceling a run in a workspace.
@@ -441,6 +487,7 @@ $ seqera runs task -i 5z4AMshti4g0GK -t 1
441487
### Download log files
442488

443489
Download workflow or task log files from a run. Available file types:
490+
444491
- **stdout** - Standard output (workflow: `nf-{id}.txt`, task: `.command.out`)
445492
- **log** - Log file (workflow: `nf-{id}.log`, task: `.command.log`)
446493
- **stderr** - Standard error (task only: `.command.err`)
@@ -814,11 +861,22 @@ $ seqera studios add -n my-studio -c my-compute-env --template Jupyter \
814861
--description "My analysis studio" \
815862
--labels "project=myproject" \
816863
--auto-start \
864+
--lifespan 24 \
865+
--mount-data-ids v1-user-abc123 \
866+
--wait RUNNING \
817867
-w 12345
818868

819869
Studio 'abc123' created and started at [myorg / myworkspace] workspace
820870
```
821871

872+
Additional studio options:
873+
874+
- `--lifespan`: Hours until the studio automatically stops
875+
- `--mount-data-ids`: Data link IDs to mount (can be specified multiple times)
876+
- `--mount-data`: Data link names to mount (can be specified multiple times)
877+
- `--mount-data-uris`: Data link URIs to mount (can be specified multiple times)
878+
- `--wait`: Wait for the studio to reach a specific status (e.g., `RUNNING`)
879+
822880
### Add a studio from existing
823881

824882
Create a new studio from an existing studio's checkpoint (preserving state/data).
@@ -837,6 +895,25 @@ $ seqera studios add-as-new -n cloned-studio --parent-name "My Studio" --parent-
837895
Studio 'def456' created at [myorg / myworkspace] workspace
838896
```
839897

898+
With additional options:
899+
900+
```console
901+
$ seqera studios add-as-new -n cloned-studio -p parent-studio-id \
902+
--lifespan 48 \
903+
--mount-data-ids v1-user-abc123 \
904+
--auto-start \
905+
--wait RUNNING \
906+
-w 12345
907+
908+
Studio 'def456' created and started at [myorg / myworkspace] workspace
909+
```
910+
911+
- `--lifespan`: Hours until the studio automatically stops
912+
- `--mount-data-ids`: Data link IDs to mount (can be specified multiple times)
913+
- `--mount-data`: Data link names to mount (can be specified multiple times)
914+
- `--mount-data-uris`: Data link URIs to mount (can be specified multiple times)
915+
- `--wait`: Wait for the studio to reach a specific status (e.g., `RUNNING`)
916+
840917
### Delete a studio
841918

842919
Run `seqera studios delete -h` to view all the required and optional fields for deleting a studio.

src/seqera/commands/launch.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,25 @@ def launch(
308308
str | None,
309309
typer.Option("--wait", help="Wait for completion (optional)"),
310310
] = None,
311+
launch_container: Annotated[
312+
str | None,
313+
typer.Option(
314+
"--launch-container", help="Container to be used to run the Nextflow head job (BETA)"
315+
),
316+
] = None,
317+
user_secrets: Annotated[
318+
str | None,
319+
typer.Option(
320+
"--user-secrets", help="User secrets (comma-separated) for the pipeline execution"
321+
),
322+
] = None,
323+
workspace_secrets: Annotated[
324+
str | None,
325+
typer.Option(
326+
"--workspace-secrets",
327+
help="Workspace secrets (comma-separated) for the pipeline execution",
328+
),
329+
] = None,
311330
) -> None:
312331
"""Launch a pipeline."""
313332
try:
@@ -423,6 +442,19 @@ def launch(
423442
label_ids = resolve_labels(client, label_names, workspace_id)
424443
launch_payload["labelIds"] = label_ids
425444

445+
# Handle launch container (BETA)
446+
if launch_container:
447+
launch_payload["headJobContainer"] = launch_container
448+
449+
# Handle secrets
450+
if user_secrets:
451+
secret_names = [s.strip() for s in user_secrets.split(",")]
452+
launch_payload["userSecrets"] = secret_names
453+
454+
if workspace_secrets:
455+
secret_names = [s.strip() for s in workspace_secrets.split(",")]
456+
launch_payload["workspaceSecrets"] = secret_names
457+
426458
# Submit launch
427459
post_params = {}
428460
if workspace_id:

src/seqera/commands/runs/__init__.py

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,49 @@ def relaunch_run(
363363
str | None,
364364
typer.Option("--profile", help="Nextflow profile(s) (comma-separated)"),
365365
] = None,
366+
launch_container: Annotated[
367+
str | None,
368+
typer.Option(
369+
"--launch-container", help="Container to be used to run the Nextflow head job (BETA)"
370+
),
371+
] = None,
372+
pull_latest: Annotated[
373+
bool | None,
374+
typer.Option("--pull-latest", help="Pull latest repository version before running"),
375+
] = None,
376+
stub_run: Annotated[
377+
bool | None,
378+
typer.Option(
379+
"--stub-run", help="Execute workflow replacing process scripts with command stubs"
380+
),
381+
] = None,
382+
main_script: Annotated[
383+
str | None,
384+
typer.Option("--main-script", help="Pipeline main script file if different from main.nf"),
385+
] = None,
386+
entry_name: Annotated[
387+
str | None,
388+
typer.Option(
389+
"--entry-name", help="Main workflow name to be executed when using DLS2 syntax"
390+
),
391+
] = None,
392+
schema_name: Annotated[
393+
str | None,
394+
typer.Option("--schema-name", help="Schema name"),
395+
] = None,
396+
user_secrets: Annotated[
397+
str | None,
398+
typer.Option(
399+
"--user-secrets", help="User secrets (comma-separated) for the pipeline execution"
400+
),
401+
] = None,
402+
workspace_secrets: Annotated[
403+
str | None,
404+
typer.Option(
405+
"--workspace-secrets",
406+
help="Workspace secrets (comma-separated) for the pipeline execution",
407+
),
408+
] = None,
366409
) -> None:
367410
"""Relaunch a pipeline run."""
368411
from pathlib import Path
@@ -469,14 +512,33 @@ def relaunch_run(
469512
"paramsText": params_text,
470513
"preRunScript": pre_run_script,
471514
"postRunScript": post_run_script,
472-
"mainScript": launch.get("mainScript"),
473-
"entryName": launch.get("entryName"),
474-
"schemaName": launch.get("schemaName"),
515+
"mainScript": main_script if main_script else launch.get("mainScript"),
516+
"entryName": entry_name if entry_name else launch.get("entryName"),
517+
"schemaName": schema_name if schema_name else launch.get("schemaName"),
475518
"resume": not no_resume,
476-
"pullLatest": launch.get("pullLatest"),
477-
"stubRun": launch.get("stubRun"),
519+
"pullLatest": pull_latest if pull_latest is not None else launch.get("pullLatest"),
520+
"stubRun": stub_run if stub_run is not None else launch.get("stubRun"),
478521
}
479522

523+
# Handle launch container (BETA)
524+
if launch_container:
525+
launch_request["headJobContainer"] = launch_container
526+
elif launch.get("headJobContainer"):
527+
launch_request["headJobContainer"] = launch.get("headJobContainer")
528+
529+
# Handle secrets
530+
if user_secrets:
531+
secret_names = [s.strip() for s in user_secrets.split(",")]
532+
launch_request["userSecrets"] = secret_names
533+
elif launch.get("userSecrets"):
534+
launch_request["userSecrets"] = launch.get("userSecrets")
535+
536+
if workspace_secrets:
537+
secret_names = [s.strip() for s in workspace_secrets.split(",")]
538+
launch_request["workspaceSecrets"] = secret_names
539+
elif launch.get("workspaceSecrets"):
540+
launch_request["workspaceSecrets"] = launch.get("workspaceSecrets")
541+
480542
if name:
481543
launch_request["runName"] = name
482544

0 commit comments

Comments
 (0)