Skip to main content

Run your first workflow

In this tutorial you write a workflow that runs the task definition from the previous tutorial, start a run of it, and read what the task printed.

What you will accomplish​

By the end of this tutorial you will have:

  • A workflow named Echo workflow in your project
  • A run of it that ended Complete
  • The task's log, showing the message the workflow gave it

Before you begin​

Steps​

1. Write the workflow file​

Create a file called my-workflow.yaml with the following content:

name: Echo workflow
compute_type: cpu-2

blocks:
main:
tasks:
echo:
name: Echo
uses: my-account/my-echo-[email protected]
args:
message: Hello from my first workflow!

Replace my-account with your account name.

  • name is the name the platform shows for the workflow.
  • compute_type is the compute each task is allocated. cpu-2, two vCPUs, is plenty for this task.
  • blocks holds the workflow's tasks. A run starts in the block named main.
  • echo is the task's key, and name the name its run shows for it.
  • uses names the task definition and version the task runs, and args gives its message input a value.

2. Upload the workflow​

swale workflow create \
--project-name my-first-project \
--file my-workflow.yaml

The platform checks the file as it uploads it: an unknown field, or a uses that names a task definition your account cannot use, fails the upload with an error that names the problem. On success the command prints the new workflow's ID, as Workflow created: <workflow-id>. Copy the ID: the next steps need it.

3. Start a run​

swale workflow run start \
--project-name my-first-project \
--workflow-id <workflow-id>

Replace <workflow-id> with the ID from step 2. The command prints Workflow run started. Run ID: followed by the new run's ID.

4. Watch the run​

  1. In the platform UI, open Projects from the sidebar and click my-first-project.
  2. In the sidebar, click Workflows, then click Echo workflow.
  3. Click the run in the workflow's list of runs.

The run's page shows its status and its Workflow Graph, where the Echo task moves from Pending through Starting and Running to Complete. The run itself then shows Finishing while its resources are released, and ends Complete. The page updates as the run moves, with no reload.

5. Read the task's log​

Click the Echo task in the Workflow Graph. Its Task Details page opens, and its Logs card shows the line the task printed:

Hello from my first workflow!

If the run does not start​

  • The start is refused with a billing or email error. Starting a run needs a verified email and an Active billing status; see Billing statuses.
  • The start is refused with an error about runs in progress. The account is at its limit on runs in progress; see Runs in progress.
  • The task fails. Its failure reason is on its Task Details page, and the first entry of its log says what the platform resolved for it.

Permissions and restrictions lists what every operation requires.

Next steps​