Skip to content

Configurable global lock log level - #393

Open
rwb27 wants to merge 3 commits into
mainfrom
configurable-global-lock-log-level
Open

Configurable global lock log level#393
rwb27 wants to merge 3 commits into
mainfrom
configurable-global-lock-log-level

Conversation

@rwb27

@rwb27 rwb27 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

The global lock currently logs at WARNING level whenever an action fails to start. This is now configurable - it may be set to INFO or even DEBUG to reduce noise in the log.

If a client tries to invoke an action and the action fails to start because of the global lock, the Invocation object returned will allow the client to determine that it was a global lock failure, regardless of whether or not the error appears in the log.

This cherry-picks the useful commits from #374 to allow the global lock errors to be quietened down, without introducing a new USER level, which we decided wasn't useful for now.

Closes #363

rwb27 added 3 commits August 4, 2026 18:11
When an action can't start because the global lock is busy, it used to log
at level `WARNING`. This is now configurable.

I'm not massively in love with the way this is done, but it works.
There's one issue I need to fix, which is that if you set the loglevel to
`DEBUG` and the server isn't in debug mode, it's not possible
to find out from the client what
happened, i.e. the error is simply "unknown".

Along the way, I found that the handler that provides logs for each
invocation was set to use `INFO` level, even if debug logging was
enabled on the server. I've now removed the level, so that it will
respect whatever the server's been set to.
This ensures that code prior to !370 doesn't give an unknown error by default.
The tests now verify that the client will get the right error, even
if the global lock is set not to show failures in the log.
@rwb27
rwb27 requested a review from bprobert97 August 4, 2026 17:36
@barecheck

barecheck Bot commented Aug 4, 2026

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 97.31%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
src/labthings_fastapi/actions.py598-599, 612, 648-649, 844, 955-957, 988-989, 992, 995, 1043
src/labthings_fastapi/server/__init__.py261, 265, 329, 343-346

@rwb27

rwb27 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

@bprobert97 you've reviewed the first two commits already - the final commit just adds another parameter to the test, for completeness, which passes now that #370 is in.

@julianstirling

Copy link
Copy Markdown
Contributor

I thought we decided that the way to get something to show up in the action log would be to use ThingLogger, allowing this to be used for UI. Any other logging still get the invocation-ID so can be grouped by the downstream code for displaying deeper logs.

As such I think we do still want the "It adds a function to get the parent of all the Thing loggers, for Thing-adjacent code that wants its logs to show up in Invocation logs." item from #374. Because there are things where Thing adjacent code still wants to show up in the UI (in OpenFlexure this would be stitching)

@rwb27 rwb27 added this to the v0.3.0 milestone Aug 5, 2026
Comment thread tests/test_global_lock.py
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.

Add ability to customise log level for failure to get global lock

3 participants