Skip to content

Document task and job states #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions workflows/concepts/jobs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,33 @@ job, err := client.Jobs.Get(ctx, uuid.MustParse("018dd029-58ca-74e5-8b58-b4f99d6
`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.
</Tip>

## States

A job can be in one of the following states:

- `QUEUED`: the job is queued and waiting for execution
- `STARTED`: at least one task of the job has been started
- `COMPLETED`: all tasks of the job have been completed

<CodeGroup>
```python Python
from tilebox.workflows.data import JobState

job = job_client.find("018dd029-58ca-74e5-8b58-b4f99d610f9a")

print("Job is queued:", job.state == JobState.QUEUED)
```
```go Go
job, err := client.Jobs.Get(ctx, uuid.MustParse("018dd029-58ca-74e5-8b58-b4f99d610f9a"))

fmt.Println("Job is queued:", job.State == workflows.JobQueued)
```
</CodeGroup>

```plaintext Output
Job is queued: True
```

## Visualization

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.
Expand Down
10 changes: 10 additions & 0 deletions workflows/concepts/tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,16 @@ Examples of compatible version numbers include:
- 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.
- 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.

## States

A task can be in one of the following states:

- `QUEUED`: the task is queued and waiting to be run
- `RUNNING`: the task is currently running on some task runner
- `COMPUTED`: the task has been computed and the output is available. Once in this state, the task will never transition to any other state
- `FAILED`: the task has failed
- `CANCELLED`: the task has been cancelled due to user request

## Conclusion

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.