I cannot log in a task. Logging in a flow is okay....
# prefect-community
k
I cannot log in a task. Logging in a flow is okay. A task is called using submit.
👀 1
b
Hello Kha, you should be able to log in tasks. Here is some documentation on how to accomplish that. https://docs.prefect.io/concepts/logs/#logging-in-tasks
k
I did exactly as instructed here, but I cannot see the log in a task anywhere. Unless I am looking at the wrong place.
Oh, I see now why I don’t have log. It is because I am using RayTaskRunner. If I remove this runner, then I can see log.
Should prefect still capture the logs from ray worker though?
b
Hello Kha, to my understanding you should still be able to capture the logs when using RayTaskRunner. Are you able to reproduce this example? https://discourse.prefect.io/t/raytaskrunner-freezes-when-writing-data-to-a-local-directory/704/3 . The article also mentions an issue that a user had using RayTaskRunner, and that it freezes when a large number of tasks are run, maybe that is similar to what you are experiencing here? How many tasks are you executing? If the problem persists, I'd also recommend creating a GitHub issue, and sharing a simplified version of your code here for troubleshooting.
Also - quick note from the bottom of the article: Note to anyone using
DaskTaskRunner
or `RayTaskRunner`: from prefect version
2.0b8
onwards, those task runners were moved to the respective Prefect Collections for better code dependency management (the core library no longer requires dask or ray as dependencies - now, those can be installed separately when needed). The correct imports are now:
Copy code
from prefect_dask import DaskTaskRunner
from prefect_ray import RayTaskRunner