runnable 0.12.2__py3-none-any.whl → 0.13.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- runnable/extensions/executor/{local/implementation.py → local.py} +0 -2
- runnable/extensions/nodes.py +16 -1
- runnable/sdk.py +150 -101
- runnable/tasks.py +148 -3
- runnable-0.13.0.dist-info/METADATA +270 -0
- {runnable-0.12.2.dist-info → runnable-0.13.0.dist-info}/RECORD +9 -10
- {runnable-0.12.2.dist-info → runnable-0.13.0.dist-info}/WHEEL +1 -1
- {runnable-0.12.2.dist-info → runnable-0.13.0.dist-info}/entry_points.txt +1 -1
- runnable/extensions/executor/local/__init__.py +0 -0
- runnable-0.12.2.dist-info/METADATA +0 -453
- {runnable-0.12.2.dist-info → runnable-0.13.0.dist-info}/LICENSE +0 -0
runnable/extensions/nodes.py
CHANGED
@@ -797,12 +797,27 @@ class DagNode(CompositeNode):
|
|
797
797
|
class StubNode(ExecutableNode):
|
798
798
|
"""
|
799
799
|
Stub is a convenience design node.
|
800
|
-
|
801
800
|
It always returns success in the attempt log and does nothing.
|
802
801
|
|
803
802
|
This node is very similar to pass state in Step functions.
|
804
803
|
|
805
804
|
This node type could be handy when designing the pipeline and stubbing functions
|
805
|
+
--8<-- [start:stub_reference]
|
806
|
+
An stub execution node of the pipeline.
|
807
|
+
Please refer to define pipeline/tasks/stub for more information.
|
808
|
+
|
809
|
+
As part of the dag definition, a stub task is defined as follows:
|
810
|
+
|
811
|
+
dag:
|
812
|
+
steps:
|
813
|
+
stub_task: # The name of the node
|
814
|
+
type: stub
|
815
|
+
on_failure: The name of the step to traverse in case of failure
|
816
|
+
next: The next node to execute after this task, use "success" to terminate the pipeline successfully
|
817
|
+
or "fail" to terminate the pipeline with an error.
|
818
|
+
|
819
|
+
It can take arbritary number of parameters, which is handy to temporarily silence a task node.
|
820
|
+
--8<-- [end:stub_reference]
|
806
821
|
"""
|
807
822
|
|
808
823
|
node_type: str = Field(default="stub", serialization_alias="type")
|
runnable/sdk.py
CHANGED
@@ -61,11 +61,9 @@ class Catalog(BaseModel):
|
|
61
61
|
put (List[str]): List of glob patterns to put into central catalog from the compute data folder.
|
62
62
|
|
63
63
|
Examples:
|
64
|
-
>>> from runnable import Catalog
|
64
|
+
>>> from runnable import Catalog
|
65
65
|
>>> catalog = Catalog(compute_data_folder="/path/to/data", get=["*.csv"], put=["*.csv"])
|
66
66
|
|
67
|
-
>>> task = Task(name="task", catalog=catalog, command="echo 'hello'")
|
68
|
-
|
69
67
|
"""
|
70
68
|
|
71
69
|
model_config = ConfigDict(extra="forbid") # Need to be for command, would be validated later
|
@@ -143,50 +141,7 @@ class BaseTraversal(ABC, BaseModel):
|
|
143
141
|
|
144
142
|
class BaseTask(BaseTraversal):
|
145
143
|
"""
|
146
|
-
|
147
|
-
Please refer to [concepts](concepts/task.md) for more information.
|
148
|
-
|
149
|
-
Attributes:
|
150
|
-
name (str): The name of the node.
|
151
|
-
command (str): The command to execute.
|
152
|
-
|
153
|
-
- For python functions, [dotted path](concepts/task.md/#python_functions) to the function.
|
154
|
-
- For shell commands: command to execute in the shell.
|
155
|
-
- For notebooks: path to the notebook.
|
156
|
-
command_type (str): The type of command to execute.
|
157
|
-
Can be one of "shell", "python", or "notebook".
|
158
|
-
catalog (Optional[Catalog]): The catalog to sync data from/to.
|
159
|
-
Please see Catalog about the structure of the catalog.
|
160
|
-
overrides (Dict[str, Any]): Any overrides to the command.
|
161
|
-
Individual tasks can override the global configuration config by referring to the
|
162
|
-
specific override.
|
163
|
-
|
164
|
-
For example,
|
165
|
-
### Global configuration
|
166
|
-
```yaml
|
167
|
-
executor:
|
168
|
-
type: local-container
|
169
|
-
config:
|
170
|
-
docker_image: "runnable/runnable:latest"
|
171
|
-
overrides:
|
172
|
-
custom_docker_image:
|
173
|
-
docker_image: "runnable/runnable:custom"
|
174
|
-
```
|
175
|
-
### Task specific configuration
|
176
|
-
```python
|
177
|
-
task = Task(name="task", command="echo 'hello'", command_type="shell",
|
178
|
-
overrides={'local-container': custom_docker_image})
|
179
|
-
```
|
180
|
-
notebook_output_path (Optional[str]): The path to save the notebook output.
|
181
|
-
Only used when command_type is 'notebook', defaults to command+_out.ipynb
|
182
|
-
optional_ploomber_args (Optional[Dict[str, Any]]): Any optional ploomber args.
|
183
|
-
Only used when command_type is 'notebook', defaults to {}
|
184
|
-
output_cell_tag (Optional[str]): The tag of the output cell.
|
185
|
-
Only used when command_type is 'notebook', defaults to "runnable_output"
|
186
|
-
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
187
|
-
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
188
|
-
on_failure (str): The name of the node to execute if the step fails.
|
189
|
-
|
144
|
+
Base task type which has catalog, overrides, returns and secrets.
|
190
145
|
"""
|
191
146
|
|
192
147
|
catalog: Optional[Catalog] = Field(default=None, alias="catalog")
|
@@ -220,12 +175,50 @@ class BaseTask(BaseTraversal):
|
|
220
175
|
class PythonTask(BaseTask):
|
221
176
|
"""
|
222
177
|
An execution node of the pipeline of python functions.
|
178
|
+
Please refer to [concepts](concepts/task.md/#python_functions) for more information.
|
223
179
|
|
224
180
|
Attributes:
|
225
181
|
name (str): The name of the node.
|
226
182
|
function (callable): The function to execute.
|
227
|
-
|
228
|
-
|
183
|
+
|
184
|
+
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
185
|
+
Defaults to False.
|
186
|
+
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
187
|
+
Defaults to False.
|
188
|
+
|
189
|
+
on_failure (str): The name of the node to execute if the step fails.
|
190
|
+
|
191
|
+
returns List[Union[str, TaskReturns]] : A list of the names of variables to return from the task.
|
192
|
+
The names should match the order of the variables returned by the function.
|
193
|
+
|
194
|
+
```TaskReturns```: can be JSON friendly variables, objects or metrics.
|
195
|
+
|
196
|
+
By default, all variables are assumed to be JSON friendly and will be serialized to JSON.
|
197
|
+
Pydantic models are readily supported and will be serialized to JSON.
|
198
|
+
|
199
|
+
To return a python object, please use ```pickled(<name>)```.
|
200
|
+
It is advised to use ```pickled(<name>)``` for big JSON friendly variables.
|
201
|
+
|
202
|
+
For example,
|
203
|
+
```python
|
204
|
+
from runnable import pickled
|
205
|
+
|
206
|
+
def f():
|
207
|
+
...
|
208
|
+
x = 1
|
209
|
+
return x, df # A simple JSON friendly variable and a python object.
|
210
|
+
|
211
|
+
task = PythonTask(name="task", function=f, returns=["x", pickled(df)]))
|
212
|
+
```
|
213
|
+
|
214
|
+
To mark any JSON friendly variable as a ```metric```, please use ```metric(x)```.
|
215
|
+
Metric variables should be JSON friendly and can be treated just like any other parameter.
|
216
|
+
|
217
|
+
catalog Optional[Catalog]: The files sync data from/to, refer to Catalog.
|
218
|
+
|
219
|
+
secrets List[str]: List of secrets to pass to the task. They are exposed as environment variables
|
220
|
+
and removed after execution.
|
221
|
+
|
229
222
|
overrides (Dict[str, Any]): Any overrides to the command.
|
230
223
|
Individual tasks can override the global configuration config by referring to the
|
231
224
|
specific override.
|
@@ -246,11 +239,6 @@ class PythonTask(BaseTask):
|
|
246
239
|
task = PythonTask(name="task", function="function'",
|
247
240
|
overrides={'local-container': custom_docker_image})
|
248
241
|
```
|
249
|
-
|
250
|
-
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
251
|
-
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
252
|
-
on_failure (str): The name of the node to execute if the step fails.
|
253
|
-
|
254
242
|
"""
|
255
243
|
|
256
244
|
function: Callable = Field(exclude=True)
|
@@ -269,15 +257,52 @@ class PythonTask(BaseTask):
|
|
269
257
|
|
270
258
|
class NotebookTask(BaseTask):
|
271
259
|
"""
|
272
|
-
An execution node of the pipeline of
|
273
|
-
Please refer to [concepts](concepts/task.md) for more information.
|
260
|
+
An execution node of the pipeline of notebook.
|
261
|
+
Please refer to [concepts](concepts/task.md/#notebooks) for more information.
|
262
|
+
|
263
|
+
We internally use [Ploomber engine](https://github.com/ploomber/ploomber-engine) to execute the notebook.
|
274
264
|
|
275
265
|
Attributes:
|
276
266
|
name (str): The name of the node.
|
277
|
-
notebook: The path to the notebook
|
278
|
-
|
279
|
-
|
280
|
-
|
267
|
+
notebook (str): The path to the notebook relative the project root.
|
268
|
+
optional_ploomber_args (Dict[str, Any]): Any optional ploomber args, please refer to
|
269
|
+
[Ploomber engine](https://github.com/ploomber/ploomber-engine) for more information.
|
270
|
+
|
271
|
+
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
272
|
+
Defaults to False.
|
273
|
+
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
274
|
+
Defaults to False.
|
275
|
+
|
276
|
+
on_failure (str): The name of the node to execute if the step fails.
|
277
|
+
|
278
|
+
returns List[Union[str, TaskReturns]] : A list of the names of variables to return from the task.
|
279
|
+
The names should match the order of the variables returned by the function.
|
280
|
+
|
281
|
+
```TaskReturns```: can be JSON friendly variables, objects or metrics.
|
282
|
+
|
283
|
+
By default, all variables are assumed to be JSON friendly and will be serialized to JSON.
|
284
|
+
Pydantic models are readily supported and will be serialized to JSON.
|
285
|
+
|
286
|
+
To return a python object, please use ```pickled(<name>)```.
|
287
|
+
It is advised to use ```pickled(<name>)``` for big JSON friendly variables.
|
288
|
+
|
289
|
+
For example,
|
290
|
+
```python
|
291
|
+
from runnable import pickled
|
292
|
+
|
293
|
+
# assume, example.ipynb is the notebook with df and x as variables in some cells.
|
294
|
+
|
295
|
+
task = Notebook(name="task", notebook="example.ipynb", returns=["x", pickled(df)]))
|
296
|
+
```
|
297
|
+
|
298
|
+
To mark any JSON friendly variable as a ```metric```, please use ```metric(x)```.
|
299
|
+
Metric variables should be JSON friendly and can be treated just like any other parameter.
|
300
|
+
|
301
|
+
catalog Optional[Catalog]: The files sync data from/to, refer to Catalog.
|
302
|
+
|
303
|
+
secrets List[str]: List of secrets to pass to the task. They are exposed as environment variables
|
304
|
+
and removed after execution.
|
305
|
+
|
281
306
|
overrides (Dict[str, Any]): Any overrides to the command.
|
282
307
|
Individual tasks can override the global configuration config by referring to the
|
283
308
|
specific override.
|
@@ -295,18 +320,9 @@ class NotebookTask(BaseTask):
|
|
295
320
|
```
|
296
321
|
### Task specific configuration
|
297
322
|
```python
|
298
|
-
task = NotebookTask(name="task", notebook="
|
323
|
+
task = NotebookTask(name="task", notebook="example.ipynb",
|
299
324
|
overrides={'local-container': custom_docker_image})
|
300
325
|
```
|
301
|
-
notebook_output_path (Optional[str]): The path to save the notebook output.
|
302
|
-
Only used when command_type is 'notebook', defaults to command+_out.ipynb
|
303
|
-
optional_ploomber_args (Optional[Dict[str, Any]]): Any optional ploomber args.
|
304
|
-
Only used when command_type is 'notebook', defaults to {}
|
305
|
-
|
306
|
-
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
307
|
-
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
308
|
-
on_failure (str): The name of the node to execute if the step fails.
|
309
|
-
|
310
326
|
"""
|
311
327
|
|
312
328
|
notebook: str = Field(serialization_alias="command")
|
@@ -319,15 +335,33 @@ class NotebookTask(BaseTask):
|
|
319
335
|
|
320
336
|
class ShellTask(BaseTask):
|
321
337
|
"""
|
322
|
-
An execution node of the pipeline of
|
323
|
-
Please refer to [concepts](concepts/task.md) for more information.
|
338
|
+
An execution node of the pipeline of shell script.
|
339
|
+
Please refer to [concepts](concepts/task.md/#shell) for more information.
|
340
|
+
|
324
341
|
|
325
342
|
Attributes:
|
326
343
|
name (str): The name of the node.
|
327
|
-
command: The
|
328
|
-
|
329
|
-
|
330
|
-
|
344
|
+
command (str): The path to the notebook relative the project root.
|
345
|
+
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
346
|
+
Defaults to False.
|
347
|
+
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
348
|
+
Defaults to False.
|
349
|
+
|
350
|
+
on_failure (str): The name of the node to execute if the step fails.
|
351
|
+
|
352
|
+
returns List[str] : A list of the names of environment variables to collect from the task.
|
353
|
+
|
354
|
+
The names should match the order of the variables returned by the function.
|
355
|
+
Shell based tasks can only return JSON friendly variables.
|
356
|
+
|
357
|
+
To mark any JSON friendly variable as a ```metric```, please use ```metric(x)```.
|
358
|
+
Metric variables should be JSON friendly and can be treated just like any other parameter.
|
359
|
+
|
360
|
+
catalog Optional[Catalog]: The files sync data from/to, refer to Catalog.
|
361
|
+
|
362
|
+
secrets List[str]: List of secrets to pass to the task. They are exposed as environment variables
|
363
|
+
and removed after execution.
|
364
|
+
|
331
365
|
overrides (Dict[str, Any]): Any overrides to the command.
|
332
366
|
Individual tasks can override the global configuration config by referring to the
|
333
367
|
specific override.
|
@@ -345,14 +379,10 @@ class ShellTask(BaseTask):
|
|
345
379
|
```
|
346
380
|
### Task specific configuration
|
347
381
|
```python
|
348
|
-
task = ShellTask(name="task", command="
|
382
|
+
task = ShellTask(name="task", command="export x=1",
|
349
383
|
overrides={'local-container': custom_docker_image})
|
350
384
|
```
|
351
385
|
|
352
|
-
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
353
|
-
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
354
|
-
on_failure (str): The name of the node to execute if the step fails.
|
355
|
-
|
356
386
|
"""
|
357
387
|
|
358
388
|
command: str = Field(alias="command")
|
@@ -364,16 +394,20 @@ class ShellTask(BaseTask):
|
|
364
394
|
|
365
395
|
class Stub(BaseTraversal):
|
366
396
|
"""
|
367
|
-
A node that
|
397
|
+
A node that passes through the pipeline with no action. Just like ```pass``` in Python.
|
398
|
+
Please refer to [concepts](concepts/task.md/#stub) for more information.
|
368
399
|
|
369
400
|
A stub node can tak arbitrary number of arguments.
|
370
|
-
Please refer to [concepts](concepts/stub.md) for more information.
|
371
401
|
|
372
402
|
Attributes:
|
373
403
|
name (str): The name of the node.
|
374
|
-
|
404
|
+
command (str): The path to the notebook relative the project root.
|
375
405
|
terminate_with_success (bool): Whether to terminate the pipeline with a success after this node.
|
406
|
+
Defaults to False.
|
407
|
+
terminate_with_failure (bool): Whether to terminate the pipeline with a failure after this node.
|
408
|
+
Defaults to False.
|
376
409
|
|
410
|
+
on_failure (str): The name of the node to execute if the step fails.
|
377
411
|
"""
|
378
412
|
|
379
413
|
model_config = ConfigDict(extra="ignore")
|
@@ -422,12 +456,13 @@ class Map(BaseTraversal):
|
|
422
456
|
Please refer to [concepts](concepts/map.md) for more information.
|
423
457
|
|
424
458
|
Attributes:
|
425
|
-
branch: The pipeline to execute for each item.
|
459
|
+
branch (Pipeline): The pipeline to execute for each item.
|
426
460
|
|
427
|
-
iterate_on: The name of the parameter to iterate over.
|
461
|
+
iterate_on (str): The name of the parameter to iterate over.
|
428
462
|
The parameter should be defined either by previous steps or statically at the start of execution.
|
429
463
|
|
430
|
-
iterate_as: The name of the iterable to be passed to functions.
|
464
|
+
iterate_as (str): The name of the iterable to be passed to functions.
|
465
|
+
reducer (Callable): The function to reduce the results of the branches.
|
431
466
|
|
432
467
|
|
433
468
|
overrides (Dict[str, Any]): Any overrides to the command.
|
@@ -510,29 +545,44 @@ class Fail(BaseModel):
|
|
510
545
|
|
511
546
|
class Pipeline(BaseModel):
|
512
547
|
"""
|
513
|
-
A Pipeline is a
|
548
|
+
A Pipeline is a sequence of Steps.
|
514
549
|
|
515
550
|
Attributes:
|
516
|
-
steps (List[Stub | PythonTask | NotebookTask | ShellTask | Parallel | Map
|
551
|
+
steps (List[Stub | PythonTask | NotebookTask | ShellTask | Parallel | Map]]):
|
517
552
|
A list of Steps that make up the Pipeline.
|
518
|
-
|
553
|
+
|
554
|
+
The order of steps is important as it determines the order of execution.
|
555
|
+
Any on failure behavior should the first step in ```on_failure``` pipelines.
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
on_failure (List[List[Pipeline], optional): A list of Pipelines to execute in case of failure.
|
560
|
+
|
561
|
+
For example, for the below pipeline:
|
562
|
+
step1 >> step2
|
563
|
+
and step1 to reach step3 in case of failure.
|
564
|
+
|
565
|
+
failure_pipeline = Pipeline(steps=[step1, step3])
|
566
|
+
|
567
|
+
pipeline = Pipeline(steps=[step1, step2, on_failure=[failure_pipeline])
|
568
|
+
|
519
569
|
name (str, optional): The name of the Pipeline. Defaults to "".
|
520
570
|
description (str, optional): A description of the Pipeline. Defaults to "".
|
521
|
-
add_terminal_nodes (bool, optional): Whether to add terminal nodes to the Pipeline. Defaults to True.
|
522
571
|
|
523
|
-
The
|
524
|
-
To add custom success and fail nodes, set add_terminal_nodes=False and create success
|
525
|
-
and fail nodes manually.
|
572
|
+
The pipeline implicitly add success and fail nodes.
|
526
573
|
|
527
574
|
"""
|
528
575
|
|
529
|
-
steps: List[Union[StepType, List[
|
576
|
+
steps: List[Union[StepType, List["Pipeline"]]]
|
530
577
|
name: str = ""
|
531
578
|
description: str = ""
|
532
|
-
add_terminal_nodes: bool = True # Adds "success" and "fail" nodes
|
533
579
|
|
534
580
|
internal_branch_name: str = ""
|
535
581
|
|
582
|
+
@property
|
583
|
+
def add_terminal_nodes(self) -> bool:
|
584
|
+
return True
|
585
|
+
|
536
586
|
_dag: graph.Graph = PrivateAttr()
|
537
587
|
model_config = ConfigDict(extra="forbid")
|
538
588
|
|
@@ -590,6 +640,7 @@ class Pipeline(BaseModel):
|
|
590
640
|
Any definition of pipeline should have one node that terminates with success.
|
591
641
|
"""
|
592
642
|
# TODO: Bug with repeat names
|
643
|
+
# TODO: https://github.com/AstraZeneca/runnable/issues/156
|
593
644
|
|
594
645
|
success_path: List[StepType] = []
|
595
646
|
on_failure_paths: List[List[StepType]] = []
|
@@ -598,7 +649,7 @@ class Pipeline(BaseModel):
|
|
598
649
|
if isinstance(step, (Stub, PythonTask, NotebookTask, ShellTask, Parallel, Map)):
|
599
650
|
success_path.append(step)
|
600
651
|
continue
|
601
|
-
on_failure_paths.append(step)
|
652
|
+
# on_failure_paths.append(step)
|
602
653
|
|
603
654
|
if not success_path:
|
604
655
|
raise Exception("There should be some success path")
|
@@ -654,21 +705,19 @@ class Pipeline(BaseModel):
|
|
654
705
|
|
655
706
|
Traverse and execute all the steps of the pipeline, eg. [local execution](configurations/executors/local.md).
|
656
707
|
|
657
|
-
Or create the
|
708
|
+
Or create the representation of the pipeline for other executors.
|
658
709
|
|
659
710
|
Please refer to [concepts](concepts/executor.md) for more information.
|
660
711
|
|
661
712
|
Args:
|
662
713
|
configuration_file (str, optional): The path to the configuration file. Defaults to "".
|
663
|
-
The configuration file can be overridden by the environment variable
|
714
|
+
The configuration file can be overridden by the environment variable RUNNABLE_CONFIGURATION_FILE.
|
664
715
|
|
665
716
|
run_id (str, optional): The ID of the run. Defaults to "".
|
666
717
|
tag (str, optional): The tag of the run. Defaults to "".
|
667
718
|
Use to group multiple runs.
|
668
719
|
|
669
720
|
parameters_file (str, optional): The path to the parameters file. Defaults to "".
|
670
|
-
use_cached (str, optional): Whether to use cached results. Defaults to "".
|
671
|
-
Provide the run_id of the older execution to recover.
|
672
721
|
|
673
722
|
log_level (str, optional): The log level. Defaults to defaults.LOG_LEVEL.
|
674
723
|
"""
|
runnable/tasks.py
CHANGED
@@ -188,7 +188,56 @@ def task_return_to_parameter(task_return: TaskReturns, value: Any) -> Parameter:
|
|
188
188
|
|
189
189
|
|
190
190
|
class PythonTaskType(BaseTaskType): # pylint: disable=too-few-public-methods
|
191
|
-
"""
|
191
|
+
"""
|
192
|
+
--8<-- [start:python_reference]
|
193
|
+
An execution node of the pipeline of python functions.
|
194
|
+
Please refer to define pipeline/tasks/python for more information.
|
195
|
+
|
196
|
+
As part of the dag definition, a python task is defined as follows:
|
197
|
+
|
198
|
+
dag:
|
199
|
+
steps:
|
200
|
+
python_task: # The name of the node
|
201
|
+
type: task
|
202
|
+
command_type: python # this is default
|
203
|
+
command: my_module.my_function # the dotted path to the function. Please refer to the yaml section of
|
204
|
+
define pipeline/tasks/python for concrete details.
|
205
|
+
returns:
|
206
|
+
- name: # The name to assign the return value
|
207
|
+
kind: json # the default value is json,
|
208
|
+
can be object for python objects and metric for metrics
|
209
|
+
secrets:
|
210
|
+
- my_secret_key # A list of secrets to expose by secrets manager
|
211
|
+
catalog:
|
212
|
+
get:
|
213
|
+
- A list of glob patterns to get from the catalog to the local file system
|
214
|
+
put:
|
215
|
+
- A list of glob patterns to put to the catalog from the local file system
|
216
|
+
on_failure: The name of the step to traverse in case of failure
|
217
|
+
overrides:
|
218
|
+
Individual tasks can override the global configuration config by referring to the
|
219
|
+
specific override.
|
220
|
+
|
221
|
+
For example,
|
222
|
+
#Global configuration
|
223
|
+
executor:
|
224
|
+
type: local-container
|
225
|
+
config:
|
226
|
+
docker_image: "runnable/runnable:latest"
|
227
|
+
overrides:
|
228
|
+
custom_docker_image:
|
229
|
+
docker_image: "runnable/runnable:custom"
|
230
|
+
|
231
|
+
## In the node definition
|
232
|
+
overrides:
|
233
|
+
local-container:
|
234
|
+
docker_image: "runnable/runnable:custom"
|
235
|
+
|
236
|
+
This instruction will override the docker image for the local-container executor.
|
237
|
+
next: The next node to execute after this task, use "success" to terminate the pipeline successfully
|
238
|
+
or "fail" to terminate the pipeline with an error.
|
239
|
+
--8<-- [end:python_reference]
|
240
|
+
"""
|
192
241
|
|
193
242
|
task_type: str = Field(default="python", serialization_alias="command_type")
|
194
243
|
command: str
|
@@ -277,7 +326,56 @@ class PythonTaskType(BaseTaskType): # pylint: disable=too-few-public-methods
|
|
277
326
|
|
278
327
|
|
279
328
|
class NotebookTaskType(BaseTaskType):
|
280
|
-
"""
|
329
|
+
"""
|
330
|
+
--8<-- [start:notebook_reference]
|
331
|
+
An execution node of the pipeline of notebook execution.
|
332
|
+
Please refer to define pipeline/tasks/notebook for more information.
|
333
|
+
|
334
|
+
As part of the dag definition, a notebook task is defined as follows:
|
335
|
+
|
336
|
+
dag:
|
337
|
+
steps:
|
338
|
+
notebook_task: # The name of the node
|
339
|
+
type: task
|
340
|
+
command_type: notebook
|
341
|
+
command: the path to the notebook relative to project root.
|
342
|
+
optional_ploomber_args: a dictionary of arguments to be passed to ploomber engine
|
343
|
+
returns:
|
344
|
+
- name: # The name to assign the return value
|
345
|
+
kind: json # the default value is json,
|
346
|
+
can be object for python objects and metric for metrics
|
347
|
+
secrets:
|
348
|
+
- my_secret_key # A list of secrets to expose by secrets manager
|
349
|
+
catalog:
|
350
|
+
get:
|
351
|
+
- A list of glob patterns to get from the catalog to the local file system
|
352
|
+
put:
|
353
|
+
- A list of glob patterns to put to the catalog from the local file system
|
354
|
+
on_failure: The name of the step to traverse in case of failure
|
355
|
+
overrides:
|
356
|
+
Individual tasks can override the global configuration config by referring to the
|
357
|
+
specific override.
|
358
|
+
|
359
|
+
For example,
|
360
|
+
#Global configuration
|
361
|
+
executor:
|
362
|
+
type: local-container
|
363
|
+
config:
|
364
|
+
docker_image: "runnable/runnable:latest"
|
365
|
+
overrides:
|
366
|
+
custom_docker_image:
|
367
|
+
docker_image: "runnable/runnable:custom"
|
368
|
+
|
369
|
+
## In the node definition
|
370
|
+
overrides:
|
371
|
+
local-container:
|
372
|
+
docker_image: "runnable/runnable:custom"
|
373
|
+
|
374
|
+
This instruction will override the docker image for the local-container executor.
|
375
|
+
next: The next node to execute after this task, use "success" to terminate the pipeline successfully
|
376
|
+
or "fail" to terminate the pipeline with an error.
|
377
|
+
--8<-- [end:notebook_reference]
|
378
|
+
"""
|
281
379
|
|
282
380
|
task_type: str = Field(default="notebook", serialization_alias="command_type")
|
283
381
|
command: str
|
@@ -410,7 +508,54 @@ class NotebookTaskType(BaseTaskType):
|
|
410
508
|
|
411
509
|
class ShellTaskType(BaseTaskType):
|
412
510
|
"""
|
413
|
-
|
511
|
+
--8<-- [start:shell_reference]
|
512
|
+
An execution node of the pipeline of shell execution.
|
513
|
+
Please refer to define pipeline/tasks/shell for more information.
|
514
|
+
|
515
|
+
As part of the dag definition, a shell task is defined as follows:
|
516
|
+
|
517
|
+
dag:
|
518
|
+
steps:
|
519
|
+
shell_task: # The name of the node
|
520
|
+
type: task
|
521
|
+
command_type: shell
|
522
|
+
command: The command to execute, it could be multiline
|
523
|
+
optional_ploomber_args: a dictionary of arguments to be passed to ploomber engine
|
524
|
+
returns:
|
525
|
+
- name: # The name to assign the return value
|
526
|
+
kind: json # the default value is json,
|
527
|
+
can be object for python objects and metric for metrics
|
528
|
+
secrets:
|
529
|
+
- my_secret_key # A list of secrets to expose by secrets manager
|
530
|
+
catalog:
|
531
|
+
get:
|
532
|
+
- A list of glob patterns to get from the catalog to the local file system
|
533
|
+
put:
|
534
|
+
- A list of glob patterns to put to the catalog from the local file system
|
535
|
+
on_failure: The name of the step to traverse in case of failure
|
536
|
+
overrides:
|
537
|
+
Individual tasks can override the global configuration config by referring to the
|
538
|
+
specific override.
|
539
|
+
|
540
|
+
For example,
|
541
|
+
#Global configuration
|
542
|
+
executor:
|
543
|
+
type: local-container
|
544
|
+
config:
|
545
|
+
docker_image: "runnable/runnable:latest"
|
546
|
+
overrides:
|
547
|
+
custom_docker_image:
|
548
|
+
docker_image: "runnable/runnable:custom"
|
549
|
+
|
550
|
+
## In the node definition
|
551
|
+
overrides:
|
552
|
+
local-container:
|
553
|
+
docker_image: "runnable/runnable:custom"
|
554
|
+
|
555
|
+
This instruction will override the docker image for the local-container executor.
|
556
|
+
next: The next node to execute after this task, use "success" to terminate the pipeline successfully
|
557
|
+
or "fail" to terminate the pipeline with an error.
|
558
|
+
--8<-- [end:shell_reference]
|
414
559
|
"""
|
415
560
|
|
416
561
|
task_type: str = Field(default="shell", serialization_alias="command_type")
|