omicslab 2.5.1__tar.gz → 2.8.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.
- {omicslab-2.5.1 → omicslab-2.8.0}/PKG-INFO +55 -8
- {omicslab-2.5.1 → omicslab-2.8.0}/README.developer.md +48 -12
- {omicslab-2.5.1 → omicslab-2.8.0}/README.md +54 -7
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/pixi.toml +1 -0
- omicslab-2.8.0/scripts/bootstrap-env.sh +301 -0
- omicslab-2.8.0/src/omicslab/_version.py +1 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/job_commands.py +51 -6
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/main.py +164 -195
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/runner_commands.py +22 -17
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/utils.py +80 -31
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/workspace_commands.py +1 -2
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/ws_commands.py +547 -239
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/client.py +13 -5
- omicslab-2.8.0/src/omicslab/download.py +241 -0
- omicslab-2.8.0/src/omicslab/job/_run/_apptainer.py +331 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_auth.py +43 -18
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_broker.py +138 -9
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_config_download.py +32 -1
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_consts.py +6 -2
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_data_prep.py +287 -72
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_env.py +31 -2
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_exec.py +8 -1
- omicslab-2.8.0/src/omicslab/job/_run/_gh_proxy.py +288 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_images.py +49 -22
- omicslab-2.8.0/src/omicslab/job/_run/_llm_proxy.py +204 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_nextflow.py +22 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_params.py +34 -0
- omicslab-2.8.0/src/omicslab/job/_run/_proc.py +139 -0
- omicslab-2.8.0/src/omicslab/job/_run/_repo.py +220 -0
- omicslab-2.8.0/src/omicslab/job/_run/_sandbox.py +778 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_spec.py +4 -4
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_storage.py +48 -6
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_studio_prep.py +5 -0
- omicslab-2.8.0/src/omicslab/job/_run/_system_deps.py +317 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/analysis.py +580 -50
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/studio.py +487 -38
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/client.py +23 -3
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/system.py +18 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/jobs.py +234 -20
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/orgs.py +22 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/storage.py +32 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/workspaces.py +0 -37
- omicslab-2.8.0/src/omicslab/upload.py +167 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/e2e/conftest.py +6 -7
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/e2e/test_cli_e2e.py +6 -4
- omicslab-2.8.0/tests/job/_run/test__apptainer.py +213 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__auth.py +32 -1
- omicslab-2.8.0/tests/job/_run/test__broker.py +279 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__data_prep.py +424 -13
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__engine_helpers.py +572 -2
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__env.py +19 -0
- omicslab-2.8.0/tests/job/_run/test__gh_proxy.py +198 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__images.py +49 -0
- omicslab-2.8.0/tests/job/_run/test__llm_proxy.py +131 -0
- omicslab-2.8.0/tests/job/_run/test__nextflow_custom_config.py +166 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__params.py +35 -0
- omicslab-2.8.0/tests/job/_run/test__repo.py +172 -0
- omicslab-2.8.0/tests/job/_run/test__sandbox.py +386 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__spec.py +14 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__storage.py +54 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__studio_docker.py +229 -0
- omicslab-2.8.0/tests/job/_run/test__system_deps.py +257 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_client_extra.py +57 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_studio_image_download.py +27 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_cli.py +101 -23
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_cli_storage.py +284 -25
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_cli_utils.py +113 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_client.py +2 -10
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_client_broker.py +39 -2
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_job_exec.py +72 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_resources.py +261 -31
- omicslab-2.8.0/tests/test_upload.py +119 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_ws_commands.py +315 -61
- omicslab-2.5.1/scripts/bootstrap-env.sh +0 -224
- omicslab-2.5.1/src/omicslab/_version.py +0 -1
- omicslab-2.5.1/src/omicslab/job/_run/_proc.py +0 -88
- omicslab-2.5.1/tests/job/_run/test__broker.py +0 -146
- {omicslab-2.5.1 → omicslab-2.8.0}/.gitignore +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/Makefile +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/.gitignore +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/hcm.pixi.lock +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/hcm.pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/pixi.lock +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/us-east-1.pixi.lock +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/dev/us-east-1.pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/prod/hcm.pixi.lock +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/prod/hcm.pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/prod/pixi.lock +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/prod/pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/envs/regions.json +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/pixi.config.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/pyproject.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/scripts/check_publish.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/scripts/write_version_manifest.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/analysis_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/auth_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/context_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/credential_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/fuse_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/org_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/setup_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/studio_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/cli/token_commands.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/config.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/exceptions.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_git.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_git_proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_log.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_monitor.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/_run/_s3_proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/console.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/executor.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/job/paths.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/analysis.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/base.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/credentials.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/runners.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/studio.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/resources/tokens.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/src/omicslab/selfupdate.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/conftest.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/e2e/__init__.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/e2e/test_tokens.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/fixtures/nfcore-demo-custom.config +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/fixtures/studio_specs/jupyter.json +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/fixtures/studio_specs/rstudio.json +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__get_images_cli.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__git.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__git_proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__log.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__monitor.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__nextflow.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__proxy_extra.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test__s3_proxy.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/_run/test_studio_proxy_start.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_cli.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_client.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_executor.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_executor_extra.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_fuse.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_resource.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_job_system.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_snapshot_request.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_studio_validate_cli.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/job/test_ws_helpers.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_cli_catalog.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_cli_context.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_config.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_fuse.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_job_heartbeat.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_misc.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_runner_helpers.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_runner_self_update.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_sandbox_report.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_selfupdate.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_studio_snapshot.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/test_system_monitor_interval.py +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-nextflow/input.txt +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-nextflow/main.nf +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-nextflow/omicslab/main.sh +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-nextflow/pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-nextflow/schema.json +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-simple/omicslab/main.sh +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-simple/pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-simple/schema.json +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-snakemake/Snakefile +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-snakemake/input.txt +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-snakemake/omicslab/main.sh +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-snakemake/pixi.toml +0 -0
- {omicslab-2.5.1 → omicslab-2.8.0}/tests/tools/hello-snakemake/schema.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: omicslab
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Summary: Python SDK and CLI for the OmicsLab Platform
|
|
5
5
|
Project-URL: Homepage, https://platform.omicslab.io
|
|
6
6
|
Project-URL: Repository, https://github.com/vieomics/omicslab-platform
|
|
@@ -52,7 +52,7 @@ omicslab use
|
|
|
52
52
|
omicslab ls && omicslab upload ./data.csv
|
|
53
53
|
|
|
54
54
|
# 4. Launch a job
|
|
55
|
-
omicslab
|
|
55
|
+
omicslab ws analysis launch --workspace <ws_id> --analysis <id> --compute <id>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
## Storage Commands
|
|
@@ -148,12 +148,13 @@ Analysis and studio jobs share one backend namespace:
|
|
|
148
148
|
`/workspaces/{workspace_id}/jobs/...` — `job_type` ("analysis" | "studio")
|
|
149
149
|
is part of the launch payload / list filter, not a separate URL space.
|
|
150
150
|
`client.jobs` exposes generic methods (`launch`, `list_jobs`, `get_job`,
|
|
151
|
-
`get_job_manifest`, `
|
|
152
|
-
`disconnect_job`, `check_job_ready`, ...) plus the domain
|
|
153
|
-
(`launch_analysis`, `launch_studio`, `
|
|
154
|
-
for convenience. Job
|
|
155
|
-
launch config live in the
|
|
156
|
-
|
|
151
|
+
`get_job_manifest`, `rerun_job`, `terminate_job`, `delete_job`,
|
|
152
|
+
`connect_job`, `disconnect_job`, `check_job_ready`, ...) plus the domain
|
|
153
|
+
aliases (`launch_analysis`, `launch_studio`, `rerun_analysis`,
|
|
154
|
+
`rerun_studio`, `list_analysis`, `list_studio`, ...) for convenience. Job
|
|
155
|
+
resources (`time`/`cpu`/`memory`/`disk`) and the launch config live in the
|
|
156
|
+
per-job manifest on S3, retrievable via `get_job_manifest` /
|
|
157
|
+
`get_job_audit_params` / `get_job_audit_config`.
|
|
157
158
|
|
|
158
159
|
```python
|
|
159
160
|
from omicslab import Client
|
|
@@ -180,6 +181,52 @@ studio = client.jobs.launch_studio(
|
|
|
180
181
|
compute_id="cloud-comp-...",
|
|
181
182
|
)
|
|
182
183
|
access = client.jobs.connect_job("ws-...", studio["id"]) # {"access_url": ...}
|
|
184
|
+
|
|
185
|
+
# Rerun a job from its resolved launch manifest. Only the overrides below
|
|
186
|
+
# change; tool/tag/pinned commit/versioning/config stay fixed to the source.
|
|
187
|
+
rerun = client.jobs.rerun_analysis(
|
|
188
|
+
"ws-...",
|
|
189
|
+
job_id,
|
|
190
|
+
cpu=8,
|
|
191
|
+
time=7200,
|
|
192
|
+
params={"max_cpus": 8}, # merged per top-level key
|
|
193
|
+
)
|
|
194
|
+
# Masked secret params must be supplied again, otherwise the API returns 400.
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The same rerun is available for studio sessions via
|
|
198
|
+
`client.jobs.rerun_studio(...)`; the generic `client.jobs.rerun_job(...)`
|
|
199
|
+
works for both. The response carries `old_job_id` and
|
|
200
|
+
`changed_parameters` so callers can show what changed.
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
# Estimate the max cost before launching
|
|
204
|
+
estimate = client.jobs.estimate_job(
|
|
205
|
+
"ws-...",
|
|
206
|
+
compute_type="cloud",
|
|
207
|
+
compute_id="cloud-comp-...",
|
|
208
|
+
time=7200,
|
|
209
|
+
cpu=8,
|
|
210
|
+
memory=32,
|
|
211
|
+
disk=100,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
# Status counts + per-period launch trend (workspace or organization scope)
|
|
215
|
+
counts = client.jobs.get_job_counts("ws-...", job_type="analysis", granularity="daily")
|
|
216
|
+
org_counts = client.orgs.get_job_counts("org-...", job_type="analysis")
|
|
217
|
+
|
|
218
|
+
# Snapshot a RUNNING studio session into workspace storage
|
|
219
|
+
client.jobs.snapshot_studio("ws-...", studio["id"], outdir="snapshots")
|
|
220
|
+
|
|
221
|
+
# Server-side search/filter/sort (exact statuses need filter_column="status")
|
|
222
|
+
client.jobs.list_analysis(
|
|
223
|
+
"ws-...",
|
|
224
|
+
search="bacass",
|
|
225
|
+
filter_column="status",
|
|
226
|
+
filter_value="running,failed",
|
|
227
|
+
sort_column="created_at",
|
|
228
|
+
sort_desc=True,
|
|
229
|
+
)
|
|
183
230
|
```
|
|
184
231
|
|
|
185
232
|
## Testing
|
|
@@ -92,13 +92,13 @@ and then hand the raw token to `Client`.
|
|
|
92
92
|
|
|
93
93
|
| Property | Class | Purpose |
|
|
94
94
|
|------------|--------------------------|---------|
|
|
95
|
-
| `orgs` | `OrgResource` | Org CRUD + members + roles |
|
|
96
|
-
| `workspaces` | `WorkspaceResource` | Workspace CRUD, members, pin,
|
|
95
|
+
| `orgs` | `OrgResource` | Org CRUD + members + roles + job counts |
|
|
96
|
+
| `workspaces` | `WorkspaceResource` | Workspace CRUD, members, pin, budget/storage-quota (read-only) |
|
|
97
97
|
| `analysis` | `AnalysisResource` | Tool catalog (batch tools) CRUD/tags/profiles/schema |
|
|
98
98
|
| `studio` | `StudioResource` | Tool catalog (interactive tools) CRUD + tags/profiles/schema |
|
|
99
|
-
| `jobs` | `JobResource` | Launch/list/get/terminate analysis + studio jobs |
|
|
99
|
+
| `jobs` | `JobResource` | Launch/list/get/rerun/estimate/counts/snapshot/terminate analysis + studio jobs |
|
|
100
100
|
| `storage` | `StorageResource` | Upload/download list/delete/rename vs workspace S3 |
|
|
101
|
-
| `credentials` | `CredentialResource` | S3/GitHub/
|
|
101
|
+
| `credentials` | `CredentialResource` | S3/GitHub/cloud/LLM credentials (user + org scopes) |
|
|
102
102
|
| `tokens` | `TokenResource` | Create/list/revoke API tokens |
|
|
103
103
|
| `runners` | `RunnerResource` | Runner registration/token/heartbeat/deprovision |
|
|
104
104
|
|
|
@@ -248,15 +248,16 @@ bootstraps one session-scoped user via raw `httpx`:
|
|
|
248
248
|
```
|
|
249
249
|
POST /api/auth/register/ (unique email)
|
|
250
250
|
POST /api/auth/standard/ → access_token cookie
|
|
251
|
-
|
|
251
|
+
POST /api/organizations/ → create the test org
|
|
252
252
|
POST /api/credentials/organization/{org}/storage/base/ + link s3 (storage cred)
|
|
253
253
|
POST /api/organizations/{org}/workspaces/ (workspace)
|
|
254
254
|
POST /api/tokens/ → omx_ token scoped to org (admin)
|
|
255
255
|
Client(token=..., base_url=...)
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
-
Registration
|
|
259
|
-
|
|
258
|
+
Registration does not create any organization; the conftest creates the org
|
|
259
|
+
explicitly. A subscription is still activated for it through the payment flow
|
|
260
|
+
(see `test_subscription`).
|
|
260
261
|
|
|
261
262
|
### 7.2 Fixtures
|
|
262
263
|
|
|
@@ -276,7 +277,7 @@ create their own tokens — never reuse the shared org when mutating it destruct
|
|
|
276
277
|
|
|
277
278
|
| File | Covers |
|
|
278
279
|
|------|--------|
|
|
279
|
-
| `test_org_workspace.py` | Org update/list, workspace CRUD, members, pin/unpin
|
|
280
|
+
| `test_org_workspace.py` | Org update/list, workspace CRUD, members, pin/unpin |
|
|
280
281
|
| `test_credentials.py` | S3 storage credential lifecycle, workspace merged view, GitHub (skippable) |
|
|
281
282
|
| `test_tools.py` | Analysis/studio tool CRUD + pin/unpin |
|
|
282
283
|
| `test_storage.py` | Health, presigned upload, list, download, delete, rename, batch |
|
|
@@ -466,8 +467,8 @@ daemon over WebSocket. Only `job run --work-dir` analysis is native/synchronous.
|
|
|
466
467
|
Studio session mounts (no token exposure, snapshot-safe):
|
|
467
468
|
|
|
468
469
|
- The SDK environment is bind-mounted **read-only at its own absolute path**
|
|
469
|
-
(pixi/conda envs are path-sensitive), and `omicslab`/`omx` are exposed
|
|
470
|
-
`PATH` via a dedicated `/opt/omicslab/bin` directory.
|
|
470
|
+
(pixi/conda envs are path-sensitive), and `omicslab`/`omx`/`gh` are exposed
|
|
471
|
+
on `PATH` via a dedicated `/opt/omicslab/bin` directory.
|
|
471
472
|
- `pixi` itself is mounted there too, together with the SDK project's
|
|
472
473
|
`pixi.toml`/`pixi.lock`, so `pixi run ...` works inside the session. A
|
|
473
474
|
writable copy of the env's small `conda-meta` directory is mounted over the
|
|
@@ -475,8 +476,11 @@ Studio session mounts (no token exposure, snapshot-safe):
|
|
|
475
476
|
`history`; the copy lives in the job dir and is never snapshotted.
|
|
476
477
|
- Users can create their own project envs in the writable workspace
|
|
477
478
|
(`pixi init` + `pixi add`); those envs are in the writable layer and **are**
|
|
478
|
-
included in snapshots.
|
|
479
|
-
|
|
479
|
+
included in snapshots. Pixi keeps its default package cache under the
|
|
480
|
+
session user's home, so that cache is part of the writable layer too and is
|
|
481
|
+
included in snapshots. No cache directory is mounted: sessions need no extra
|
|
482
|
+
mount, the cache never runs out of a fixed size cap, and pixi works for any
|
|
483
|
+
image user without permission fixes.
|
|
480
484
|
- The staged CLI config is mounted from the host into
|
|
481
485
|
`OMICSLAB_CONFIG_DIR=/run/omicslab` before the container starts. The token
|
|
482
486
|
is replaced with a placeholder first; the SDK talks to a host-side
|
|
@@ -493,6 +497,29 @@ Studio session mounts (no token exposure, snapshot-safe):
|
|
|
493
497
|
proxy URL, so no token or credential helper is present in the container.
|
|
494
498
|
Studio launches reject organization and marketplace credentials. The token
|
|
495
499
|
stays in the agent process and is never logged or returned to the session.
|
|
500
|
+
- The **same GitHub credential** also backs the `gh` CLI through a host-side
|
|
501
|
+
GitHub API proxy. `gh` is configured with `http_unix_socket` (go-gh sends
|
|
502
|
+
plain HTTP over the socket even for `https://api.github.com` URLs) and
|
|
503
|
+
`GH_CONFIG_DIR` points at a staged directory that contains only a
|
|
504
|
+
placeholder token. The proxy injects the real token for `api.github.com`
|
|
505
|
+
and `uploads.github.com`, and forwards pre-signed download hosts
|
|
506
|
+
(`objects.githubusercontent.com`, `codeload.github.com`, …) without it.
|
|
507
|
+
This lets `gh pr create` / `gh pr merge` work in the session while keeping
|
|
508
|
+
the real token out of the container env, writable layer, and snapshots.
|
|
509
|
+
The token scope must cover both git (`Contents: write`) and pull requests
|
|
510
|
+
(`Pull requests: write`); the `gh` binary itself comes from the SDK pixi
|
|
511
|
+
environment and is exposed at `/opt/omicslab/bin/gh`.
|
|
512
|
+
- The **personal LLM provider** credential selected in the Studio launch form
|
|
513
|
+
(`Settings → LLM providers`, default endpoint
|
|
514
|
+
`https://opencode.ai/zen/go/v1`) is proxied by a host-side HTTP proxy. The
|
|
515
|
+
selection is nullable: choosing **None** runs the session without a brokered
|
|
516
|
+
provider. The credential carries an `agent` enum (currently only `opencode`);
|
|
517
|
+
the generated OpenCode config points the `opencode-go` provider at that
|
|
518
|
+
proxy, and the container receives only `OPENCODE_API_KEY=broker` and
|
|
519
|
+
`OPENCODE_CONFIG=/run/omicslab/opencode.json`. Adding a new agent (for example
|
|
520
|
+
Pi) means a new enum value plus its config writer in
|
|
521
|
+
`studio._llm_agent_env_args`. The real API key stays in the agent process and
|
|
522
|
+
never enters the container env, writable layer, or snapshots.
|
|
496
523
|
- When `STUDIO_EXPORT_AWS_CREDENTIALS` is enabled (Settings → Studio), the
|
|
497
524
|
backend mints short-lived STS credentials for the workspace storage and the
|
|
498
525
|
agent starts a host-side S3 signing proxy. The session receives only
|
|
@@ -500,6 +527,15 @@ Studio session mounts (no token exposure, snapshot-safe):
|
|
|
500
527
|
`AWS_ENDPOINT_URL=<host proxy>`; the real STS never enters the container.
|
|
501
528
|
Only credentials carrying a session token are proxied; long-lived provider
|
|
502
529
|
keys are never exported by this path.
|
|
530
|
+
- The selected **personal repository** (`Settings → Repositories`) is cloned
|
|
531
|
+
on the host and bind-mounted into the session at `/repo/<name>`; Docker `-w`
|
|
532
|
+
and `REPOSITORY_DIR` make it the working folder. Selection is optional
|
|
533
|
+
(None runs the image's default workdir). A repository must link a personal
|
|
534
|
+
GitHub credential; that credential supplies the clone token and the
|
|
535
|
+
in-session Git proxy. If the linked credential is deleted the repository
|
|
536
|
+
remains but must be re-linked before it can be launched. The token is passed
|
|
537
|
+
only through a process-scoped `http.extraheader`, never in argv or the remote
|
|
538
|
+
URL. Bind mounts are excluded from `docker commit` snapshots.
|
|
503
539
|
- The old implicit `/home/omicslab` bind is gone (opt-in via
|
|
504
540
|
`runtime.home_mount` only): user files stay in the container's writable layer
|
|
505
541
|
and are therefore included in `docker commit` snapshots.
|
|
@@ -24,7 +24,7 @@ omicslab use
|
|
|
24
24
|
omicslab ls && omicslab upload ./data.csv
|
|
25
25
|
|
|
26
26
|
# 4. Launch a job
|
|
27
|
-
omicslab
|
|
27
|
+
omicslab ws analysis launch --workspace <ws_id> --analysis <id> --compute <id>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Storage Commands
|
|
@@ -120,12 +120,13 @@ Analysis and studio jobs share one backend namespace:
|
|
|
120
120
|
`/workspaces/{workspace_id}/jobs/...` — `job_type` ("analysis" | "studio")
|
|
121
121
|
is part of the launch payload / list filter, not a separate URL space.
|
|
122
122
|
`client.jobs` exposes generic methods (`launch`, `list_jobs`, `get_job`,
|
|
123
|
-
`get_job_manifest`, `
|
|
124
|
-
`disconnect_job`, `check_job_ready`, ...) plus the domain
|
|
125
|
-
(`launch_analysis`, `launch_studio`, `
|
|
126
|
-
for convenience. Job
|
|
127
|
-
launch config live in the
|
|
128
|
-
|
|
123
|
+
`get_job_manifest`, `rerun_job`, `terminate_job`, `delete_job`,
|
|
124
|
+
`connect_job`, `disconnect_job`, `check_job_ready`, ...) plus the domain
|
|
125
|
+
aliases (`launch_analysis`, `launch_studio`, `rerun_analysis`,
|
|
126
|
+
`rerun_studio`, `list_analysis`, `list_studio`, ...) for convenience. Job
|
|
127
|
+
resources (`time`/`cpu`/`memory`/`disk`) and the launch config live in the
|
|
128
|
+
per-job manifest on S3, retrievable via `get_job_manifest` /
|
|
129
|
+
`get_job_audit_params` / `get_job_audit_config`.
|
|
129
130
|
|
|
130
131
|
```python
|
|
131
132
|
from omicslab import Client
|
|
@@ -152,6 +153,52 @@ studio = client.jobs.launch_studio(
|
|
|
152
153
|
compute_id="cloud-comp-...",
|
|
153
154
|
)
|
|
154
155
|
access = client.jobs.connect_job("ws-...", studio["id"]) # {"access_url": ...}
|
|
156
|
+
|
|
157
|
+
# Rerun a job from its resolved launch manifest. Only the overrides below
|
|
158
|
+
# change; tool/tag/pinned commit/versioning/config stay fixed to the source.
|
|
159
|
+
rerun = client.jobs.rerun_analysis(
|
|
160
|
+
"ws-...",
|
|
161
|
+
job_id,
|
|
162
|
+
cpu=8,
|
|
163
|
+
time=7200,
|
|
164
|
+
params={"max_cpus": 8}, # merged per top-level key
|
|
165
|
+
)
|
|
166
|
+
# Masked secret params must be supplied again, otherwise the API returns 400.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The same rerun is available for studio sessions via
|
|
170
|
+
`client.jobs.rerun_studio(...)`; the generic `client.jobs.rerun_job(...)`
|
|
171
|
+
works for both. The response carries `old_job_id` and
|
|
172
|
+
`changed_parameters` so callers can show what changed.
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
# Estimate the max cost before launching
|
|
176
|
+
estimate = client.jobs.estimate_job(
|
|
177
|
+
"ws-...",
|
|
178
|
+
compute_type="cloud",
|
|
179
|
+
compute_id="cloud-comp-...",
|
|
180
|
+
time=7200,
|
|
181
|
+
cpu=8,
|
|
182
|
+
memory=32,
|
|
183
|
+
disk=100,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
# Status counts + per-period launch trend (workspace or organization scope)
|
|
187
|
+
counts = client.jobs.get_job_counts("ws-...", job_type="analysis", granularity="daily")
|
|
188
|
+
org_counts = client.orgs.get_job_counts("org-...", job_type="analysis")
|
|
189
|
+
|
|
190
|
+
# Snapshot a RUNNING studio session into workspace storage
|
|
191
|
+
client.jobs.snapshot_studio("ws-...", studio["id"], outdir="snapshots")
|
|
192
|
+
|
|
193
|
+
# Server-side search/filter/sort (exact statuses need filter_column="status")
|
|
194
|
+
client.jobs.list_analysis(
|
|
195
|
+
"ws-...",
|
|
196
|
+
search="bacass",
|
|
197
|
+
filter_column="status",
|
|
198
|
+
filter_value="running,failed",
|
|
199
|
+
sort_column="created_at",
|
|
200
|
+
sort_desc=True,
|
|
201
|
+
)
|
|
155
202
|
```
|
|
156
203
|
|
|
157
204
|
## Testing
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# bootstrap-env.sh — Install pixi + omicslab SDK from a public tools bucket.
|
|
3
|
+
#
|
|
4
|
+
# Environment variables:
|
|
5
|
+
# SDK_TOOLS_BASE — tools bucket base URL (default: R2 production). Override
|
|
6
|
+
# to point at any public S3-compatible provider (e.g.
|
|
7
|
+
# local S3: http://localhost:4566/omicslab/data/tools).
|
|
8
|
+
# OMICSLAB_HOME — where pixi.toml/lock live (default: $HOME)
|
|
9
|
+
# PIXI_TOML — manifest filename (default: pixi.toml, or {region}.pixi.toml)
|
|
10
|
+
# PIXI_LOCK — lock filename (default: pixi.lock, or {region}.pixi.lock)
|
|
11
|
+
# PIXI_VERSION — pixi release to fetch from the tools bucket
|
|
12
|
+
# (default: v0.76.1)
|
|
13
|
+
# INSTALL_DOCKER — set to 1 for studio jobs to install the docker engine
|
|
14
|
+
# (client + daemon) and start its daemon (default: 0)
|
|
15
|
+
# INSTALL_SYSTEM_DEPS — set to 0 to skip host packages (fuse3, fuse2fs,
|
|
16
|
+
# docker). Cloud jobs set this to 0 and let the agent
|
|
17
|
+
# install them from the job's preparation step, where the
|
|
18
|
+
# install is visible in the job log. Shared runners keep 1.
|
|
19
|
+
#
|
|
20
|
+
# The script is idempotent: re-running it after a successful install is a
|
|
21
|
+
# no-op (pixi binary present, environment installed, SDK already loaded).
|
|
22
|
+
#
|
|
23
|
+
# It:
|
|
24
|
+
# 1. Installs pixi from the tools bucket (pixi/bin/pixi-<version>-linux-amd64.tar.gz)
|
|
25
|
+
# into an absolute path under $HOME — never hits pixi.sh / GitHub, so it
|
|
26
|
+
# works on air-gapped runners.
|
|
27
|
+
# 2. Downloads the wheel-free manifest from the same bucket.
|
|
28
|
+
# 3. Runs pixi install --frozen (all conda + pypi deps, both cached in the
|
|
29
|
+
# bucket channel/pypi mirrors).
|
|
30
|
+
# 4. Downloads omicslab-latest.whl, extracts version from wheel metadata,
|
|
31
|
+
# renames to a valid PEP 427 filename, pip installs.
|
|
32
|
+
# 5. Grants the pixi interpreter CAP_NET_BIND_SERVICE (falling back to
|
|
33
|
+
# lowering ip_unprivileged_port_start) so the studio TLS proxy can bind
|
|
34
|
+
# the privileged port 443.
|
|
35
|
+
set -euo pipefail
|
|
36
|
+
|
|
37
|
+
TOOLS_BASE="${SDK_TOOLS_BASE:-https://s3-hcm-r2.s3cloud.vn/omicslab/data/tools}"
|
|
38
|
+
OMICSLAB_HOME="${OMICSLAB_HOME:-$HOME}"
|
|
39
|
+
PIXI_TOML="${PIXI_TOML:-pixi.toml}"
|
|
40
|
+
PIXI_LOCK="${PIXI_LOCK:-pixi.lock}"
|
|
41
|
+
PIXI_VERSION="${PIXI_VERSION:-v0.76.1}"
|
|
42
|
+
RETRIES=3
|
|
43
|
+
INSTALL_SYSTEM_DEPS="${INSTALL_SYSTEM_DEPS:-1}"
|
|
44
|
+
|
|
45
|
+
# Download helper. Every fetch is bounded and retried so a stalled connection
|
|
46
|
+
# fails in minutes with a clear message instead of hanging until the platform's
|
|
47
|
+
# SSH bootstrap deadline (900s) kills the job with no diagnostics. The bucket
|
|
48
|
+
# sits behind a single gateway that also serves the conda/pypi payload, so
|
|
49
|
+
# transient 5xx/timeouts must be retried rather than abort the whole bootstrap.
|
|
50
|
+
FETCH_CONNECT_TIMEOUT="${FETCH_CONNECT_TIMEOUT:-10}"
|
|
51
|
+
FETCH_MAX_TIME="${FETCH_MAX_TIME:-300}"
|
|
52
|
+
FETCH_RETRIES="${FETCH_RETRIES:-5}"
|
|
53
|
+
fetch() {
|
|
54
|
+
local url="$1" out="$2"
|
|
55
|
+
curl -fsSL \
|
|
56
|
+
--connect-timeout "${FETCH_CONNECT_TIMEOUT}" \
|
|
57
|
+
--max-time "${FETCH_MAX_TIME}" \
|
|
58
|
+
--retry "${FETCH_RETRIES}" \
|
|
59
|
+
--retry-delay 5 \
|
|
60
|
+
--retry-connrefused \
|
|
61
|
+
"$url" -o "$out"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# ── 1. pixi (from the tools bucket, absolute path under $HOME) ────────────
|
|
65
|
+
PIXI_BIN="${HOME}/.pixi/bin/pixi"
|
|
66
|
+
if [ ! -x "${PIXI_BIN}" ]; then
|
|
67
|
+
PIXI_URL="$TOOLS_BASE/pixi/bin/pixi-${PIXI_VERSION}-linux-amd64.tar.gz"
|
|
68
|
+
echo "Installing pixi ${PIXI_VERSION} from: $PIXI_URL"
|
|
69
|
+
mkdir -p "$(dirname "${PIXI_BIN}")"
|
|
70
|
+
fetch "$PIXI_URL" /tmp/pixi.tar.gz
|
|
71
|
+
tar -xzf /tmp/pixi.tar.gz -C "$(dirname "${PIXI_BIN}")"
|
|
72
|
+
rm -f /tmp/pixi.tar.gz
|
|
73
|
+
else
|
|
74
|
+
echo "pixi already installed at ${PIXI_BIN}"
|
|
75
|
+
fi
|
|
76
|
+
export PATH="$(dirname "${PIXI_BIN}"):$PATH"
|
|
77
|
+
|
|
78
|
+
# ── 1b. FUSE host helpers (mountpoint-s3 + Apptainer) ──────────────────────
|
|
79
|
+
# mount-s3 performs unprivileged FUSE mounts via `fusermount3` (package
|
|
80
|
+
# fuse3), which must be root-owned + setuid. Apptainer uses `fuse2fs` to mount
|
|
81
|
+
# EXT3 images (including `--overlay`) without root; without it Apptainer logs
|
|
82
|
+
# "fuse2fs not found" and EXT3 images cannot be mounted. Both are best-effort:
|
|
83
|
+
# on air-gapped hosts without apt, mounts still work when run as root.
|
|
84
|
+
#
|
|
85
|
+
# 1b/1c are host packages, not agent dependencies. Cloud jobs set
|
|
86
|
+
# INSTALL_SYSTEM_DEPS=0 and install them later from the job's preparation
|
|
87
|
+
# step, after the job is visible and streaming logs.
|
|
88
|
+
if [ "${INSTALL_SYSTEM_DEPS}" = "1" ]; then
|
|
89
|
+
if ! command -v fusermount3 >/dev/null 2>&1 || \
|
|
90
|
+
! command -v fuse2fs >/dev/null 2>&1; then
|
|
91
|
+
if command -v apt-get >/dev/null 2>&1; then
|
|
92
|
+
SUDO=""
|
|
93
|
+
if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then
|
|
94
|
+
SUDO="sudo -n"
|
|
95
|
+
fi
|
|
96
|
+
$SUDO apt-get update -qq >/dev/null 2>&1 || true
|
|
97
|
+
if ! command -v fusermount3 >/dev/null 2>&1; then
|
|
98
|
+
echo "Installing fuse3 (fusermount3 helper for mountpoint-s3)..."
|
|
99
|
+
$SUDO apt-get install -y -qq fuse3 >/dev/null 2>&1 || \
|
|
100
|
+
echo "WARNING: fuse3 install failed; mountpoint-s3 mounts will require root"
|
|
101
|
+
fi
|
|
102
|
+
if ! command -v fuse2fs >/dev/null 2>&1; then
|
|
103
|
+
echo "Installing fuse2fs (EXT3 image support for Apptainer)..."
|
|
104
|
+
$SUDO apt-get install -y -qq fuse2fs >/dev/null 2>&1 || \
|
|
105
|
+
echo "WARNING: fuse2fs install failed; Apptainer cannot mount EXT3 images"
|
|
106
|
+
fi
|
|
107
|
+
else
|
|
108
|
+
echo "WARNING: no apt-get; mountpoint-s3 non-root mounts will require root and Apptainer EXT3 images are unavailable"
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# ── 1c. docker engine (studio jobs) ────────────────────────────────────
|
|
113
|
+
# Studio jobs start their session container with `docker run`. On the
|
|
114
|
+
# Docker-simulated VM the host daemon answers `docker info` through the
|
|
115
|
+
# mounted /var/run/docker.sock, so only the client is needed; a real cloud
|
|
116
|
+
# VM (CloudFly / GreenNode) has no host socket, so install the engine
|
|
117
|
+
# (client + daemon), start the daemon, and let the job user reach its
|
|
118
|
+
# socket. Gated by INSTALL_DOCKER so analysis jobs pay nothing for it.
|
|
119
|
+
# Best-effort: on air-gapped hosts without apt the install is skipped and
|
|
120
|
+
# `job run --studio` reports the unreachable daemon.
|
|
121
|
+
if [ "${INSTALL_DOCKER:-0}" = "1" ]; then
|
|
122
|
+
SUDO=""
|
|
123
|
+
if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then
|
|
124
|
+
SUDO="sudo -n"
|
|
125
|
+
fi
|
|
126
|
+
if ! command -v docker >/dev/null 2>&1; then
|
|
127
|
+
if command -v apt-get >/dev/null 2>&1; then
|
|
128
|
+
echo "Installing docker engine (client + daemon)..."
|
|
129
|
+
$SUDO apt-get update -qq >/dev/null 2>&1 || true
|
|
130
|
+
$SUDO apt-get install -y -qq docker.io >/dev/null 2>&1 || \
|
|
131
|
+
echo "WARNING: docker install failed; the studio session cannot start"
|
|
132
|
+
else
|
|
133
|
+
echo "WARNING: no apt-get; cannot install docker for the studio session"
|
|
134
|
+
fi
|
|
135
|
+
fi
|
|
136
|
+
# Start the daemon: systemd where available, else a detached dockerd.
|
|
137
|
+
# Check for the socket (not `docker info`) so a permission problem on
|
|
138
|
+
# the socket is not mistaken for a stopped daemon and does not spawn a
|
|
139
|
+
# second dockerd next to the systemd unit.
|
|
140
|
+
if command -v systemctl >/dev/null 2>&1; then
|
|
141
|
+
$SUDO systemctl enable --now docker >/dev/null 2>&1 || true
|
|
142
|
+
fi
|
|
143
|
+
if [ ! -S /var/run/docker.sock ] && command -v dockerd >/dev/null 2>&1; then
|
|
144
|
+
echo "Starting dockerd..."
|
|
145
|
+
$SUDO dockerd >/dev/null 2>&1 &
|
|
146
|
+
fi
|
|
147
|
+
for _ in $(seq 1 15); do
|
|
148
|
+
[ -S /var/run/docker.sock ] && break
|
|
149
|
+
sleep 1
|
|
150
|
+
done
|
|
151
|
+
# The daemon socket is root:docker mode 0660. The studio agent runs as
|
|
152
|
+
# the (possibly non-root) SSH user and reuses this very session, so
|
|
153
|
+
# `usermod` membership alone would only apply to a later login. Grant
|
|
154
|
+
# the socket to the job user's own group for the current session
|
|
155
|
+
# instead — least privilege, never world-writable. The studio container
|
|
156
|
+
# itself is started with --security-opt no-new-privileges and without
|
|
157
|
+
# the host socket mounted, so the web app inside it cannot reach this
|
|
158
|
+
# daemon.
|
|
159
|
+
if [ "$(id -u)" -ne 0 ]; then
|
|
160
|
+
$SUDO usermod -aG docker "$USER" >/dev/null 2>&1 || true
|
|
161
|
+
$SUDO chgrp "$(id -gn)" /var/run/docker.sock >/dev/null 2>&1 || true
|
|
162
|
+
$SUDO chmod 660 /var/run/docker.sock >/dev/null 2>&1 || true
|
|
163
|
+
fi
|
|
164
|
+
if docker info >/dev/null 2>&1; then
|
|
165
|
+
echo "docker daemon ready"
|
|
166
|
+
else
|
|
167
|
+
echo "WARNING: docker daemon not reachable after install"
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# ── 2. manifest (from the tools bucket) ────────────────────────────────────
|
|
173
|
+
TOML_URL="$TOOLS_BASE/pixi/config/$PIXI_TOML"
|
|
174
|
+
LOCK_URL="$TOOLS_BASE/pixi/config/$PIXI_LOCK"
|
|
175
|
+
echo "Fetching manifest:"
|
|
176
|
+
echo " TOML: $TOML_URL"
|
|
177
|
+
echo " LOCK: $LOCK_URL"
|
|
178
|
+
mkdir -p "$OMICSLAB_HOME"
|
|
179
|
+
fetch "$TOML_URL" "$OMICSLAB_HOME/pixi.toml"
|
|
180
|
+
fetch "$LOCK_URL" "$OMICSLAB_HOME/pixi.lock"
|
|
181
|
+
|
|
182
|
+
# ── 3. pixi install + SDK wheel (with retries) ────────────────────────────
|
|
183
|
+
cd "$OMICSLAB_HOME"
|
|
184
|
+
env_ready=0
|
|
185
|
+
for i in $(seq 1 $RETRIES); do
|
|
186
|
+
if "${PIXI_BIN}" install --frozen; then
|
|
187
|
+
env_ready=1
|
|
188
|
+
break
|
|
189
|
+
fi
|
|
190
|
+
echo "bootstrap-retry-$i"
|
|
191
|
+
sleep 5
|
|
192
|
+
done
|
|
193
|
+
# `set -e` does not fire for a command used as an `if` condition, so without an
|
|
194
|
+
# explicit check the script would carry on with a half-installed environment
|
|
195
|
+
# and fail later at the wheel step with a misleading message.
|
|
196
|
+
if [ "$env_ready" -ne 1 ]; then
|
|
197
|
+
echo "ERROR: pixi install --frozen failed after ${RETRIES} attempts" >&2
|
|
198
|
+
exit 1
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
# Download the stable alias and resolve the real version from wheel
|
|
202
|
+
# metadata so pip gets a valid PEP 427 filename.
|
|
203
|
+
echo "Installing omicslab SDK wheel..."
|
|
204
|
+
fetch "$TOOLS_BASE/omicslab-latest.whl" /tmp/omicslab.whl
|
|
205
|
+
VERSION=$("${PIXI_BIN}" run python3 -c "
|
|
206
|
+
import zipfile, os
|
|
207
|
+
z = zipfile.ZipFile('/tmp/omicslab.whl')
|
|
208
|
+
meta = [n for n in z.namelist() if n.endswith('.dist-info/METADATA')][0]
|
|
209
|
+
ver = [l.split(': ',1)[1] for l in z.read(meta).decode().splitlines() if l.startswith('Version:')][0]
|
|
210
|
+
os.rename('/tmp/omicslab.whl', f'/tmp/omicslab-{ver}-py3-none-any.whl')
|
|
211
|
+
print(ver)
|
|
212
|
+
")
|
|
213
|
+
WHEEL_PATH="/tmp/omicslab-${VERSION}-py3-none-any.whl"
|
|
214
|
+
WHEEL_SHA256=$(sha256sum "$WHEEL_PATH" | awk '{print $1}')
|
|
215
|
+
if "${PIXI_BIN}" run python -m pip install --no-deps "$WHEEL_PATH"; then
|
|
216
|
+
# Record the installed wheel so the runner auto-updater can tell whether
|
|
217
|
+
# the tools bucket has a newer build (by SHA-256, not just version).
|
|
218
|
+
RECORD_DIR="${HOME}/.omicslab"
|
|
219
|
+
mkdir -p "$RECORD_DIR"
|
|
220
|
+
cat > "$RECORD_DIR/install.json" <<JSON
|
|
221
|
+
{
|
|
222
|
+
"version": "${VERSION}",
|
|
223
|
+
"sha256": "${WHEEL_SHA256}",
|
|
224
|
+
"wheel": "omicslab-${VERSION}-py3-none-any.whl",
|
|
225
|
+
"tools_base": "${TOOLS_BASE}",
|
|
226
|
+
"installed_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
227
|
+
}
|
|
228
|
+
JSON
|
|
229
|
+
chmod 600 "$RECORD_DIR/install.json"
|
|
230
|
+
rm -f "$WHEEL_PATH"
|
|
231
|
+
echo "SDK ${VERSION} installed successfully"
|
|
232
|
+
else
|
|
233
|
+
echo "Bootstrap failed after $RETRIES attempts"
|
|
234
|
+
exit 1
|
|
235
|
+
fi
|
|
236
|
+
|
|
237
|
+
# ── 3b. Apptainer image wrapper (local copy before mount) ─────────────────
|
|
238
|
+
# Job images are mounted over FUSE (mountpoint-s3). Apptainer mounts them via
|
|
239
|
+
# squashfuse with a hard-coded 10s timeout, which concurrent job startup
|
|
240
|
+
# routinely exceeds. The wrapper copies the image to node-local storage first
|
|
241
|
+
# and is installed into the SDK bin dir that `job run` puts first on PATH
|
|
242
|
+
# (`<OMICSLAB_HOME>/.omicslab/bin`). Idempotent; re-installed at every job
|
|
243
|
+
# start so an SDK upgrade refreshes the baked real-binary path.
|
|
244
|
+
if [ -x "${OMICSLAB_HOME}/.pixi/envs/default/bin/apptainer" ]; then
|
|
245
|
+
if ! "${PIXI_BIN}" run python - <<'PY'
|
|
246
|
+
import os
|
|
247
|
+
|
|
248
|
+
from omicslab.job._run._apptainer import install_apptainer_wrapper
|
|
249
|
+
from omicslab.job._run._env import find_sdk_root
|
|
250
|
+
|
|
251
|
+
root = find_sdk_root()
|
|
252
|
+
home = os.path.join(root, ".omicslab")
|
|
253
|
+
wrapper = install_apptainer_wrapper(
|
|
254
|
+
os.path.join(home, "bin"),
|
|
255
|
+
sdk_root=root,
|
|
256
|
+
cache_dir=os.path.join(home, "cache", "images"),
|
|
257
|
+
)
|
|
258
|
+
print(f"Apptainer image wrapper: {wrapper or 'not installed'}")
|
|
259
|
+
PY
|
|
260
|
+
then
|
|
261
|
+
echo "WARNING: could not install the Apptainer image wrapper"
|
|
262
|
+
fi
|
|
263
|
+
fi
|
|
264
|
+
|
|
265
|
+
# ── 4. studio direct access: allow binding the privileged port 443 ─────────
|
|
266
|
+
# A studio session's in-VM TLS proxy binds 0.0.0.0:443 so
|
|
267
|
+
# {job_id}.<studio-domain> resolves straight to this host. An unprivileged
|
|
268
|
+
# user cannot bind ports below 1024 by default, so grant the pixi interpreter
|
|
269
|
+
# CAP_NET_BIND_SERVICE — a targeted, per-binary capability with no system-wide
|
|
270
|
+
# effect. Where setcap is unavailable (or the filesystem rejects capabilities)
|
|
271
|
+
# fall back to lowering the kernel's unprivileged port floor. This is
|
|
272
|
+
# provider-agnostic: it runs on every Linux host the SDK is bootstrapped on.
|
|
273
|
+
# Best-effort — `job run --studio` still starts, and the proxy logs an
|
|
274
|
+
# actionable error at startup if 443 turns out not to be bindable.
|
|
275
|
+
PIXI_PY="$(readlink -f "${OMICSLAB_HOME}/.pixi/envs/default/bin/python" 2>/dev/null || true)"
|
|
276
|
+
if [ ! -x "${PIXI_PY}" ]; then
|
|
277
|
+
PIXI_PY="$("${PIXI_BIN}" run python -c 'import sys; print(sys.executable)' 2>/dev/null | tail -n1)"
|
|
278
|
+
PIXI_PY="$(readlink -f "${PIXI_PY}" 2>/dev/null || true)"
|
|
279
|
+
fi
|
|
280
|
+
if [ -z "${PIXI_PY}" ] || [ ! -x "${PIXI_PY}" ]; then
|
|
281
|
+
echo "WARNING: could not locate the pixi python; studio proxy may be unable to bind 443"
|
|
282
|
+
else
|
|
283
|
+
SUDO_CAP=""
|
|
284
|
+
if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then
|
|
285
|
+
SUDO_CAP="sudo -n"
|
|
286
|
+
fi
|
|
287
|
+
if ! command -v setcap >/dev/null 2>&1 && command -v apt-get >/dev/null 2>&1; then
|
|
288
|
+
$SUDO_CAP apt-get update -qq >/dev/null 2>&1 || true
|
|
289
|
+
$SUDO_CAP apt-get install -y -qq libcap2-bin >/dev/null 2>&1 || true
|
|
290
|
+
fi
|
|
291
|
+
if command -v setcap >/dev/null 2>&1 && \
|
|
292
|
+
$SUDO_CAP setcap cap_net_bind_service=+ep "${PIXI_PY}" 2>/dev/null; then
|
|
293
|
+
echo "Granted CAP_NET_BIND_SERVICE to ${PIXI_PY}"
|
|
294
|
+
elif $SUDO_CAP sysctl -w net.ipv4.ip_unprivileged_port_start=0 >/dev/null 2>&1; then
|
|
295
|
+
echo "net.ipv4.ip_unprivileged_port_start=0" | \
|
|
296
|
+
$SUDO_CAP tee /etc/sysctl.d/99-omicslab-studio.conf >/dev/null 2>&1 || true
|
|
297
|
+
echo "Lowered net.ipv4.ip_unprivileged_port_start to 0"
|
|
298
|
+
else
|
|
299
|
+
echo "WARNING: could not enable binding port 443; direct studio access may be unavailable"
|
|
300
|
+
fi
|
|
301
|
+
fi
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.8.0"
|