Open fyrestone opened 3 weeks ago
After my investigation, I found that we need to flush the logs when the Prefect ray task is done. This flush can be executed in the prefect_ray
or Prefect can provide an option for the task @task(flush_logs=True)
.
from prefect import flow, task, get_run_logger
from prefect_ray import RayTaskRunner
@task(log_prints=True)
def bar():
print("bar")
logger = get_run_logger()
# Flush the logs.
logger.logger.handlers[0].flush()
# @flow(log_prints=True) # Works good
@flow(task_runner=RayTaskRunner("auto"), log_prints=True) # Missing logs of bar.
def foo():
print("foo")
return bar.submit()
foo()
Thanks for the issue @fyrestone. I can reproduce and will add to our backlog. Thanks also for the workaround and example of how you expect this work.
First check
Bug summary
The Prefect Ray tasks have empty logs in the web UI whenever log_prints is True or not.
Reproduction
Error
No response
Versions (
prefect version
output)Additional context
No response