Skip to content

chore: Log versions and locations when loading environment#1486

Merged
tpoliaw merged 2 commits intomainfrom
log-module-location
Apr 20, 2026
Merged

chore: Log versions and locations when loading environment#1486
tpoliaw merged 2 commits intomainfrom
log-module-location

Conversation

@tpoliaw
Copy link
Copy Markdown
Contributor

@tpoliaw tpoliaw commented Apr 14, 2026

Second part of #1457

@tpoliaw tpoliaw requested a review from a team as a code owner April 14, 2026 14:14
@tpoliaw tpoliaw force-pushed the log-module-location branch from 3bfa513 to 442e8db Compare April 14, 2026 15:06
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.23%. Comparing base (217d907) to head (cda0734).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1486   +/-   ##
=======================================
  Coverage   95.23%   95.23%           
=======================================
  Files          43       43           
  Lines        3145     3151    +6     
=======================================
+ Hits         2995     3001    +6     
  Misses        150      150           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@oliwenmandiamond
Copy link
Copy Markdown
Contributor

Could you please copy and paste a snippet of logging that that will output so i can see how it looks?

@tpoliaw
Copy link
Copy Markdown
Contributor Author

tpoliaw commented Apr 14, 2026

Running with the system-test config

2026-04-14 16:05:50,731     INFO blueapi.core.context Including devices from 'deviceManager' source dodal.beamlines.adsim:devices (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/beamlines/adsim.py])
2026-04-14 16:05:50,753     INFO blueapi.utils.connect_devices 2 devices connected:
2026-04-14 16:05:50,753     INFO blueapi.utils.connect_devices  det
    stage
2026-04-14 16:05:51,029     INFO blueapi.core.context Including plans from dodal.plans (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/plans/__init__.py])
2026-04-14 16:05:51,041     INFO blueapi.core.context Including plans from dodal.plan_stubs.wrapped (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/plan_stubs/wrapped.py])
2026-04-14 16:05:51,048     INFO blueapi.core.context Including plans from sample_plans (blueapi[version: 1.12.2.dev9+g8e9ce20ea.d20260312, location: /dls/athena/blueapi/src/sample_plans.py])

@oliwenmandiamond
Copy link
Copy Markdown
Contributor

Running with the system-test config

2026-04-14 16:05:50,731     INFO blueapi.core.context Including devices from 'deviceManager' source dodal.beamlines.adsim:devices (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/beamlines/adsim.py])
2026-04-14 16:05:50,753     INFO blueapi.utils.connect_devices 2 devices connected:
2026-04-14 16:05:50,753     INFO blueapi.utils.connect_devices  det
    stage
2026-04-14 16:05:51,029     INFO blueapi.core.context Including plans from dodal.plans (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/plans/__init__.py])
2026-04-14 16:05:51,041     INFO blueapi.core.context Including plans from dodal.plan_stubs.wrapped (dls-dodal[version: 2.2.1, location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/plan_stubs/wrapped.py])
2026-04-14 16:05:51,048     INFO blueapi.core.context Including plans from sample_plans (blueapi[version: 1.12.2.dev9+g8e9ce20ea.d20260312, location: /dls/athena/blueapi/src/sample_plans.py])

Although I would rather have too much information than not enough, this is very verbose. When including the plans, we don't need the dodal version for every plan it uses because it would use the same dodal version? It only needs to be included once. I also think showing the full path is slight overkill because that is basically the same as the python import? For example
dodal.plan_stubs.wrappedand location: /dls/athena/blueapi/.venv/lib/python3.11/site-packages/dodal/plan_stubs/wrapped.py basically convey the same information.

I think the ideal logging would be something like this:

2026-04-14 16:05:50,731     INFO Using bluesky[version: XXX]
2026-04-14 16:05:50,731     INFO Using blueapi[version: 1.12.2.dev9+g8e9ce20ea.d20260312]
2026-04-14 16:05:50,731     INFO Using dls-dodal[version: 2.2.1]
2026-04-14 16:05:50,731     INFO Using ophyd-async[version: 0.17]
2026-04-14 16:05:50,731     INFO Using daq-config-server[version: XXX]
...

These are probably the five most import things we need to know versions of to help find conflicts or behaviour changes (probably missed some). It would be good if it include either these important ones only (+ any others we can think of) or just log the version of every dependency in a list like a CI job does. My preference is probably just log every dependency to be honest and then we can very quickly check exactly what the server is using.

Any thoughts on this though?

@tpoliaw
Copy link
Copy Markdown
Contributor Author

tpoliaw commented Apr 15, 2026

I don't want to be hardcoding packages into blueapi logging. We can deduplicate the packages reported if it would be clearer but only packages included in the environment (as plans or devices) would be included.

The idea of the path was to differentiate which packages were installed in the venv vs the scratch space.

For a full version breakdown you can always use the /python_environment endpoint.

@tpoliaw
Copy link
Copy Markdown
Contributor Author

tpoliaw commented Apr 15, 2026

Logging now reduced to single version report of each package being used for plans or devices

2026-04-15 11:05:43,850     INFO blueapi.core.context Using package blueapi[1.12.2.dev9+g8e9ce20ea.d20260312]
2026-04-15 11:05:43,850     INFO blueapi.core.context Using package dls-dodal[2.2.1]

Copy link
Copy Markdown
Contributor

@oliwenmandiamond oliwenmandiamond left a comment

Choose a reason for hiding this comment

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

Yes I think this is an improvement, thank you!

@tpoliaw tpoliaw force-pushed the log-plan-register branch from fd0625e to dca8962 Compare April 20, 2026 14:51
Base automatically changed from log-plan-register to main April 20, 2026 14:58
@tpoliaw tpoliaw force-pushed the log-module-location branch from c1343b9 to cda0734 Compare April 20, 2026 14:59
@tpoliaw tpoliaw merged commit c8dce0b into main Apr 20, 2026
18 checks passed
@tpoliaw tpoliaw deleted the log-module-location branch April 20, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants