Skip to content

Commit

Permalink
Merge pull request #193 from nmaytan/prefix_sst_sync
Browse files Browse the repository at this point in the history
Fix sync_experiment for sst, enable custom prefix
  • Loading branch information
danielballan authored Sep 18, 2024
2 parents 852f581 + 4cf3f4b commit 41f113f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions nslsii/sync_experiment/sync_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ class AuthorizationError(Exception): ...

def sync_experiment(proposal_number, beamline, verbose=False, prefix=""):

redis_client = redis.Redis(host=f"info.{beamline.lower()}.nsls2.bnl.gov")
normalized_beamlines = {
"sst1": "sst",
"sst2": "sst",
}
redis_beamline = normalized_beamlines.get(beamline.lower(), beamline)
redis_client = redis.Redis(host=f"info.{redis_beamline.lower()}.nsls2.bnl.gov")

md = RedisJSONDict(redis_client=redis_client, prefix=prefix)
redis_prefix = f"{prefix}-" if prefix else ""
md = RedisJSONDict(redis_client=redis_client, prefix=redis_prefix)

new_data_session = f"pass-{proposal_number}"
username = input("Username : ")
Expand Down Expand Up @@ -177,6 +183,14 @@ def main():
help="Which beamline (e.g. CHX)",
required=True,
)
parser.add_argument(
"-e",
"--endstation",
dest="prefix",
type=str,
help="Prefix for redis keys (e.g. by endstation)",
required=False,
)
parser.add_argument(
"-p",
"--proposal",
Expand All @@ -189,5 +203,8 @@ def main():

args = parser.parse_args()
sync_experiment(
proposal_number=args.proposal, beamline=args.beamline, verbose=args.verbose
proposal_number=args.proposal,
beamline=args.beamline,
verbose=args.verbose,
prefix=args.prefix,
)

0 comments on commit 41f113f

Please sign in to comment.