Skip to content

Commit

Permalink
Remove some log noise in pause and abort handling (#17014)
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw authored Feb 7, 2025
1 parent 3959a3b commit e38b549
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
13 changes: 4 additions & 9 deletions src/prefect/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,13 @@
else:
run_flow(flow, flow_run=flow_run, error_logger=run_logger)

except Abort as abort_signal:
abort_signal: Abort
except Abort:
engine_logger.info(
f"Engine execution of flow run '{flow_run_id}' aborted by orchestrator:"
f" {abort_signal}"
"Engine execution of flow run '{flow_run_id}' aborted by orchestrator."
)
exit(0)
except Pause as pause_signal:
pause_signal: Pause
engine_logger.info(
f"Engine execution of flow run '{flow_run_id}' is paused: {pause_signal}"
)
except Pause:
engine_logger.info(f"Engine execution of flow run '{flow_run_id}' is paused.")
exit(0)
except Exception:
engine_logger.error(
Expand Down
16 changes: 8 additions & 8 deletions src/prefect/flow_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,8 @@ def run_flow(
ret_val = run_flow_async(**kwargs)
else:
ret_val = run_flow_sync(**kwargs)
except (Abort, Pause):
raise
except:
if error_logger:
error_logger.error(
Expand Down Expand Up @@ -1597,20 +1599,18 @@ def run_flow_with_env(
# This is running in a brand new process, so there won't be an existing
# event loop.
asyncio.run(maybe_coro)
except Abort as abort_signal:
abort_signal: Abort
except Abort:
if flow_run:
msg = f"Execution of flow run '{flow_run.id}' aborted by orchestrator: {abort_signal}"
msg = f"Execution of flow run '{flow_run.id}' aborted by orchestrator."
else:
msg = f"Execution aborted by orchestrator: {abort_signal}"
msg = "Execution aborted by orchestrator."
engine_logger.info(msg)
exit(0)
except Pause as pause_signal:
pause_signal: Pause
except Pause:
if flow_run:
msg = f"Execution of flow run '{flow_run.id}' is paused: {pause_signal}"
msg = f"Execution of flow run '{flow_run.id}' is paused."
else:
msg = f"Execution is paused: {pause_signal}"
msg = "Execution is paused."
engine_logger.info(msg)
exit(0)
except Exception:
Expand Down

0 comments on commit e38b549

Please sign in to comment.