https://prefect.io logo
h

Hawkar Mahmod

09/28/2022, 2:23 PM
How do I test a task using
.fn
that contains a call to
get_run_logger
. I get a
RuntimeError: There is no active flow or task run context
exception
1
z

Zanie

09/28/2022, 2:29 PM
Hi! I believe there is an open issue for this. In the meantime, you can do
Copy code
def safe_get_run_logger():
   try:
      return get_run_logger()
   except RuntimeError:
       return logging.getLogger("my_logger")
1
2 Views