mirror of
https://github.com/clearml/clearml-docs
synced 2025-01-31 14:37:18 +00:00
2.1 KiB
2.1 KiB
title |
---|
Task Piping |
The task_piping_example.py example demonstrates:
- Creating an instance of a Task from a template Task.
- Customizing that instance by changing the value of a parameter
- Enqueuing the customized instance for execution.
This example accomplishes a task pipe by doing the following:
- Creating the template Task which is named
Toy Base Task
. It must be stored in ClearML Server before instances of it can be created. To create it, run another ClearML example script, toy_base_task.py. The template Task has a parameter dictionary, which is connected to the Task:{'Example_Param': 1}
. - Back in
task_piping_example.py
, creating a parameter dictionary, which is connected to the Task by calling Task.connect so that the parameters are logged by ClearML. The dictionary contains the name of the parameter from the template Task that is going to be customized (Example_Param
), as well as its new value. - Creating a Task object referencing the template Task. See Task.get_task.
- Creating an instance of the template Task by cloning it.
- Getting the newly cloned Task's parameters. See Task.get_parameters.
- Setting the newly cloned Task's parameters to the search values in the parameter dictionary (Step 2). See Task.set_parameters.
- Enqueuing the newly cloned Task to execute. See Task.enqueue.
When the example script runs, it creates an instance of the template experiment, named Auto generated cloned task
which is associated with the examples
project. In the instance, the value of the customized parameter, Example_Param
changed to 3
. You can see it in CONFIGURATIONS > HYPER PARAMETERS.