@@ -58,8 +58,13 @@ pytask -n 2
58
58
pytask --parallel-backend loky
59
59
```
60
60
61
+ ``` {note}
62
+ When you build a project using coiled, you will see a message after pytask's startup
63
+ that coiled is creating the remote software environment which takes 1-2m.
64
+ ```
65
+
61
66
When you apply the {func}` @task <pytask.task> ` decorator to the task, make sure the
62
- {func}` @coiled.function <coiled.function> ` decorator is applied first, or is closer to
67
+ {func}` @coiled.function <coiled.function> ` decorator is applied first or is closer to
63
68
the function. Otherwise, it will be ignored. Add more arguments to the decorator to
64
69
configure the hardware and software environment.
65
70
@@ -71,7 +76,7 @@ By default, {func}`@coiled.function <coiled.function>`
71
76
to the workload. It means that coiled infers from the number of submitted tasks and
72
77
previous runtimes, how many additional remote workers it should deploy to handle the
73
78
workload. It provides a convenient mechanism to scale without intervention. Also,
74
- workers launched by {func}` @coiled.function <coiled.function> ` will shutdown quicker
79
+ workers launched by {func}` @coiled.function <coiled.function> ` will shut down quicker
75
80
than a cluster.
76
81
77
82
``` {seealso}
@@ -88,7 +93,8 @@ coiled. Usually, it is not necessary and you are better off using coiled's serve
88
93
functions.
89
94
90
95
If you want to launch a cluster managed by coiled, register a function that builds an
91
- executor using {class}` coiled.Cluster ` .
96
+ executor using {class}` coiled.Cluster ` . Assign a name to the cluster to reuse it when
97
+ you build your project again and the cluster has not been shut down.
92
98
93
99
``` python
94
100
import coiled
@@ -98,7 +104,11 @@ from concurrent.futures import Executor
98
104
99
105
100
106
def _build_coiled_executor (n_workers : int ) -> Executor:
101
- return coiled.Cluster(n_workers = n_workers).get_client().get_executor()
107
+ return (
108
+ coiled.Cluster(n_workers = n_workers, name = " coiled-project" )
109
+ .get_client()
110
+ .get_executor()
111
+ )
102
112
103
113
104
114
registry.register_parallel_backend(ParallelBackend.CUSTOM , _build_coiled_executor)
@@ -109,3 +119,12 @@ Then, execute your workflow with
109
119
``` console
110
120
pytask --parallel-backend custom
111
121
```
122
+
123
+ ## Tips
124
+
125
+ When you are changing your project during executions and your cluster is still up and
126
+ running, the local and the remote software environment can get out of sync. Then, you
127
+ see errors in remote workers you have fixed locally.
128
+
129
+ A quick solution is to stop the cluster in the coiled dashboard and create a new one
130
+ with the next ` pytask build ` .
0 commit comments