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
Hello, I Have Another, Hopefully Minor Question. What Is The Recommended Way Of Checking If A Code Segment Is Running As A Part Of A Task Or Not? I Tried Checking The Return Value Of

Hello,
I have another, hopefully minor question.

What is the recommended way of checking if a code segment is running as a part of a Task or not?

I tried checking the return value of current_task() , but it returns a task handle even after the Task has been closed.
print(f"1 = {not Task.current_task() == None}") # 1 = False task = Task.init("OMD", task_name="bla") print(f"2 = {not Task.current_task() == None}") # 2 = True task.close() print(f"3 = {not Task.current_task() == None}") # 3 = True, I would have liked this to be False
Is there an alternative?
Thanks a lot!
Ron

  
  
Posted 2 years ago
Votes Newest

Answers 3


Hi ArrogantBlackbird16

but it returns a task handle even after the Task has been closed.

It should not ... That is a good point!
Let's fix that 🙂

  
  
Posted 2 years ago

👍
Thanks

  
  
Posted 2 years ago

Hi AgitatedDove14 ,

Continuing from the previous question: Is it possible to detect remote Task execution before the remote Task.init(...) function call?

For example, when I run this:
print("Doing some computations that MUST be local") # I want to prevent this from running remotely task = Task.init("OMD", task_name="bla") task.set_base_docker("/home/rdekel/anaconda3/envs/P1") cloned_task = Task.clone(source_task=task, name="Clone") Task.enqueue(cloned_task.id, queue_name="ron_lambda_cpu_queue") task.close()The "computation" happens both locally and remotely, while I want it to only happen locally.

Although it is possibly, in principle, to use Task.current_task().running_locally(), I want to test for local vs. remote execution before the Task.init function call, so running_locally() is inaccessible.

Is there a simple, Task-independent way to tell apart local and remote execution? And if not, can I use the environment variables that clearml sets when a process is executing externally (I believe CLEARML_TASK_ID is one such option)?

I realize in the toy example above it appears trivial to replace the order of the print() and the Task.init(), but it would be difficult (and inelegant) in my actual use-case.

Thanks again for the help! :)
Ron

  
  
Posted 2 years ago
661 Views
3 Answers
2 years ago
one year ago
Tags