Given a dask.distributed
cluster, for example a LocalCluster
, what is the most robust way to detect if I’m running a python code from within a Worker instance?
This can be code that is not strictly associated with a task, for example while setting up the Worker’s environment
The answer to this previous question Using Dask distributed, how can a function introspect to know if it’s running as a distributed future or as a “normal” function? does not work anymore given the recent changes to using contextvars