-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
54 figure out a better alternative for the celery subprocess in subprocess problem #58
54 figure out a better alternative for the celery subprocess in subprocess problem #58
Conversation
…d upon a cancel and encapsulate SystemExit exceptions which are thrown by Mesido into an EarlySystemExit.
update_progress_function=None, | ||
profile_reader=InfluxDBProfileReader, | ||
) | ||
except SystemExit as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only triggered when mesido throws the SystemExit as it runs in a subprocess
output_esdl = pool.map(run_mesido, [input_esdl])[0] | ||
try: | ||
output_esdl = pool.map(run_mesido, [input_esdl])[0] | ||
except SystemExit as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is triggered when Celery throws a SystemExit to cancel the current task. It will terminate the mesido worker subprocess with a SIGKILL to ensure it does not wait till it dies gracefully. Casadi is blocking any way to gracefully shutdown the process as it doesn't release the GIL.
@@ -23,6 +26,16 @@ | |||
GROW_TASK_TYPE = GrowTaskType(os.environ.get("GROW_TASK_TYPE")) | |||
|
|||
|
|||
class EarlySystemExit(Exception): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from omotes-sdk-python to here. As Celery uses the SystemExit mechanism to also stop the running worker gracefully, before it would catch the SystemExit and not let the worker process terminate as expected.
No description provided.