Skip to content

Commit c93207d

Browse files
Document task and job states (#50)
1 parent 4d606c9 commit c93207d

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

workflows/concepts/jobs.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,33 @@ job, err := client.Jobs.Get(ctx, uuid.MustParse("018dd029-58ca-74e5-8b58-b4f99d6
125125
`find` is also a useful tool for fetching a jobs state after a while, to check if it's still running or has already completed.
126126
</Tip>
127127

128+
## States
129+
130+
A job can be in one of the following states:
131+
132+
- `QUEUED`: the job is queued and waiting for execution
133+
- `STARTED`: at least one task of the job has been started
134+
- `COMPLETED`: all tasks of the job have been completed
135+
136+
<CodeGroup>
137+
```python Python
138+
from tilebox.workflows.data import JobState
139+
140+
job = job_client.find("018dd029-58ca-74e5-8b58-b4f99d610f9a")
141+
142+
print("Job is queued:", job.state == JobState.QUEUED)
143+
```
144+
```go Go
145+
job, err := client.Jobs.Get(ctx, uuid.MustParse("018dd029-58ca-74e5-8b58-b4f99d610f9a"))
146+
147+
fmt.Println("Job is queued:", job.State == workflows.JobQueued)
148+
```
149+
</CodeGroup>
150+
151+
```plaintext Output
152+
Job is queued: True
153+
```
154+
128155
## Visualization
129156

130157
Visualizing the execution of a job can be helpful. The Tilebox workflow orchestrator tracks all tasks in a job, including [sub-tasks](/workflows/concepts/tasks#task-composition-and-subtasks) and [dependencies](/workflows/concepts/tasks#dependencies). This enables the visualization of the execution of a job as a graph diagram.

workflows/concepts/tasks.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,16 @@ Examples of compatible version numbers include:
948948
- A task runner with version `"v1.2"` of `MyTask` would not execute this task, as its minor version is lower than that of the submitted task.
949949
- A task runner with version `"v2.5"` of `MyTask` would not execute this task, as its major version differs from that of the submitted task.
950950

951+
## States
952+
953+
A task can be in one of the following states:
954+
955+
- `QUEUED`: the task is queued and waiting to be run
956+
- `RUNNING`: the task is currently running on some task runner
957+
- `COMPUTED`: the task has been computed and the output is available. Once in this state, the task will never transition to any other state
958+
- `FAILED`: the task has failed
959+
- `CANCELLED`: the task has been cancelled due to user request
960+
951961
## Conclusion
952962

953963
Tasks form the foundation of Tilebox Workflows. By understanding how to create and manage tasks, you can leverage Tilebox's capabilities to automate and optimize your workflows. Experiment with defining your own tasks, utilizing subtasks, managing dependencies, and employing semantic versioning to develop robust and efficient workflows.

0 commit comments

Comments
 (0)