diff --git a/workflows/concepts/jobs.mdx b/workflows/concepts/jobs.mdx index 639d4ff..716f45e 100644 --- a/workflows/concepts/jobs.mdx +++ b/workflows/concepts/jobs.mdx @@ -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. +## 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 + + +```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) +``` + + +```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. diff --git a/workflows/concepts/tasks.mdx b/workflows/concepts/tasks.mdx index a8d9867..5f8481c 100644 --- a/workflows/concepts/tasks.mdx +++ b/workflows/concepts/tasks.mdx @@ -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.