current task fetches the good Task
Assuming you fork the process than the gloabl instance" is passed to the subprocess. Assuming the sub-process was spawned (e.g. POpen) then an environement variable with the Task's unique ID is passed. then when you call the "Task.current_task" it "knows" the Task was already created and it will fetch the state from the clearml-server and create a new Task object for you to work with.
BTW: please use the latest RC (we fixed an issue with exactly this use case)pip install clearml==1.0.4rc0
Could you please explain in 2-3 words how current task fetches the good Task ?
BTW: if you want to sync between artifacts / settings, I would recommend calling task.reload() to get the latest values back from the server.
My question is what happens if I launch in parallel multiple doit commands that create new Tasks.
Should work out of the box.
I would like to confirm that current_task ...
Correct.
Hi AgitatedDove14 thanks for the answer.
I'm using python doit: https://pydoit.org/ to schedule multiple steps. Basically, it does subprocess.Popen for each step. In each step (=subprocess) I get the task using Task.current_task()
.t0: doit -> parent proc creates new Task t1: |_ child proc: current_task() and do smth t2: |_ child proc: current_task() and do smth
My question is what happens if I launch in parallel multiple doit commands that create new Tasks. I would like to confirm that current_task will get the correct task instead of some other task...
Hi TightElk12
would like to understand the limitations ofÂ
Task.current_task()
Basically this will always get you an instance of the current Task. This will work from sub-processes as well as the main process. Is there a specific scenario you have in mind, or a challenge with the use case ?