> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scitix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Orchestrating Training Workflows with Workflows

> Create and manage workflows in Siverse, orchestrating multiple training or inference nodes into a pipeline based on their dependencies.

Workflows are used to orchestrate multiple task nodes into a process, making them suitable for scenarios that require chaining multiple training, processing, or inference steps based on dependencies.

## Create Workflow

### 1. Go to the creation page

1. Go to **Training > Workflows**.
2. Click **Create** and select **Create with Form** or **Create with Code**.

   * **Form Creation**: Suitable for dragging nodes, configuring dependencies, and entering node parameters one by one in the console.
   * **Code Creation**: Suitable for scenarios where you already have a DAG configuration, need to reuse templates, or want to maintain workflow definitions uniformly through JSON/YAML.

### 2. Enter Basic information

| Configuration Item | Description |
| - | - |
| **Workflow Name** | The name of the Workflow, used to identify the workflow in the list, details, and run records. |
| **Description** | A description of the Workflow's purpose. Specify the data processed by the workflow and the training or inference stage. |
| **Custom Output Path** | The matching path for Workflow output files. For example, `/etc/output/*/result.json`, used to collect node output results. |
| **Enable Global Variables** | When enabled, global variables can be used within the Workflow, allowing multiple nodes to reuse the same set of parameters. |
| **Enable Scheduled Tasks** | When enabled, the Workflow can be triggered on a schedule, making it suitable for periodic data processing, training, or evaluation workflows. |

### 3. Configure DAG

**Create by Form**

![Workflow DAG form orchestration canvas](https://mintcdn.com/scitix-adfc65c2/ZqwdmfntBUDyGPkJ/siverse/training/media/workflow-dag-form-editor.png?fit=max\&auto=format\&n=ZqwdmfntBUDyGPkJ\&q=85\&s=b249c496de1e8a32898701929ce22ba2)

1. In the **DAG** area, drag nodes from the node list on the left to the canvas. **SF Job Node** and **SF Inference Node** are currently supported.

2. Connect the nodes in workflow order, or click **Auto Layout** to arrange the canvas.

3. Click the node's edit button to open **Node Configuration**.

4. Configure upstream dependencies on the **Predecessor Node Dependencies** tab.

5. Configure the basic node information on the **Common Fields** tab.

   | Configuration Item | Description |
   | - | - |
   | **Node Name** | The unique name of the node in the DAG configuration, corresponding to `name` when created in code. |
   | **Display Name** | The display name of the node on the canvas. |
   | **Node Type** | The current node type, such as `sfjob`. |
   | **Service Mode** | Controls whether the node runs in service mode. |
   | **Retry Count** | The number of retries after the node fails. |
   | **Timeout (Seconds)** | The maximum time the node is allowed to run. Any excess is handled as a timeout. |
   | **Labels** | Add labels to the node to distinguish its stage or purpose. |
   | **Environment Variables** | Add runtime environment variables for the current node. |
   | **Input Parameters** | Define the parameters that the current node needs to read. |
   | **Output Parameters** | Define the parameters produced by the current node, which can be referenced by downstream nodes. |

6. On the **Load Parameters** tab, configure the job or inference workload parameters to be run by the node.

   * **SF Job Node**: Configurations for the image, resources, Volume, dataset, model, startup command, and more are generally consistent with those for Training. For details, see [Create a Training Task](/siverse/training/create-training-tasks.md).
   * **SF Inference Node**: Configurations for the resource pool, inference engine, model, cache, service, and monitoring are generally consistent with those for creating an LLM inference service. For details, see [Create an LLM Inference Service](/siverse/inference/create-llm-inference-services.md).

7. Click **Save**.

8. Verify that the nodes and dependencies on the canvas meet expectations.

**Create with Code**

1. In **Code Format**, select **JSON** or **YAML**.
2. In the **Dag** editor, enter or paste the node orchestration configuration.
3. In the **Steps** editor, enter or paste the node execution configuration.
4. Ensure that the configuration can represent the expected nodes, dependencies, and execution conditions.

**DAG Configuration Structure**

The **Dag** configuration describes the node orchestration, dependencies, and execution conditions of a workflow.

| Field | Description |
| - | - |
| `tasks` | List of node orchestration configurations in the workflow. |
| `name` | Node name, which must correspond to the node name in the Steps configuration. |
| `template` | The template or node type used by the node. For example, an SF job node can use `sfjob`. |
| `depends` | Dependencies on preceding nodes. You can reference upstream nodes and their statuses, for example, `data-preprocess.Success`. |
| `when` | Node execution condition. You can reference output parameters from upstream nodes, for example, `{{tasks.data-preprocess.outputs.parameters.next-step}} == training-1`. |

DAG structure example:

```yaml theme={null}
tasks:
  - name: data-preprocess
    template: sfjob
  - name: train-model
    template: sfjob
    depends: data-preprocess.Success
    when: "{{tasks.data-preprocess.outputs.parameters.next-step}} == training"
```

**Steps Configure Structure**

The **Steps** configuration describes each node’s runtime parameters, display information, inputs and outputs, and workload configuration.

| Field | Description |
| - | - |
| `type` | Node type. For example, an SF job node can use `sfjob`. |
| `name` | Node name. This must correspond to the node name in the Dag configuration. |
| `outputs.parameters` | Node output parameters. You can use `valueFrom.path` to read parameter values from files generated during node execution. |
| `inputs` | Node input parameters. |
| `displayName` | Display name of the node. |
| `labels` | Node labels. |
| `retries` | Number of retries after the node fails. |
| `timeoutSeconds` | Node timeout period, in seconds. |
| `env` | Node environment variables. |
| `spec` | Node workload configuration. The specific structure depends on the node type. |

Steps structure example:

```yaml theme={null}
- type: sfjob
  name: data-preprocess
  displayName: Data preprocessing
  retries: 1
  timeoutSeconds: 3600
  outputs:
    parameters:
      - name: next-step
        valueFrom:
          path: /etc/output/data-preprocess/result.json
  env:
    - name: STAGE
      value: preprocess
  spec:
    # Configure node load parameters by node type.
    # For SF job nodes, see Create Training Tasks; for SF inference nodes, see Create an LLM Inference Service.
```

### 4. Submit Creation

Click **Create** to submit the workflow. After submission, view the workflow status in the Workflows list or details.

When creating a Workflow, focus on verifying that node dependencies and execution conditions meet the expected workflow requirements. The node configuration must also meet the configuration requirements for the corresponding Training or Inference service.

## View and manage workflows

After navigating to **Training > Workflows**, you can find workflows using the filters provided on the page. When viewing a workflow, focus on:

* The current workflow status and execution progress.
* Which nodes are running, have failed, or are waiting for upstream nodes.
* Whether a node failure is caused by task configuration, resource scheduling, an image, mounting, a command, or upstream dependencies.
* Whether the workflow needs to be rerun or a specific training job needs to be investigated separately.

If the Workflow does not run as expected, first verify the dependencies and failed nodes, then go to the corresponding training task details page to view events, logs, and monitoring.

## Related Documentation

* [Create Training](/siverse/training/create-training-tasks.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.