Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up i24 serial logs #572

Merged
merged 36 commits into from
Nov 5, 2024
Merged

Tidy up i24 serial logs #572

merged 36 commits into from
Nov 5, 2024

Conversation

noemifrisina
Copy link
Contributor

@noemifrisina noemifrisina commented Oct 15, 2024

  • Use common log configuration
  • Fix issue with log messages being written to file multiple times
  • Set level of stream handler to INFO
  • Only integrate bluesky and ophyd_async loggers, as no ophyd devices are used for serial anymore

Closes #557

@noemifrisina noemifrisina added the I24 serial Issues relating to ssx on I24 label Oct 15, 2024
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 65.20548% with 127 lines in your changes missing coverage. Please review.

Project coverage is 80.00%. Comparing base (20dfdec) to head (8d3406c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #572      +/-   ##
==========================================
+ Coverage   78.67%   80.00%   +1.32%     
==========================================
  Files          97       97              
  Lines        6848     6806      -42     
==========================================
+ Hits         5388     5445      +57     
+ Misses       1460     1361      -99     
Components Coverage Δ
i24 SSX 60.20% <65.20%> (+2.62%) ⬆️
hyperion 96.73% <ø> (ø)
other 94.96% <ø> (ø)

@noemifrisina noemifrisina marked this pull request as ready for review October 15, 2024 15:00
@noemifrisina
Copy link
Contributor Author

Deferred to after #573 is done and running on the beamline because of permission problems if run by staff/users

Copy link
Contributor

@olliesilvester olliesilvester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this wasn't actually finished yet, but I've added some comments anyway

@@ -103,7 +106,7 @@ def config(
integrate_all_logs=False,
)
# Remove dodal StreamHandler to avoid duplication of messages above debug
dodal_logger.removeHandler(dodal_logger.handlers[0])
# dodal_logger.removeHandler(dodal_logger.handlers[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should: remove this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was accidentally commented out, sorry, fixed it now

src/mx_bluesky/beamlines/i24/serial/log.py Show resolved Hide resolved
src/mx_bluesky/beamlines/i24/serial/log.py Show resolved Hide resolved
src/mx_bluesky/beamlines/i24/serial/log.py Outdated Show resolved Hide resolved
src/mx_bluesky/beamlines/i24/serial/run_serial.py Outdated Show resolved Hide resolved
src/mx_bluesky/beamlines/i24/serial/run_serial.py Outdated Show resolved Hide resolved
Copy link
Contributor

@olliesilvester olliesilvester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added some small comments. There are quite a few lines with no test coverage, but I will approve anyway as I know you're keen to test a release today.

A lot of the the untested lines are logging statements, I'd suggest testing them using by setting up logging in pytest_runtest_setup(item) in an i24 conftest, similiar to what we have in mx-bluesky/tests/conftest.py. Then we can easily assert logging calls after a@patch("mx_bluesky.beamlines.i24.serial.log.SSX_LOGGER")

logger.addHandler(logging.NullHandler())
logger.parent = dodal_logger
SSX_LOGGER = logging.getLogger("I24serial")
SSX_LOGGER.addHandler(logging.NullHandler())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the NullHandler for?

@@ -68,10 +58,8 @@ def _read_visit_directory_from_file() -> Path:


def _get_logging_file_path() -> Path:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might have already discussed this, but I can't remember. How come this needs to be in a different location to that given by the common util function (/dls_sw/{beamline}/logs/bluesky/)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SO that users/staff can access it, this is the logger that looks like the old output they are used to. May not be needed for long, but for the moment it's useful for debugging

# Open the edm screen for a fixed target serial collection
echo "Starting fixed target edm screen."
edm -x "${edm_path}/FT-gui/DiamondChipI24-py3v1.edl"

echo "Edm screen closed, bye!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more bye! :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... it's three lines or so later :)

@noemifrisina noemifrisina merged commit 78a31cc into main Nov 5, 2024
21 of 22 checks passed
@noemifrisina noemifrisina deleted the ssx-fix-logs branch November 5, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I24 serial Issues relating to ssx on I24
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I24 ssx: tidy up log configuration
2 participants