Skip to content

Conversation

mkundu1
Copy link
Contributor

@mkundu1 mkundu1 commented Jun 8, 2022

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 if cleanup_on_exit=False passed to launch_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.

@mkundu1 mkundu1 changed the title Feat/finalizer Use finalizer to clean up Session object Jun 8, 2022
self.exit()

@classmethod
def register_on_exit(cls, callback: Callable) -> None:
Copy link
Contributor Author

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)
Copy link
Contributor Author

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.

Copy link
Collaborator

@seanpearsonuk seanpearsonuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!

Copy link
Contributor

@lagacep-ans lagacep-ans left a 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.

@seanpearsonuk
Copy link
Collaborator

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
Copy link
Contributor Author

@mkundu1 mkundu1 Jun 9, 2022

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")
Copy link
Contributor Author

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.

@mkundu1 mkundu1 merged commit 2c17776 into main Jun 9, 2022
@mkundu1 mkundu1 deleted the feat/finalizer branch June 9, 2022 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants