Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eb7650d
Draft of Tiled-based sync-experiment
nmaytan Nov 18, 2025
5231bdc
Cleanups
nmaytan Nov 18, 2025
6ea4e83
Smoothing out wrinkles
nmaytan Nov 19, 2025
fcc593c
Update requirements.txt
nmaytan Nov 20, 2025
c61b6cb
Add catalog root node tags to API keys
nmaytan Nov 21, 2025
8f6679e
Upper the beamline in the root node tag
nmaytan Nov 21, 2025
9e25134
Treat decrypt failure as missing key
nmaytan Nov 25, 2025
1a03caf
Fix vars in cache PQ
nmaytan Nov 25, 2025
aee5df0
Update terminology used by sync-experiment
nmaytan Nov 25, 2025
508fe78
Add note about duo prompt to login message
nmaytan Nov 25, 2025
b4392f0
Add unsync_experiment, update switch_proposal, correct use cases of n…
nmaytan Nov 26, 2025
d792570
Sort data_sessions used for Redis keys to ensure determinism
nmaytan Nov 26, 2025
a16874b
Make switch_proposal work from CLI
nmaytan Nov 26, 2025
7dd2cd8
Fix method name for authz check
nmaytan Nov 26, 2025
bf6af70
Remove redundant lowers for beamline
nmaytan Dec 3, 2025
8e676e9
Add 'ts' for timestamp keys
nmaytan Dec 3, 2025
c4e2262
Use __missing__ to default normalized beamline
nmaytan Dec 3, 2025
37f1cf5
Add prompt for Duo passcode or method
nmaytan Dec 4, 2025
d721718
Minor exception tweaks
nmaytan Dec 4, 2025
a9a0d70
Update docstrings
nmaytan Dec 4, 2025
ca51763
Fix access_tags dtype, update prints
nmaytan Dec 4, 2025
52529c8
Restrict scopes on generated apikeys
nmaytan Dec 8, 2025
78a2646
Remove apikeys scope
nmaytan Dec 9, 2025
05b1b3c
Revoke api keys instead of caching
nmaytan Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update docstrings
  • Loading branch information
nmaytan committed Dec 4, 2025
commit a9a0d70a5a510a8a06dc5774fd957bd79d5ec1f1
52 changes: 48 additions & 4 deletions nslsii/sync_experiment/sync_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ def sync_experiment(
endstation: str | None = None,
verbose: bool = False,
) -> RedisJSONDict:
"""Sync a new experiment (proposal) at the beamline.
Authorizes the requested proposals, and activates one of them.

Parameters
----------
proposal_ids : list[int or str]
the list of proposal IDs to authorize
activate_id : int or str (optional)
the ID number of the proposal to activate (defaults to the first proposal in proposal_ids)
facility : str (optional)
the facility that the beamline belongs to (defaults to "nsls2")
beamline : str or None (optional)
the TLA of the beamline from which the experiment is running, not case-sensitive
endstation : str or None (optional)
the endstation at the beamline from which the experiment is running, not case-sensitive
verbose : bool (optional)
turn on verbose printing

Returns
-------
md : RedisJSONDict
The updated metadata dictionary
"""
env_beamline, env_endstation = get_beamline_env()
Comment thread
nmaytan marked this conversation as resolved.
beamline = beamline or env_beamline
endstation = endstation or env_endstation
Expand Down Expand Up @@ -186,6 +209,25 @@ def unsync_experiment(
endstation: str | None = None,
verbose: bool = False,
) -> RedisJSONDict:
"""Unsync the currently active experiment (proposal) at the beamline.
Also deauthorizes all currently authorized proposals.

Parameters
----------
facility : str (optional)
the facility that the beamline belongs to (defaults to "nsls2")
beamline : str or None (optional)
the TLA of the beamline from which the experiment is running, not case-sensitive
endstation : str or None (optional)
the endstation at the beamline from which the experiment is running, not case-sensitive
verbose : bool (optional)
turn on verbose printing

Returns
-------
md : RedisJSONDict
The updated metadata dictionary
"""
env_beamline, env_endstation = get_beamline_env()
beamline = beamline or env_beamline
endstation = endstation or env_endstation
Expand Down Expand Up @@ -254,16 +296,18 @@ def switch_proposal(

Parameters
----------
proposal_id: int or str
proposal_id : int or str
the ID number of the proposal to activate
username: str or None (optional)
username : str or None (optional)
the current user's username - will prompt if no provided.
facility: str (optional)
facility : str (optional)
the facility that the beamline belongs to (defaults to "nsls2")
beamline: str or None (optional)
beamline : str or None (optional)
the TLA of the beamline from which the experiment is running, not case-sensitive
endstation : str or None (optional)
the endstation at the beamline from which the experiment is running, not case-sensitive
verbose : bool (optional)
turn on verbose printing

Returns
-------
Expand Down