Skip to content

Commit

Permalink
better check
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Aug 25, 2023
1 parent 97835b4 commit b027313
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pioreactor/actions/self_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def _run(self, client, logger: Logger, unit: str, experiment_name: str) -> None:


@click.command(name="self_test")
@click.option("-k", help="see pytest's -k argument", type=str)
@click.option("-k", help="see pytest's -k argument", type=str, default="")
def click_self_test(k: str) -> int:
"""
Test the input/output in the Pioreactor
Expand Down
18 changes: 12 additions & 6 deletions pioreactor/background_jobs/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def check_for_webserver(self):
break
else:
raise ValueError(status)
sleep(1.0)
except Exception as e:
self.logger.debug(f"Error checking lighttpd status: {e}", exc_info=True)
self.logger.error(f"Error checking lighttpd status: {e}")
Expand Down Expand Up @@ -269,17 +270,22 @@ def check_for_webserver(self):
break
else:
raise ValueError(status)
sleep(1.0)
except Exception as e:
self.logger.debug(f"Error checking huey status: {e}", exc_info=True)
self.logger.error(f"Error checking huey status: {e}")

try:
# can we ping ourselves? should have a response
attempt = 0
retries = 5
while attempt < retries:
attempt += 1
res = get("http://localhost")
res.raise_for_status()
except Exception as e:
self.logger.debug(f"Error pinging UI: {e}", exc_info=True)
self.logger.error(f"Error pinging UI: {e}")
if res.ok:
break
sleep(1.0)
else:
self.logger.debug(f"Error pinging UI: {res.status}")
self.logger.error(f"Error pinging UI: {res.status}")
self.flicker_led_with_error_code(error_codes.WEBSERVER_OFFLINE)

def check_for_required_jobs_running(self):
Expand Down
2 changes: 1 addition & 1 deletion pioreactor/background_jobs/od_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def update(self, ir_output_reading: pt.Voltage) -> None:
latest_std = self.led_output_emstd.get_latest()
if latest_std is not None and latest_std > 0.01:
self.logger.warning(
f"The reference PD is very noisy, {latest_std=}. Is the PD in channel {self.channel} correctly positioned? Is the IR LED behaving as expected?"
f"The reference PD is very noisy, std={latest_std:.2g}. Is the PD in channel {self.channel} correctly positioned? Is the IR LED behaving as expected?"
)
self.led_output_emstd.clear() # reset it for i) reduce warnings, ii) if the user purposely changed the IR intensity, this is an approx of that

Expand Down

0 comments on commit b027313

Please sign in to comment.