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