-
Notifications
You must be signed in to change notification settings - Fork 56
Use finalizer to clean up Session object #480
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
Conversation
self.exit() | ||
|
||
@classmethod | ||
def register_on_exit(cls, callback: Callable) -> None: |
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.
Not used anywhere, thus removed it
self.events_manager, | ||
self._remote_instance, | ||
) | ||
Session._monitor_thread.cbs.append(self._finalizer) |
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 still required to avoid the hang during exit.
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.
!!
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.
thanks, yes this is adding "out of scope" cleanup capability, great.
unit test currently failing; I have restarted but I guess the tests are repeatable |
time.sleep(10) | ||
containers_after = client.containers.list() | ||
new_containers = set(containers_after) - set(containers_before) | ||
assert not new_containers |
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.
Check if the container has been shut down during CI run.
from util.solver_workflow import new_solver_session # noqa: F401 | ||
|
||
|
||
@pytest.mark.skip("randomly failing due to missing transcript capture") |
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.
Disabling this for now, we have other unittests making TUI calls.
Use a finalizer to shut down the server when the session instance goes out-of-scope or
session.exit()
is called. The server won't be shut down ifcleanup_on_exit=False
passed tolaunch_fluent
.I feel we should support the above behaviour for 22.2. We can implement the timeout behaviour (#481) in 23.1 which requires server-side change.