clearml-docs/docs/guides/automation/task_piping.md

25 lines
2.1 KiB
Markdown
Raw Normal View History

2021-05-13 23:48:51 +00:00
---
2022-01-02 14:21:48 +00:00
title: Programmatic Orchestration
2021-05-13 23:48:51 +00:00
---
2022-01-02 14:21:48 +00:00
The [programmatic_orchestration.py](https://github.com/allegroai/clearml/blob/master/examples/automation/programmatic_orchestration.py)
2021-05-13 23:48:51 +00:00
example demonstrates:
1. Creating an instance of a Task from a template Task.
1. Customizing that instance by changing the value of a parameter
1. Enqueuing the customized instance for execution.
This example accomplishes a task pipe by doing the following:
2022-05-19 06:59:10 +00:00
1. Creating the template Task which is named `Toy Base Task`. It must be stored in ClearML Server before instances of
2022-01-02 14:21:48 +00:00
it can be created. To create it, run another ClearML example script, [toy_base_task.py](https://github.com/allegroai/clearml/blob/master/examples/automation/toy_base_task.py).
2021-05-13 23:48:51 +00:00
The template Task has a parameter dictionary, which is connected to the Task: `{'Example_Param': 1}`.
2024-04-03 09:06:28 +00:00
1. Back in `programmatic_orchestration.py`, creating a parameter dictionary, which is connected to the Task by calling [`Task.connect`](../../references/sdk/task.md#connect)
2022-01-02 14:21:48 +00:00
so that the parameters are logged by ClearML. The dictionary contains the name of the parameter from the template
2021-05-13 23:48:51 +00:00
Task that is going to be customized (`Example_Param`), as well as its new value.
2024-04-03 09:06:28 +00:00
1. Creating a Task object referencing the template Task. See [`Task.get_task`](../../references/sdk/task.md#taskget_task).
2021-05-13 23:48:51 +00:00
1. Creating an instance of the template Task by cloning it.
2024-04-03 09:06:28 +00:00
1. Getting the newly cloned Task's parameters. See [`Task.get_parameters`](../../references/sdk/task.md#get_parameters).
1. Setting the newly cloned Task's parameters to the search values in the parameter dictionary (Step 2). See [`Task.set_parameters`](../../references/sdk/task.md#set_parameters).
1. Enqueuing the newly cloned Task to execute. See [`Task.enqueue`](../../references/sdk/task.md#taskenqueue).
2021-05-13 23:48:51 +00:00
2023-09-04 12:40:42 +00:00
When the example script runs, it creates an instance of the template experiment, named `Auto generated cloned task` in the `examples` project. In the instance, the value of the customized parameter, `Example_Param` changed to `3`. You can see it in **CONFIGURATION** **>** **HYPERPARAMETERS**.