Reputation: 962
In the below, I want to capture "dask_client_log_msg" and other task-logs in one file and "dask_worker_log_msg" and other client-logs in a separate file. As obviously client will run in a separate process altogether than the worker. So I need one process should log all its message in a separate file. Thanks!
def my_task():
print("dask_worker_log_msg")
...
client = Client(<scheduler_address>)
future = client.submit(my_task)
print("dask_client_log_msg")
...
Upvotes: 5
Views: 6993
Reputation: 1102
Structured logs can help here, example from the documentation:
def myfunc(x):
start = time()
...
stop = time()
dask.distributed.get_worker().log_event("runtimes", {"start": start, "stop": stop})
futures = client.map(myfunc, range(10))
client.get_events("runtimes")
Upvotes: 0
Reputation: 752
Here's a solution if you're trying to implement a Dask cluster and need the logs from all jobs that it runs (including logs from your scripts from print or logger.info):
dask-worker >> dask_worker.log 2>&1
logger = logging.getLogger("distributed.worker")
.config/dask/distributed.yaml
See also How to capture logs from workers from a Dask-Yarn job?
Upvotes: 3
Reputation: 57251
You can get logs from your workers with the Client.get_worker_logs method. You can also download logs from the dashboard in the info
pane.
Upvotes: 3