-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
await app.shutdown() | ||
await app.cleanup() | ||
# waiting here to allow matlab to finish exiting. | ||
await asyncio.sleep(5) |
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.
Is this required? looks like the app cleanup is waiting for the MATLAB process to exist
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.
I think so. i tried several times and in few cases matlab did not completed the exit and I got locked out of the matworks account for about half an hour. I will verify again.
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.
verified. without this delay matlab is not finishing properly and the user is locked out.
jupyter_matlab_proxy/app.py
Outdated
|
||
fu = loop.create_future() | ||
# on SIGTERM setting the future result allowing the loop to exit. | ||
loop.add_signal_handler(signal.SIGTERM, lambda : fu.set_result(True)) |
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.
nit: remove space after lambda
jupyter_matlab_proxy/app.py
Outdated
@@ -398,4 +399,18 @@ def main(): | |||
runner, host=app["settings"]["host_interface"], port=app["settings"]["app_port"] | |||
) | |||
loop.run_until_complete(site.start()) | |||
loop.run_forever() | |||
|
|||
fu = loop.create_future() |
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.
Another option is to keep the loop.run_forever()
, add the signal handler before it, and then call loop.stop()
from shutdown
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.
I must use a synchronous method for the signal handler and shutdown func must remain async so it would wait for app.shutdown() and app.cleanup().
so the lambda now calls loop.stop and then I call loop.run_until_complete(shutdown())
[ch38056] |
No description provided.