Skip to content

Commit

Permalink
Merge pull request #109 from simonsobs/koopman/undo-op-split
Browse files Browse the repository at this point in the history
Revert "Separate series and parallel logic"
  • Loading branch information
BrianJKoopman authored Dec 8, 2023
2 parents 0734f8f + 9ecb6c0 commit 96e980d
Showing 1 changed file with 14 additions and 46 deletions.
60 changes: 14 additions & 46 deletions src/sorunlib/smurf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,6 @@ def _wait_for_cryo(time_):
time.sleep(wait)


def _run_in_series(operation, settling_time, **kwargs):
"""Run operation in series across all active SMuRF controllers.
Additional kwargs are passed directly to the ``.start()`` call.
Args:
operation (str): Operation name.
settling_time (float):
Time in seconds to wait between operation runs across the active
SMuRF controllers. If None will wait for ``CRYO_WAIT`` seconds.
"""
for smurf in run.CLIENTS['smurf']:
op = smurf.__getattribute__(operation)
op.start(**kwargs)
resp = op.wait()
check_response(smurf, resp)

# Allow cryo to settle
_wait_for_cryo(settling_time)


def _run_in_parallel(operation, **kwargs):
"""Run operation in parallel across all active SMuRF controllers.
Additional kwargs are passed directly to the ``.start()`` call.
Args:
operation (str): Operation name.
"""
for smurf in run.CLIENTS['smurf']:
op = smurf.__getattribute__(operation)
op.start(**kwargs)

for smurf in run.CLIENTS['smurf']:
op = smurf.__getattribute__(operation)
resp = op.wait()
check_response(smurf, resp)


def _run_op(operation, concurrent, settling_time, **kwargs):
"""Run operation across all active SMuRF controllers.
Expand All @@ -75,12 +34,21 @@ def _run_op(operation, concurrent, settling_time, **kwargs):
time of 120 seconds.
"""
for smurf in run.CLIENTS['smurf']:
op = smurf.__getattribute__(operation)
op.start(**kwargs)
if not concurrent:
resp = op.wait()
check_response(smurf, resp)

# Allow cryo to settle
_wait_for_cryo(settling_time)

if concurrent:
_run_in_parallel(operation, **kwargs)
else:
_run_in_series(operation,
settling_time=settling_time,
**kwargs)
for smurf in run.CLIENTS['smurf']:
op = smurf.__getattribute__(operation)
resp = op.wait()
check_response(smurf, resp)


def set_targets(targets):
Expand Down

0 comments on commit 96e980d

Please sign in to comment.