Refactor auth mechanism in sync-experiment #198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: Some beamlines (e.g. SMI) collect data on multiple proposals during the same run to make use of the same environment conditions between the experiments (e.g. temperature); changing these conditions often would unnecessarily require too much downtime for the instruments.
Our current
sync-experiment
workflow assumes that a user (or a beamline scientist) switches to a new proposal at the beginning of acquisition (possibly even before openingbsui
). This would be impractical for highly dynamic or automated plans as above.This PR Separates the authentication mechanism in the internal
sync_experiment
function from the updating of the redis dictionary. This would allow us to switch between multiple proposals within a profile_collection plan (using the newswitch_redis_proposal(proposal_number, beamline, username, prefix)
function -- SMI already have something very similar that they extensively use in their profile collection, and the idea is to just replace it). This function will still check if a user has the rights to collect data on a proposal, but wouldn't ask for their password. We will need that before runningbsui
or in the base step of profile collection, the user properly authenticates withsync-experiment
(this is effectively an honor system, but writing the data in a correct location is is in their interests, because otherwise they won't be able to read it).These refactoring changes will not break any existing deployments.