Aller au contenu principal
This page is not translated yet. Français is switched on so the navigation and URLs can be tested; the text below is the English original. Use the language selector in the header to switch back, or see the documentation home.

Submit your first workflow

Build a minimal workflow, submit it, and poll until it finishes. This tutorial takes about 10 minutes and uses only the REST API.

What you will learn​

  • How to authenticate requests
  • How to define a workflow as a DAG of nodes
  • How to submit the workflow and read its run status

Prerequisites​

  • An API token. See Authenticate.
  • curl and jq installed locally
  • Your token exported as RESCALE_TOKEN

1. Define the workflow​

Save this as workflow.json. It describes a single-node DAG that runs a short command.

{
"name": "hello-world",
"description": "Prints hello and exits",
"nodes": [
{
"id": "run-hello",
"type": "job",
"data": {
"command": "echo hello from rescale"
}
}
],
"edges": []
}

2. Create the workflow​

curl -sS -X POST \
-H "Authorization: Token $RESCALE_TOKEN" \
-H "Content-Type: application/json" \
-d @workflow.json \
https://platform.rescale.com/api/v3/workflows/ | tee workflow.created.json

The response includes a workflowId. Extract it for the next step:

WORKFLOW_ID=$(jq -r .workflowId workflow.created.json)

3. Submit the workflow​

Submitting creates a workflow run.

curl -sS -X POST \
-H "Authorization: Token $RESCALE_TOKEN" \
"https://platform.rescale.com/api/v3/workflows/$WORKFLOW_ID/submit/" | tee run.submitted.json

RUN_ID=$(jq -r .workflowRunId run.submitted.json)

4. Poll the run​

while true; do
STATUS=$(curl -sS \
-H "Authorization: Token $RESCALE_TOKEN" \
"https://platform.rescale.com/api/v3/workflow-runs/$RUN_ID/" | jq -r .status)
echo "status=$STATUS"
case "$STATUS" in
completed|failed|stopped) break ;;
esac
sleep 10
done

Verify it worked​

The loop ends with status=completed. You can also open the run in the platform UI at https://platform.rescale.com/workflows/runs/$RUN_ID to see node-level logs.

Next steps​