Skip to content
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

Cleanup After Init behavior should better match MeasurementLink workflow #417

Merged
merged 12 commits into from
Dec 4, 2023

Conversation

pbirkhol-ni
Copy link
Contributor

@pbirkhol-ni pbirkhol-ni commented Nov 28, 2023

What does this Pull Request accomplish?

#418

ISessionFactory has an optional override called Clean Up After Init Error.vi. Historically, this VI has attempted to put the grpc-device server back into the same state it was in before initialize was called. However, this can cause issues with the MeasurementLink workflow. For example, during ProcessCleanup, we initialize sessions with Attach and Close. If that step fails, we still want those sessions to be closed. However, the current behavior would leave those sessions open on the grpc-device server. This would cause rerunning the TestStand sequence to fail when creating the sessions. This PR attempts to fix this workflow, although I think some of the decisions I made will be controversial.

Below are the behaviors that I added to this PR:

  • Init and Close: On error, don't initialize any more sessions. Call close to clean up any sessions that had been created before the error.
  • Init and Detach: On error, don't initialize any more sessions. Call close to clean up any sessions that had been created before the error.
  • Attach and Detach: On error, don't attach to any more sessions. Call detach to clean up any sessions that had been attached before the error.
  • Attach and Close: On error, keep trying to attach to sessions. Once we have tried to attach to all sessions, call close on any sessions that were successfully attached.

The Init and Close and Attach and Detach behaviors aren't controversial. I also don't think Init and Detach is too controversial. Rather than detaching, we are closing the sessions so that the instruments are in the same state as before we called Initialize.

For Attach and Close, I modified Initialize Sessions Impl.vi such that we try to attach to the session even if a previous attach had failed. This gives us the best chance at successfully cleaning up all sessions so that when we run again it doesn't fail because the session still exists on the grpc-device server. However, it could lead to issues where all sessions fail to Attach and so it takes a long time to fail.

What testing has been done?

Automated tests. I modified some existing automated tests rather than write new ones. We already had existing automated tests for the various init/close behaviors. I just added more sessions to these tests to verify that in the Attach and Close case that we try to attach to all sessions, even after failure.

@pbirkhol-ni pbirkhol-ni changed the title Cleanup After Init behavior should better match MeasurementLink workflow Draft: Cleanup After Init behavior should better match MeasurementLink workflow Nov 30, 2023
@pbirkhol-ni pbirkhol-ni changed the title Draft: Cleanup After Init behavior should better match MeasurementLink workflow RFC: Cleanup After Init behavior should better match MeasurementLink workflow Dec 1, 2023
@pbirkhol-ni pbirkhol-ni marked this pull request as ready for review December 1, 2023 20:24
@ni ni deleted a comment from pbirkhol-ni Dec 4, 2023
@pbirkhol-ni pbirkhol-ni changed the title RFC: Cleanup After Init behavior should better match MeasurementLink workflow Cleanup After Init behavior should better match MeasurementLink workflow Dec 4, 2023
@pbirkhol-ni pbirkhol-ni merged commit 3e11ea2 into main Dec 4, 2023
2 checks passed
@pbirkhol-ni pbirkhol-ni deleted the users/pbirkhol/fix-cleanup-after-init branch December 4, 2023 22:25
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.

2 participants