Skip to content

Commit

Permalink
Beamline test hotfixes (#127)
Browse files Browse the repository at this point in the history
* Kill all blueapi processes when exiting and logging workaround

* Tidy  up

* Temporarily pin to blueapi main
  • Loading branch information
noemifrisina authored Jul 18, 2024
1 parent 0f71f2b commit 4e45b75
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"pydantic",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@a4adbadfaae60b5158cf19647dba42b79280e103",
"fastapi[all]<0.99",
"blueapi>=0.4.3-a3",
"blueapi @ git+https://github.com/DiamondLightSource/blueapi.git@main",
]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down
12 changes: 10 additions & 2 deletions src/mx_bluesky/I24/serial/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from pathlib import Path
from typing import Optional

from bluesky.log import logger as bluesky_logger
from dodal.log import (
ERROR_LOG_BUFFER_LINES,
integrate_bluesky_and_ophyd_logging,
set_up_all_logging_handlers,
)
from dodal.log import LOGGER as dodal_logger
from ophyd_async.log import logger as ophyd_async_logger

VISIT_PATH = Path("/dls_sw/i24/etc/ssx_current_visit.txt")

Expand All @@ -19,7 +20,7 @@ class OphydDebugFilter(logging.Filter): # NOTE yet to be fully tested
"""Do not send ophyd debug log messages to stream handler."""

def filter(self, record):
return not record.getMessage().lower().startswith("ophyd")
return "ophyd" not in record.getMessage().lower()


# Logging set up
Expand Down Expand Up @@ -88,6 +89,13 @@ def _get_logging_file_path() -> Path:
return logging_path


def integrate_bluesky_and_ophyd_logging(parent_logger: logging.Logger):
"""Integrate only bluesky and ophyd_async loggers."""
for logger in [bluesky_logger, ophyd_async_logger]:
logger.parent = parent_logger
logger.setLevel(logging.DEBUG)


def default_logging_setup(dev_mode: bool = False):
""" Default log setup for i24 serial.
Expand Down
2 changes: 1 addition & 1 deletion src/mx_bluesky/I24/serial/run_extruder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ edm -x "${edm_path}/EX-gui/DiamondExtruder-I24-py3v1.edl"

echo "Edm screen closed, bye!"

pgrep blueapi | xargs kill -9
pgrep blueapi | xargs kill
echo "Blueapi process killed"
2 changes: 1 addition & 1 deletion src/mx_bluesky/I24/serial/run_fixed_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ edm -x "${edm_path}/FT-gui/DiamondChipI24-py3v1.edl"

echo "Edm screen closed, bye!"

pgrep blueapi | xargs kill -9
pgrep blueapi | xargs kill
echo "Blueapi process killed"

0 comments on commit 4e45b75

Please sign in to comment.