Alex Papanicolaou
08/17/2020, 4:52 PMwith prefect.context(loglevel="ERROR"):
inner_flow.run()
original_level = prefect.config.logging.level
prefect.config.logging.level = 'ERROR'
inner_flow.run()
prefect.config.logging.level = original_level
Kyle Moon-Wright
08/17/2020, 5:10 PMinner_flow
to an agent with log_to_cloud=False
through the use of labels, however there is likely a better way of doing this. That snippet you posted may be better for differentiating the types of errors you want for each inner_flow
.Alex Papanicolaou
08/17/2020, 5:12 PM>>> prefect.config.logging.level = 'ERROR'
>>> print(prefect.config.logging)
{'level': 'ERROR', 'format': '[%(asctime)s] %(levelname)s - %(name)s | %(message)s', 'log_attributes': [], 'datefmt': '%Y-%m-%d %H:%M:%S', 'log_to_cloud': False, 'extra_loggers': []}
>>> flow.run(x=1, y=2)
[2020-08-17 17:11:57] INFO - prefect.FlowRunner | Beginning Flow run for 'test'
[2020-08-17 17:11:57] INFO - prefect.FlowRunner | Starting flow run.
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'y': Starting task run...
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'y': finished task run for task with final state: 'Success'
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'x': Starting task run...
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'x': finished task run for task with final state: 'Success'
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'add': Starting task run...
[2020-08-17 17:11:57] INFO - prefect.TaskRunner | Task 'add': finished task run for task with final state: 'Success'
[2020-08-17 17:11:57] INFO - prefect.FlowRunner | Flow run SUCCESS: all reference tasks succeeded
Kyle Moon-Wright
08/17/2020, 5:16 PMinner_flow
to an agent that won't send logs to the UI may be your best bet.Alex Papanicolaou
08/17/2020, 5:26 PM>>> prefect.utilities.logging.prefect_logger.setLevel("ERROR")
>>> flow.run(x=1, y=2)
<Success: "All reference tasks succeeded.">
Kyle Moon-Wright
08/17/2020, 5:27 PM