Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
I Would Like To Understand The Limitations Of

I would like to understand the limitations of Task.current_task() and in which cases it should not be called in order to avoid catching another running in parallel task ? Should it be only used in the same process or can work accross different processes ?

  
  
Posted 3 years ago
Votes Newest

Answers 8


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 ?

  
  
Posted 3 years ago

Could you please explain in 2-3 words how current task fetches the good Task ?

  
  
Posted 3 years ago

Thanks a lot !

  
  
Posted 3 years ago

BTW: if you want to sync between artifacts / settings, I would recommend calling task.reload() to get the latest values back from the server.

  
  
Posted 3 years ago

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.

  
  
Posted 3 years ago

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...

  
  
Posted 3 years ago

Thanks AgitatedDove14 !

  
  
Posted 3 years ago

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

  
  
Posted 3 years ago