You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/workflows/multi-language.mdx
+89-61Lines changed: 89 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,12 @@ icon: diagram-project
10
10
</Card>
11
11
</CardGroup>
12
12
13
+
## Tilebox languages and SDKs
14
+
15
+
Tilebox supports multiple languages and SDKs for running workflows.
16
+
All Tilebox SDKs and workflows are designed to be interoperable, which means it's possible to have a workflow where individual tasks are executed in different languages.
17
+
Check out [Languages & SDKs](/sdks/introduction) to learn more about currently available programming SDKs.
18
+
13
19
## Why multi-language workflows?
14
20
15
21
You might need to use multiple languages in a single workflow for many reasons, such as:
@@ -18,41 +24,42 @@ You might need to use multiple languages in a single workflow for many reasons,
18
24
- You want to use a library that is only available in a specific language (for example xarray in Python)
19
25
- You started prototyping in Python, but need to start migrating the compute-intensive parts of your workflow to a different language for performance reasons
20
26
21
-
## Example workflow
27
+
## Multi-language workflow example
22
28
23
29
This guide will tackle the first use case: you have a backend in Go and want to offload some of the processing to Python.
24
30
25
31
## Defining tasks in Python and Go
26
32
27
33
```python Python
28
-
classTaskingWorkflow(Task):
34
+
classScheduleImageCapture(Task):
29
35
# The input parameters must match the ones defined in the Go task
30
-
city: str
31
-
time: datetime
32
-
image_resolution: str
36
+
location: tuple[float, float] # lat_lon
37
+
resolution_m: int
38
+
spectral_bands: list[float] # spectral bands in nm
@@ -81,68 +88,89 @@ A couple important points to note:
81
88
82
89
## Creating a Go server that submits jobs
83
90
84
-
Write a simple HTTP server in Go with a `/submit` endpoint that accepts requests to submit a `TaskingWorkflow` job.
91
+
Write a simple HTTP server in Go with a `/submit` endpoint that accepts requests to submit a `ScheduleImageCapture` job.
85
92
86
93
<Note>
87
94
Both Go and Python code are using `test-cluster-tZD9Ca2qsqt4V` as the cluster slug. You should replace it with your own cluster slug, which you can create in the [Tilebox Console](https://console.tilebox.com/workflows/clusters).
Check the Python runner output, it should print the following line:
185
213
186
214
```plaintext Output
187
-
Tasking workflow executed for Zurich at 2025-05-29T08:06:42Z with resolution 30m
215
+
Image captured for [40.75, -73.98] with 30m resolution and bands [489, 560.6, 666.5]
188
216
```
189
217
190
218
## Next Steps
@@ -196,4 +224,4 @@ Tasking workflow executed for Zurich at 2025-05-29T08:06:42Z with resolution 30m
196
224
</CardGroup>
197
225
198
226
As a learning exercise, you can try to change the [News API Workflow](/workflows/concepts/tasks#dependencies-example) to replace the `FetchNews` task with a Go task and keep all the other tasks in Python.
199
-
You will learn how to use a Go task in the middle of a workflow implemented in Python.
227
+
You'll learn how to submit a subtask in another language than what the current task is executed in.
Copy file name to clipboardExpand all lines: workflows/concepts/clusters.mdx
+17-9Lines changed: 17 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ icon: circle-nodes
4
4
---
5
5
6
6
<Accordiontitle="What is a Cluster?">
7
-
Clusters are a logical grouping for [task runners](/workflows/concepts/task-runners). Using clusters, you can scope certain tasks to a specific group of task runners. Tasks, which are always submitted to a specific cluster, are only executed on task runners assigned to the same cluster.
7
+
Clusters are a logical grouping for [task runners](/workflows/concepts/task-runners).
8
+
Using clusters, you can scope certain tasks to a specific group of task runners.
9
+
Tasks, which are always submitted to a specific cluster, are only executed on task runners assigned to the same cluster.
Each cluster has a unique identifier, combining the cluster's name and an automatically generated identifier. Use this slug to reference the cluster for other operations, like submitting a job or subtasks.
75
+
Each cluster has a unique identifier, combining the cluster's name and an automatically generated identifier.
76
+
Use this slug to reference the cluster for other operations, like submitting a job or subtasks.
74
77
75
78
### Listing Clusters
76
79
@@ -148,13 +151,16 @@ To delete a cluster, use the `delete` method and pass the cluster's slug:
148
151
149
152
## Jobs Across Different Clusters
150
153
151
-
When [submitting a job](/workflows/concepts/jobs), you need to specify which cluster the job's root task should be executed on. This allows you to direct the job to a specific set of task runners. By default, all sub-tasks within a job are also submitted to the same cluster, but this can be overridden to submit sub-tasks to different clusters if needed. See the example below for a job that spans across multiple clusters.
154
+
When [submitting a job](/workflows/concepts/jobs), you need to specify which cluster the job's root task should be executed on.
155
+
This allows you to direct the job to a specific set of task runners.
156
+
By default, all sub-tasks within a job are also submitted to the same cluster, but this can be overridden to submit sub-tasks to different clusters if needed.
157
+
See the example below for a job that spans across multiple clusters.
152
158
153
159
<CodeGrouptitle="Multi-Cluster Workflow Example">
154
160
```python Python
155
161
from tilebox.workflows import Task, ExecutionContext, Client
This workflow requires at least two task runners to complete. One must be in the "testing" cluster, and the other must be in the "other-cluster" cluster. If no task runners are available in the "other-cluster," the task submitted to that cluster will remain queued until a task runner is available. It won't execute on a task runner in the "testing" cluster, even if the task runner has the `DummyTask` registered.
243
+
This workflow requires at least two task runners to complete. One must be in the "testing" cluster, and the other must be in the "other-cluster" cluster.
244
+
If no task runners are available in the "other-cluster," the task submitted to that cluster will remain queued until a task runner is available.
245
+
It won't execute on a task runner in the "testing" cluster, even if the task runner has the `DummyTask` registered.
0 commit comments