MRocklin
MRocklin

Reputation: 57251

Get ID of Dask worker from within a task

Is there a worker ID, or some unique identifier that a dask worker can access programmatically from within a task?

Upvotes: 7

Views: 1758

Answers (1)

MRocklin
MRocklin

Reputation: 57251

Yes, you can use the get_worker function to access the worker that you're on currently, and then grab the id attribute.

from dask.distributed import get_worker
get_worker().id

Upvotes: 9

Related Questions