-
For example lets say we had the following code:
If I called |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's a question about API design which is ultimately always also a matter of taste so this answer is subjective. I believe an important factor in API design is the principle of least surprise which boils down to "An API should do what most users would anticipate it to do". An exception is usually raised if an assumption is invalidated or the expected result cannot be guaranteed for any other reason. The For you scenario, I would recommend to be more explicit about whether or not a function is supposed to be called on a worker or not. If you know, for a fact, that you are running on a worker and want to secede, I can also recommend looking into https://distributed.dask.org/en/latest/api.html?highlight=get_worker_client#distributed.worker_client |
Beta Was this translation helpful? Give feedback.
That's a question about API design which is ultimately always also a matter of taste so this answer is subjective.
I believe an important factor in API design is the principle of least surprise which boils down to "An API should do what most users would anticipate it to do". An exception is usually raised if an assumption is invalidated or the expected result cannot be guaranteed for any other reason.
The
secede
andrejoin
API calls are functions to remove (secede) a thread from the given worker thread pool such that it does not block an executing slot. Rejoin will revert this.By this argumentation, calling
secede
in a thread which is not running on a worker both invalidates the assumpti…