Sean Harkins
04/17/2021, 1:43 AMCloudHandler
via environment settings.
I used the appropriate environment settings in my run_config
with
flow.run_config = ECSRun(
image=worker_image,
labels=["dask_test"],
task_definition=definition,
env={"PREFECT__LOGGING__EXTRA_LOGGERS": "pangeo_forge.recipe"}
)
I have also configured the task’s regular Python logging with logging.getLogger("pangeo_forge.recipe").setLevel(level=logging.DEBUG)
and this logger is successfully writing to my Cloudwatch logs for the Dask worker. But none of this module’s log entries are being written to Prefect Cloud. Any suggestions on how I should configure things so that my Dask workers’ log streams are also written to Cloud?Kevin Kho
EXTRA_LOGGERS
here. Can you try "['pangeo_forge.recipe']"
instead? Note the outer quote and the bracket. I was able to replicate your behavior with Cloud and LocalRun by removing the outer quotes and bracket.Sean Harkins
04/17/2021, 3:18 PM17 April 2021,10:07:45 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[0]': Starting task run...
17 April 2021,10:07:47 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[0]': Finished task run for task with final state: 'Success'
17 April 2021,10:07:48 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[11]': Starting task run...
17 April 2021,10:07:49 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[11]': Finished task run for task with final state: 'Success'
17 April 2021,10:07:49 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[10]': Starting task run...
17 April 2021,10:07:51 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[10]': Finished task run for task with final state: 'Success'
And here are the logs captured in Cloudwatch for the Dask worker
INFO:prefect.CloudTaskRunner:Task 'MappedTaskWrapper[0]': Starting task run...
INFO:pangeo_forge.recipe:Caching input (0,)
[2021-04-17 15:07:47+0000] INFO - prefect.CloudTaskRunner | Task 'MappedTaskWrapper[0]': Finished task run for task with final state: 'Success'
INFO:prefect.CloudTaskRunner:Task 'MappedTaskWrapper[0]': Finished task run for task with final state: 'Success'
[2021-04-17 15:07:48+0000] INFO - prefect.CloudTaskRunner | Task 'MappedTaskWrapper[11]': Starting task run...
INFO:prefect.CloudTaskRunner:Task 'MappedTaskWrapper[11]': Starting task run...
INFO:pangeo_forge.recipe:Caching input (11,)
[2021-04-17 15:07:49+0000] INFO - prefect.CloudTaskRunner | Task 'MappedTaskWrapper[11]': Finished task run for task with final state: 'Success'
INFO:prefect.CloudTaskRunner:Task 'MappedTaskWrapper[11]': Finished task run for task with final state: 'Success'
The module logs from the worker don’t seem to be broadcast to the CloudHandler.Kevin Kho
Sean Harkins
04/17/2021, 3:54 PMKevin Kho
Sean Harkins
04/17/2021, 8:27 PMdistributed
logger but as stated in the link you mentioned, distributed
uses the standard logger so according to the extra logger docs I should be able to specify them and have log output directed to Cloud.
At the moment and I was just trying to get my custom module’s logger output directed to cloud via extra loggers. The issue was that I was configuring PREFECT__LOGGING__EXTRA_LOGGERS
for the ECSRun
rather than the DaskExecutor
which defines the environment settings for the Dask scheduler and worker nodes. So using
DaskExecutor(
cluster_class="dask_cloudprovider.aws.FargateCluster",
"environment": {
"PREFECT__LOGGING__EXTRA_LOGGERS": "['pangeo_forge.recipe']"
},
)
My module’s log output gets directed to Cloud.
17 April 2021,03:08:45 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[6]': Starting task run...
17 April 2021,03:08:45 pangeo_forge.recipe INFO Caching input (6,)
17 April 2021,03:08:46 prefect.CloudTaskRunner INFO Task 'MappedTaskWrapper[6]': Finished task run for task with final state: 'Success'
Sean Harkins
04/17/2021, 8:30 PMdistributed
in PREFECT__LOGGING__EXTRA_LOGGERS
but it doesn’t seem to be directing logs to the CloudHandler
. Is this because Dask has already configured the handler?https://github.com/dask/distributed/blob/611414c0529daba3007a13a2ee7230e1881942b9/distributed/config.py#L86Sean Harkins
04/17/2021, 8:42 PMKevin Kho
the Python logging module just re-initializes itself after pickling
. So attaching the handler does not survive being sent to the workers.Sean Harkins
04/17/2021, 9:08 PMKevin Kho
Kevin Kho