Skip to content

Commit

Permalink
raise for bad responses in profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jan 18, 2025
1 parent 623defb commit ce3d777
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pioreactor/actions/leader/experiment_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def _callable() -> None:
"env": {"JOB_SOURCE": "experiment_profile", "EXPERIMENT": experiment},
"args": args,
},
)
).raise_for_status()
else:
logger.debug(f"Action's `if` condition, `{if_}`, evaluated False. Skipping action.")

Expand Down Expand Up @@ -584,7 +584,7 @@ def _callable() -> None:
patch_into_leader(
f"/api/workers/{unit}/jobs/update/job_name/{job_name}/experiments/{experiment}",
json={"settings": {"$state": "sleeping"}},
)
).raise_for_status()
else:
logger.debug(f"Action's `if` condition, `{if_}`, evaluated False. Skipping action.")

Expand Down Expand Up @@ -622,7 +622,7 @@ def _callable() -> None:
patch_into_leader(
f"/api/workers/{unit}/jobs/update/job_name/{job_name}/experiments/{experiment}",
json={"settings": {"$state": "ready"}},
)
).raise_for_status()
else:
logger.debug(f"Action's `if` condition, `{if_}`, evaluated False. Skipping action.")

Expand Down Expand Up @@ -659,7 +659,7 @@ def _callable() -> None:
logger.debug(f"Stopping {job_name} on {unit}.")
patch_into_leader(
f"/api/workers/{unit}/jobs/stop/job_name/{job_name}/experiments/{experiment}",
)
).raise_for_status()
else:
logger.debug(f"Action's `if` condition, `{if_}`, evaluated False. Skipping action.")

Expand Down Expand Up @@ -701,7 +701,7 @@ def _callable() -> None:
patch_into_leader(
f"/api/workers/{unit}/jobs/update/job_name/{job_name}/experiments/{experiment}",
json={"settings": {setting: value}},
)
).raise_for_status()
else:
logger.debug(f"Action's `if` condition, `{if_}`, evaluated False. Skipping action.")

Expand Down Expand Up @@ -763,7 +763,7 @@ def push_labels_to_ui(experiment, labels_map: dict[str, str]) -> None:
for unit_name, label in labels_map.items():
patch_into_leader(
f"/api/experiments/{experiment}/unit_labels", json={"unit": unit_name, "label": label}
)
).raise_for_status()
except Exception:
pass

Expand Down
8 changes: 4 additions & 4 deletions pioreactor/calibrations/stirring_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def run_stirring_calibration(

# go up and down to observe any hysteresis.
dcs = (
list(range(round(max_dc), round(min_dc), -3))
+ list(range(round(min_dc), round(max_dc), 3))
+ list(range(round(max_dc), round(min_dc), -3))
list(range(round(max_dc), round(min_dc) - 3, -3))
+ list(range(round(min_dc), round(max_dc) + 3, 3))
+ list(range(round(max_dc), round(min_dc) - 3, -3))
)
n_samples = len(dcs)

Expand All @@ -71,7 +71,7 @@ def run_stirring_calibration(

for count, dc in enumerate(dcs, start=1):
st.set_duty_cycle(dc)
sleep(3)
sleep(1.5)
rpm = rpm_calc.estimate(2)
measured_rpms.append(rpm)
logger.debug(f"Detected {rpm=:.1f} RPM @ {dc=}%")
Expand Down

0 comments on commit ce3d777

Please sign in to comment.