I have tried it and it depends on the context. When I call the method inside a function decorated with PipelineDecorator.component
, I get the component task, while if I call it inside PipelineDecorator.pipeline
, I get the task corresponding to the pipeline. However, as you said that is not the expected behavior, although I think it makes sense.
GiganticTurtle0
If there are several tasks running concurrently, which task should
Task.current_task()
return? (
How could you have that ?
Per process, there is one Main current Task (until you close it).
Are you referring to a pipeline with multiple steps ?
If this is the case, task.current_task
will return the Task of the component (if executed form the component) and the pipeline (if called from the pipeline logic function).
Notice we added the ability to send metrics/artifacts directly to the Pipeline Task from any of the pipeline components:
https://github.com/allegroai/clearml/blob/0f2eef3ef4c0dacf980bf6243b910fe16539eb78/clearml/automation/controller.py#L741
https://github.com/allegroai/clearml/blob/0f2eef3ef4c0dacf980bf6243b910fe16539eb78/clearml/automation/controller.py#L755
There is also a way to do that automatically with "monitor_artifacts"/"monitor_metrics"
https://github.com/allegroai/clearml/blob/0f2eef3ef4c0dacf980bf6243b910fe16539eb78/clearml/automation/controller.py#L2497
GiganticTurtle0 let me check up on that for you then, thanks for the info 🙂
GiganticTurtle0 , then I'd guess that's the task that would be returned 🙂
Did you try?
Great, thank you very much for the info! I just spotted the get_logger
classmethod. As for the initial question, that's just the behavior I expected!