# YAML Syntax Description

## Related Concepts

Job is the basic unit of the Action workflow. A [DAG](https://en.wikipedia.org/wiki/Directed_acyclic_graph) is generated by defining multiple jobs and setting the dependencies of the jobs. The TensorBay workflow engine can automate tasks by executing DAGs. Set the following YAML file as an example.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhWjgr7_236wXVdQhav%2F-MhX2C_dhXqrINAy7JAy%2Fpasted%20image%200.png?alt=media\&token=32a509c3-f46a-48db-aed1-89b5408a2e76)

1. &#x20;\[tasks]: Define all the jobs under this workflow.
2. &#x20;\[tasks.hello-world]: Defines a task, with the name "hello-world".
3. &#x20;\[tasks.hello-world.container]: This job is executed under the docker container.
4. \[tasks.hello-world.container.image]: The image used by the docker container is alpine:latest.
5. &#x20;\[tasks.hello-world.container.command]: The command executed in the docker container is 991\`called echo.
6. \[tasks.hello-world.container.args]: The argument to echo is "hello world".

## Runtime Environment of Job

Job supports the following three runtime environments. Each job has only one runtime environment.

**1. Container**

In this environment you can use a specified image to generate a container and execute it.The job content will be defined by the image.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-Mhll0skw2BgvPESiKsp%2F-MhllnSpT7CfaGvCjdAe%2Fpasted%20image%200%20\(1\).png?alt=media\&token=bcd8399e-b7e2-401b-b8dc-66998ca3e006)

**2. Script**

In this environment, a specified script wil be excuted in the docker container.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhWjgr7_236wXVdQhav%2F-MhX2Uj-DskoLHQtzko-%2Fpasted%20image%200%20\(2\).png?alt=media\&token=a0fbcbfe-041e-4928-9506-883be612a550)

&#x20;**3. Git**

In this environment, a git repo code will be executed inside the docker container.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhWjgr7_236wXVdQhav%2F-MhX2b-Y2H7sKEfGk9lh%2Fgit.png?alt=media\&token=a84cc171-1f32-4056-bfec-1e7c671d8ffe)

## Job Dependencies

**Dependencies**

Jobs can define their dependencies by keywords.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhWjgr7_236wXVdQhav%2F-MhX2qkVdKXdzefuhTCb%2Fpasted%20image%200%20\(3\).png?alt=media\&token=e1df623b-28aa-40ec-a5c5-4fed041d33a7)

**Flowchart**

A diamond-shaped DAG. Task A executes first, then task B and task C conduct simultaneously. Task D only starts to run when task B and task C are finished.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhWjgr7_236wXVdQhav%2F-MhX2vkUwqy72p9F0gsX%2Fpasted%20image%200%20\(4\).png?alt=media\&token=e8221f91-9fb3-4a5c-b3f9-120d8dd9a4b4)

## Parameters Setting of Job&#x20;

### Attributes of Parameters

#### **Name**

The name of a parameter, which is used to refer to the parameter in the code of a workflow.

#### **Type**

The type of a parameter. The following three types of parameters are supported in Actions now.

* String: string
* Number: number, including integers and floating-point numbers
* Boolean: boolean value, true/false

#### **Default**

The default value of a parameter. If the default value is not specified at the beginning, the system will automatically use a preset default value.

### Definition of Parameters

Support to view and set the detailed parameters on the parameter details page.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhXYsVVi4fAutS3FBkk%2F-MhXdWRR0XZtgNIR3DAS%2Fp2.png?alt=media\&token=2b2c16d7-5a94-47d5-80ad-6d8906f89a2d)

### Parameters Setting

**Manual Parameters Setting**: If a workflow is started manually, then its values can be set via the TensorBay console.

**Automatic Parameters Setting**: If a workflow is started automatically, then the system will use default values.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhXYsVVi4fAutS3FBkk%2F-MhXc6lmzyPLqBiv29T3%2Fr.png?alt=media\&token=c1678631-e1e4-4128-949c-5b80cbec0bed)

### How to Quote Parameters

You can quote a parameter in workflow with its name.

![](https://2993186011-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGbJTODB-ncDvFhokcx%2F-MhX3y7qwfkd8_QEnN4D%2F-MhX9HFBmnXa4F3Pb7ew%2Fpasted%20image%200%20\(5\).png?alt=media\&token=15390fb6-64e4-464a-a0e7-066737629fb2)

{% hint style="info" %}

1. The parameter to be quoted must be within {{}}.
2. The parameter name must start with **workflow\.parameters**.
3. The parameter name must be the same as **the preset one**.
   {% endhint %}

### Environment Settings of Jobs

**Environment** defines the environment variables of the **container**, which can be quoted in the same way as the environment variables of the normal **docker container**.
