QTZPOC-20
QTZPOC-20: Enable code_paths for sklearn models; improve worker shutdown handling The MLFlowRepository now resolves and forwards code_paths to mlflow.sklearn.log_model, ensuring custom code dependencies for sklearn models are preserved and correctly reloaded. A new integration test validates this end-to-end functionality. Additionally, worker exception handling is refined to distinguish between deliberate shutdowns (SystemExit, KeyboardInterrupt) and unhandled exceptions, preventing unnecessary error logging for expected exits.
This commit is contained in:
@@ -305,7 +305,14 @@ async def main():
|
||||
# This will run the workers and wait for them to complete.
|
||||
# If an exception occurs in any of the worker handlers, it will be propagated here.
|
||||
await asyncio.gather(*handlers)
|
||||
except BaseException as e:
|
||||
except (SystemExit, KeyboardInterrupt) as e:
|
||||
# Deliberate shutdown (Ctrl+C, a handler's own sys.exit) — not a failure to log as one.
|
||||
# `finally` below calls sys.exit(exit_code) unconditionally, which supersedes this raise
|
||||
# and becomes the exception that actually propagates — the raise is here so this branch
|
||||
# still honors the reraise-on-SystemExit contract, not because it changes what exits.
|
||||
exit_code = e.code if isinstance(e, SystemExit) and isinstance(e.code, int) else 0
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.custom_error(f'An unhandled exception occurred: {e}', metadata)
|
||||
exit_code = 1
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user