diff --git a/docs/demos/index.md b/docs/demos/index.md index 7bed7c9..bb07741 100644 --- a/docs/demos/index.md +++ b/docs/demos/index.md @@ -24,6 +24,7 @@ Each demo has one of these states: | Demo | Status | What it shows | Instructions | |---|---|---|---| +| [End to end across Nodes](../researchers/tutorial-end-to-end.md) | Current | The whole chain on the live services of the deployment: tasks through proTES to the TESK and Poiesis services of the FI and CZ Nodes, Nextflow and WDL workflows on Conquest, which sends their tasks through proTES, and a federated learning run from Krini, with an LS Login token from Krini. Needs compute access. Ran end to end on 2026-12-02 ([generic-issues#44][gi-44]). | [Tutorial: End to End Across Nodes](../researchers/tutorial-end-to-end.md) | | [Token exchange testbed][repo-txf] | Current | Per-hop OAuth 2.0 token exchange with LS Login along a chain of services, from a front end through a WES and the proTES gateway to TES nodes. Runs on your computer against a local mock of LS Login. | [Token Exchange Testbed](token-exchange-testbed.md) | | [NVFlare on WES and TES testbed][repo-nvflare] | Current | A federated learning job with NVIDIA FLARE, started through GA4GH WES, with one GA4GH TES task per site, directly or through proTES. Runs on your computer with two local Funnel instances and synthetic data; on 2026-11-24, it ran over the TESK of the FI and CZ Nodes, with LS Login tokens (see its [report][nvflare-report]). [Release 0.1.0][nvflare-release]. | [NVFlare Testbed](nvflare-wes-testbed.md) | | [Federated analytics][repo-fa] (`elixir-cloud-demos`) | Current | The same analysis at two Nodes as GA4GH TES tasks, directly or through proTES; only aggregates leave the Nodes. Runs on your computer with `--local`, or against your own TES services. | [Demo README][repo-fa] | @@ -42,6 +43,11 @@ repository: `token-exchange-flow-testbed` at `df1f023`, ## Testbeds and demos +The tutorial [End to End Across Nodes](../researchers/tutorial-end-to-end.md) +is the one demo that runs on the live services of the deployment, not +in a repository of its own: you need an LS Login account with compute +access, and the services have no guaranteed uptime. + The two testbeds are not demos of the deployment: their quick starts run everything on your computer, with stand-ins for real sites and services, and they say plainly what they have and haven't shown. They are the quickest way @@ -99,6 +105,7 @@ Propose a new demo, or report one that no longer works, in the [Discussions][elixir-on-cloud-forum] or in the [issues of this repository](https://github.com/elixir-cloud-aai/docs/issues). +[gi-44]: [docs-sdk]: [sdk-release]: [nvflare-release]: diff --git a/docs/researchers/index.md b/docs/researchers/index.md index 3a69c2f..0e52b96 100644 --- a/docs/researchers/index.md +++ b/docs/researchers/index.md @@ -19,6 +19,7 @@ ELIXIR Nodes, and keep sensitive data under the control of its owner. | [Tutorial: Your First Run in Krini](tutorial-krini.md) | Log in to Krini, run a task and a workflow on demo data, and read the results, step by step. For now, the task part only. | A web browser, an LS Login account, and compute access. | | [Tutorial: Your First Run from the Command Line](tutorial-cli.md) | Install `ga4gh-cli`, find services, log in with a token, run a task and a workflow on demo data, and read the results, step by step. | Git and Rust on your computer, an LS Login account, and access to a TES and a WES service. | | [Tutorial: Federated Learning with NVFlare](tutorial-federated-learning.md) | Train a model at the FI and CZ Nodes with NVIDIA FLARE, from your terminal, through the NVFlare hub's WES, step by step. Synthetic data only. | Python or `ga4gh-cli`, an LS Login account, and compute access. | +| [Tutorial: End to End Across Nodes](tutorial-end-to-end.md) | Run tasks at the TESK and Poiesis services of two Nodes through proTES, a Nextflow and a WDL workflow on Conquest, and a federated learning run from Krini, all on the live services, with `curl` and `ga4gh-cli`, step by step. | `curl`, `jq` and `ga4gh-cli`, a web browser, an LS Login account, and compute access. | | [Run Workflows Across Nodes](federated-workflows.md) | Run a Snakemake workflow on the TES services of several Nodes, through the proTES gateway. | A Python environment on your computer, and access to proTES or other TES services. | | [Sensitive Data in a Secure Processing Environment](spe-with-weskit.md) | Run workflows on sensitive data that you never see, and read the results. | An LS Login account and permission from the operator of the environment. | | [Crypt4GH with proTES](crypt4gh-with-protes.md) | Process Crypt4GH-encrypted files in a secure container. Needs an unreleased proTES branch until the Crypt4GH plugin for current proTES is released. | Docker and three virtual machines. | diff --git a/docs/researchers/tutorial-end-to-end.md b/docs/researchers/tutorial-end-to-end.md new file mode 100644 index 0000000..79f3aa9 --- /dev/null +++ b/docs/researchers/tutorial-end-to-end.md @@ -0,0 +1,440 @@ +--- +last_verified: 2026-12-02 +--- + +# Tutorial: End to End Across Nodes + +## Synopsis + +This tutorial is for researchers who want to see the whole of ELIXIR +On-Cloud at work, on the live services, from their own terminal. You log in +with LS Login, run jobs at two ELIXIR Nodes, Finland (FI, at CSC) and the +Czech Republic (CZ, at CERIT-SC), and check where they ran and what they +returned: + +- **Part 1: tasks.** Small [GA4GH TES][ga4gh-tes] tasks, sent to the TES + gateway of the deployment, [proTES](../operators/services/protes.md): + one pinned to each of the four TES services behind it (TESK and Poiesis, + at each Node), and one that proTES places itself. +- **Part 2: workflows.** A Nextflow and a WDL workflow, sent to the + [GA4GH WES][ga4gh-wes] service Conquest, at the CZ Node. Conquest sends + the tasks of each workflow through proTES to the Nodes. +- **Part 3: federated learning.** A federated learning run, started from + the web portal Krini, which trains a model at sites at both Nodes. + +You use both `curl` and `ga4gh-cli`, the command line tool of the [GA4GH +SDK](https://github.com/ga4gh/ga4gh-sdk), so that you see the plain API +requests as well as the tool. Each job is a "hello world": it needs no data +of yours and takes a minute or two. The whole tutorial takes about 30 +minutes. The commands are for Bash or Zsh on Linux or macOS. + +```text +you (curl, ga4gh-cli) + |-- part 2 --> Conquest (WES, CZ) --. + | v + '-- part 1 -----------------> proTES (TES gateway) --> TESK FI Poiesis FI + --> TESK CZ Poiesis CZ +Krini (browser) -- part 3 --> NVFlare hub (WES) --> proTES --> sites at FI and CZ +``` + +!!! warning "Synthetic or public data only" + The deployment is a sandbox for demos and tests, with no guaranteed + uptime. The jobs of this tutorial use public images and workflows only; + don't use the services with personal or other sensitive data. + +## 1. Before you start + +You need: + +- **An LS Login account,** and **membership of the LS Login group + `ECP_CLN:EOC-Compute`.** Only members can run jobs on the compute + services; others get `403 Forbidden`. See [Apply for compute + access](index.md#apply-for-compute-access). +- **A web browser,** to get your token from Krini (step 3) and for part 3. +- **`curl` and [`jq`](https://jqlang.org/).** +- **`ga4gh-cli` 0.1.0.** See step 2 of [Tutorial: Your First Run from the + Command Line](tutorial-cli.md#2-install-the-cli), or + [Install](cli.md#install). + +Create an empty folder for the files of this tutorial, and work in it until +the end: + +```bash +mkdir eoc-end-to-end +cd eoc-end-to-end +``` + +`mkdir` stops with `File exists` if the folder is already there: then +choose another name. + +## 2. Check the services + +The two entry points of the chain are proTES, for tasks, and Conquest, for +workflows. Put their API roots into variables, and ask both for their +service info, which anyone can read without a token: + +```bash +TES=https://gateway-tes.elixir-on.cloud/ga4gh/tes/v1 +WES=https://conquest.dyn.cloud.e-infra.cz/ga4gh/wes/v1 +curl -sS "$TES/service-info" > protes-service-info.json +jq -r '.name, .version, (.backends[].url)' protes-service-info.json +curl -sS "$WES/service-info" | jq '.name, .workflow_type_versions' +``` + +**Check:** proTES names itself and lists the four TES services that it +forwards tasks to, under `backends`: + +```text +ELIXIR On-Cloud TES Gateway +0.8.0 +https://tesk.rahtiapp.fi +https://tesk.dyn.cloud.e-infra.cz +https://poiesis.rahtiapp.fi +https://poiesis.dyn.cloud.e-infra.cz +``` + +These are the TESK and the Poiesis of the FI Node, at CSC +(`*.rahtiapp.fi`), and of the CZ Node, at CERIT-SC +(`*.dyn.cloud.e-infra.cz`). Conquest answers with its name, `Conquest`, +and the workflow languages that it runs: Nextflow (`NFL`), Snakemake +(`SMK`) and `WDL`, each with its versions. The version of proTES and the +list change over time; the steps below read the list from the file. + +Both services refuse requests without a token: + +```bash +curl -sS -o /dev/null -w '%{http_code}\n' "$TES/tasks" +curl -sS -o /dev/null -w '%{http_code}\n' "$WES/runs" +``` + +**Check:** both print `401`. + +## 3. Get your token + +proTES and Conquest accept LS Login access tokens that LS Login issued to +Krini, the web portal of the deployment: + +1. Open and log in with LS Login. +2. Select **Copy access token** in the menu at the bottom of the sidebar + (see [Copy your access token](krini.md#copy-your-access-token)). +3. Put the token into a variable in your terminal. It isn't shown and + isn't saved in the history of the shell: + + ```bash + read -rs LS_LOGIN_TOKEN # paste the token, then press Enter + export LS_LOGIN_TOKEN + ``` + +The `curl` commands below send the token in a header that they read from a +small function, so that it doesn't show in the list of processes of your +computer: + +```bash +auth() { printf 'Authorization: Bearer %s\n' "$LS_LOGIN_TOKEN"; } +curl -sS -o /dev/null -w '%{http_code}\n' -H @<(auth) "$TES/tasks" +curl -sS -o /dev/null -w '%{http_code}\n' -H @<(auth) "$WES/runs" +``` + +**Check:** both print `200`. `401` means that the token expired or wasn't +copied whole: copy a new one. `403` means that your account isn't a member +of `ECP_CLN:EOC-Compute` yet, or that you were approved after you logged in +to Krini: log out of Krini, log in again and copy a new token. + +The token is valid for about an hour. When a service answers `401` later +on, copy a new token from Krini and repeat step 3. + +!!! warning "Keep your token to yourself" + Anyone with your token can act as you at the services until it + expires. Don't share it, and don't paste it into chats, issues or files. + +## 4. Point the CLI at proTES and Conquest + +`ga4gh-cli` reads the addresses of the services from +`~/.ga4gh-cli/config.json` (see [Configure](cli.md#configure)). Create it +with proTES as the TES service and Conquest as the WES service. The command +doesn't change a file that already exists; in that case, set the `TES` and +`WES` sections in a text editor instead, or add them as a profile of their +own (see [Use several deployments with +profiles](cli.md#use-several-deployments-with-profiles)). + +```bash +mkdir -p ~/.ga4gh-cli +[ -e ~/.ga4gh-cli/config.json ] || printf '%s\n' '{ + "TES": { + "base_path": "https://gateway-tes.elixir-on.cloud/ga4gh/tes/v1", + "oauth_access_token_env": "LS_LOGIN_TOKEN" + }, + "WES": { + "base_path": "https://conquest.dyn.cloud.e-infra.cz/ga4gh/wes/v1", + "oauth_access_token_env": "LS_LOGIN_TOKEN" + } +}' > ~/.ga4gh-cli/config.json +chmod 600 ~/.ga4gh-cli/config.json +``` + +`oauth_access_token_env` tells the CLI to send the token in the variable +`LS_LOGIN_TOKEN`; the file holds no token. + +**Check:** both lists answer, with your jobs or none: + +```bash +ga4gh-cli tes list +ga4gh-cli wes list +``` + +## Part 1: Run tasks at both Nodes + +Each task runs one command in a small public container image (Alpine +Linux): it says hello and prints the date. proTES forwards it to one of +its TES services. By default, proTES chooses; with the tag +`gateway.backends`, you choose (see [Pinning tasks to a TES +instance](https://protes.readthedocs.io/en/v0.8.0/plugins/#pinning-tasks-to-a-tes-instance) +in the proTES docs). + +### 5. Pin one task to each TES service + +Write one task per TES service that proTES lists, each pinned to its +service with `gateway.backends` of type `allow`, and send it with `curl`. +The loop writes the pin and the ID of each task into `tasks.tsv`: + +```bash +: > tasks.tsv +for tes in $(jq -r '.backends[].url' protes-service-info.json); do + jq -n --arg tes "$tes" '{ + name: "hello-pinned", + resources: {cpu_cores: 1}, + tags: {"gateway.backends": ({type: "allow", backends: [$tes]} | tojson)}, + executors: [{ + image: "alpine:3.22", + command: ["sh", "-c", "echo Hello from ELIXIR On-Cloud; date -u"] + }] + }' > task.json + id=$(curl -sS -H @<(auth) -H 'Content-Type: application/json' \ + --data-binary @task.json "$TES/tasks" | jq -r '.id // empty') + echo "$tes ${id:-no task ID}" + printf '%s\t%s\n' "$tes" "$id" >> tasks.tsv +done +``` + +**Check:** one line per TES service, each with the ID of a new task. If a +line says `no task ID`, send that request again without `| jq ...` to see +the answer of proTES: `401` and `403` as in step 3; `503` if that TES +service doesn't answer at the moment. + +### 6. Let proTES choose + +Send one more task without a pin, this time with the CLI (see [Create a +task](cli.md#create-a-task)): + +```bash +jq '.name = "hello-unpinned" | del(.tags)' task.json > task-unpinned.json +id=$(ga4gh-cli tes create task-unpinned.json) +echo "${id:?no task ID}" +printf '%s\t%s\n' "any" "$id" >> tasks.tsv +``` + +**Check:** the CLI prints the ID of the new task. If it ends with an +error, see [Check for errors](cli.md#check-for-errors). + +### 7. Check where the tasks ran + +Ask proTES for each task, with the view `BASIC`, which includes the tags. +proTES records the TES service that ran a task in the tag +`gateway.backend`: + +```bash +while IFS=$'\t' read -r pin id; do + curl -sS -H @<(auth) "$TES/tasks/$id?view=BASIC" | + jq -r --arg pin "$pin" '[.state, "pinned to: " + $pin, "ran at: " + (.tags["gateway.backend"] // "-")] | @tsv' +done < tasks.tsv +``` + +Tasks first wait in `QUEUED` and `INITIALIZING` until the TES service has +resources; repeat the command until all are `COMPLETE`, usually within a +minute or two. + +**Result:** every task is `COMPLETE`, and every pinned task ran where you +pinned it, at both Nodes; the unpinned one ran at one of the four: + +```text +COMPLETE pinned to: https://tesk.rahtiapp.fi ran at: https://tesk.rahtiapp.fi +COMPLETE pinned to: https://tesk.dyn.cloud.e-infra.cz ran at: https://tesk.dyn.cloud.e-infra.cz +COMPLETE pinned to: https://poiesis.rahtiapp.fi ran at: https://poiesis.rahtiapp.fi +COMPLETE pinned to: https://poiesis.dyn.cloud.e-infra.cz ran at: https://poiesis.dyn.cloud.e-infra.cz +COMPLETE pinned to: any ran at: https://poiesis.dyn.cloud.e-infra.cz +``` + +The columns are separated by tabs, so they may not line up as here. + +To read what a task printed, get it with its logs (see [Get a +task](cli.md#get-a-task)), with the ID of one of your tasks in `ID`: + +```bash +ga4gh-cli tes get "$ID" FULL | jq -r '.logs[-1].logs[0].stdout' +``` + +The output is the greeting and the date. Some TES services return no +standard output in the logs; then the result is `null`. If a task ends in +`EXECUTOR_ERROR` or `SYSTEM_ERROR`, `jq '.logs'` instead shows what the +service reported. + +## Part 2: Run workflows + +Conquest runs workflows from public GitHub repositories, at a full commit +(`revision` in the engine parameters). It sends the tasks of each workflow +through proTES to the Nodes. These tasks belong to Conquest, not to you, so +they don't show in your task list; you follow the workflow run instead. +The two workflows here are the Nextflow and the WDL examples of Krini (see +[Run a workflow](krini.md#run-a-workflow)). + +### 8. Start a Nextflow workflow with the CLI + +[nextflow-io/hello](https://github.com/nextflow-io/hello) runs one process +that says hello in four languages, as four tasks (see [Start a +run](cli.md#start-a-run)): + +```bash +NFL_RUN=$(ga4gh-cli wes run https://github.com/nextflow-io/hello \ + --type NFL --type_version DSL2 \ + --engine nextflow --engine_version 24.10.4 \ + --engine_parameter revision=3c2cdc9823c2b4636e5e3e73e223878099ff5dc9) +echo "${NFL_RUN:?no run ID}" +``` + +**Check:** the CLI prints the ID of the new run. Conquest may take a +moment to answer. + +### 9. Start a WDL workflow with curl + +[openwdl/learn-wdl](https://github.com/openwdl/learn-wdl) has a workflow +with one task, which greets the name that it gets as its input. A WES run +request is a form (`multipart/form-data`); `--form-string` sends each +value as it is: + +```bash +WDL_RUN=$(curl -sS -H @<(auth) \ + --form-string workflow_url=https://github.com/openwdl/learn-wdl \ + --form-string workflow_type=WDL \ + --form-string workflow_type_version=1.0 \ + --form-string workflow_engine=wdl \ + --form-string workflow_engine_version=1.12.1 \ + --form-string 'workflow_params={"HelloInput.name": "ELIXIR On-Cloud"}' \ + --form-string 'workflow_engine_parameters={"revision": "b219e5b5b8d79d2cf940f6f3a614d1eb9501866c", "main_workflow_path": "1_script_examples/1_hello_worlds/4_hello_input_workflow/input-workflow.wdl"}' \ + "$WES/runs" | jq -r '.run_id // empty') +echo "${WDL_RUN:?no run ID}" +``` + +**Check:** `curl` prints the ID of the new run. If not, send the request +again without `| jq ...` to see the answer of Conquest. + +### 10. Follow the runs and check the results + +Ask for the state of both runs, once with the CLI and once with `curl`, +until both are `COMPLETE` (see [Follow a run](cli.md#follow-a-run)). The +Nextflow run takes about two minutes, the WDL run about one: + +```bash +ga4gh-cli wes status "$NFL_RUN" +curl -sS -H @<(auth) "$WES/runs/$WDL_RUN/status" | jq -r .state +``` + +Then get each run with its log and outputs: + +```bash +ga4gh-cli wes get "$NFL_RUN" | jq '{state, run_log, outputs}' +curl -sS -H @<(auth) "$WES/runs/$WDL_RUN" | jq '{state, run_log, outputs}' +``` + +**Result:** `state` is `COMPLETE` for both; `run_log` holds the log of +the workflow engine, with the start and end times of the run, and +`outputs` lists what the workflow wrote, if anything. If a run ends in +`EXECUTOR_ERROR` or `SYSTEM_ERROR`, `run_log` and the logs of its tasks +(`task_logs`, or `task_logs_url`) say why. Conquest keeps the files of a run +for a limited time only, and deletes them afterwards. + +## Part 3: Federated learning from Krini + +In federated learning, each site trains a model on its own data, and only +the model updates leave the sites. The NVFlare hub of ELIXIR On-Cloud is a +WES service that runs such jobs with [NVIDIA +FLARE](https://github.com/NVIDIA/NVFlare): it runs the server of the job +itself, and starts one learning client per site as a TES task, through +proTES, at the TES services of the FI and CZ Nodes. The data of the sites +is synthetic. This part runs a job in your browser; [Tutorial: Federated +Learning with NVFlare](tutorial-federated-learning.md) runs it from your +terminal and explains what happens under the hood. + +### 11. Start the run + +1. In Krini, at , open **Workflows** and + select **Create Workflow**. +2. In **Select WES Instance**, choose the NVFlare hub (`nvflare-wes`). +3. Next to **Use an example**, select **Federated learning**. Krini fills + in the form: the workflow type `NVFLARE`, version `2.9`, the name of a + job of the hub as the workflow URL, and the sites of the hub as the + parameters. +4. Select **Submit Run**. Krini shows the ID of the run. + +The hub runs one run at a time, for all users: if someone else's run is +active, yours is refused with `409`. Try again a few minutes later. + +### 12. Follow the run and read the result + +**Workflows** lists your runs on the hub. Wait until the run is `COMPLETE`, +which takes about two minutes, then select **View Details** and open +**Outputs**. + +**Result:** `flare_job_status` is `FINISHED:COMPLETED`, and +`global_model` names the path of the trained model at the hub. You can't +download the model yet (see [Limits](tutorial-federated-learning.md#limits) +of the federated learning tutorial). + +## 13. Clean up + +All jobs end on their own. Remove the token from your terminal, and the +files of this tutorial and their folder: + +```bash +unset LS_LOGIN_TOKEN +unset -f auth +rm protes-service-info.json task.json task-unpinned.json tasks.tsv +cd .. +rmdir eoc-end-to-end +``` + +`rmdir` removes only an empty folder, so it keeps any other file that you +saved there. The configuration file of the CLI holds no token, so you can +keep it for next time. Log out of Krini if you share your computer. + +## Where to go next + +- Your first task and workflow, step by step, in the browser: [Tutorial: + Your First Run in Krini](tutorial-krini.md); from the terminal, with a + workflow of your own: [Tutorial: Your First Run from the Command + Line](tutorial-cli.md). +- All commands and options of the CLI: [Use the Command Line](cli.md). +- Federated learning in depth: [Tutorial: Federated Learning with + NVFlare](tutorial-federated-learning.md). +- A Snakemake workflow whose tasks you send through proTES yourself: [Run + Workflows Across Nodes](federated-workflows.md). +- How proTES routes tasks, and which tags it sets: the [proTES + docs](https://protes.readthedocs.io/en/v0.8.0/). + +## How this tutorial was tested + +The steps follow the end-to-end check of the deployment on 2 December 2026 +([generic-issues#44](https://github.com/elixir-cloud-aai/generic-issues/issues/44)), +which sent the same requests with `curl` and `ga4gh-cli` 0.1.0, with LS +Login access tokens from Krini: a task pinned to each of the four TES +services through proTES, each of which ran at its pin, two unpinned tasks +(with `curl` and the CLI), the Nextflow run with the CLI and the WDL run +with `curl` on Conquest, all `COMPLETE`; an account that isn't a member of +`ECP_CLN:EOC-Compute` got `403`, and requests without a token `401`. The +federated learning run from Krini completed on the same day +([krini#133](https://github.com/elixir-cloud-aai/krini/issues/133)), with +the example of that day. The service info and the `401` answers of step 2 +were checked again when this page was written. The commands on this page, +as written here, have not yet been run by someone who didn't write them. If +you follow this tutorial, please tell us what didn't work: in the +[Discussions][elixir-on-cloud-forum] or in an issue in the [docs +repository](https://github.com/elixir-cloud-aai/docs/issues). diff --git a/mkdocs.yml b/mkdocs.yml index b280301..bbd2d0f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -132,6 +132,7 @@ nav: - "Tutorial: Your First Run in Krini": "researchers/tutorial-krini.md" - "Tutorial: Your First Run from the Command Line": "researchers/tutorial-cli.md" - "Tutorial: Federated Learning with NVFlare": "researchers/tutorial-federated-learning.md" + - "Tutorial: End to End Across Nodes": "researchers/tutorial-end-to-end.md" - "Use Krini": "researchers/krini.md" - "Use the Command Line": "researchers/cli.md" - "Run Workflows Across Nodes": "researchers/federated-workflows.md"