Goh Rui Zhi
07/21/2021, 8:57 AMmain()
of each job into a task. This runs fine, but the problem is that the logs for the functions outside of each the main()
method will not be logged using prefect.context
and hence not appear on the prefect UI. Is there a way for Prefect to capture all logs without explicitly changing the logger for each of the sub functions to use that of prefect.context
? I know that making each job into a subprocess and then redirecting the stdout into Prefect's logger will work, but would like to avoid using subprocesses in general. Besides, this method also seems very hackish haha.Goh Rui Zhi
07/21/2021, 9:15 AM@task
def process_data():
...
while start_date < end_date:
processor.run()
...
The logs for run()
will not be captured by prefect.Amanda Wee
07/21/2021, 9:51 AMGoh Rui Zhi
07/21/2021, 12:37 PMimport logging
logger = logging.getLogger(__name__)
Can you advise me on how I can get those logs to display on prefect server?Kevin Kho
module.submodule
and module.submodule2
. Attaching module
to the extra loggers like in the link Amanda showed will work in adding all.Goh Rui Zhi
07/22/2021, 3:04 AMGoh Rui Zhi
07/22/2021, 5:30 AMKevin Kho
Goh Rui Zhi
07/23/2021, 10:01 AMexport PREFECT__LOGGING__EXTRA_LOGGERS="['my_module']"
The prefect server is running on GKE.Kevin Kho
KubernetesRun(env={"PREFECT__LOGGING__EXTRA_LOGGERS": "['my_module']"})
Goh Rui Zhi
07/24/2021, 2:32 AM