Skip to content

Comments

Allow an action to get a copy of the logs raised during the action.#260

Merged
julianstirling merged 3 commits intomainfrom
get_logs
Feb 24, 2026
Merged

Allow an action to get a copy of the logs raised during the action.#260
julianstirling merged 3 commits intomainfrom
get_logs

Conversation

@julianstirling
Copy link
Contributor

For very long running tasks with lots of things happening (such as scanning on the OpenFlexure microscope) it is useful to be able to save a copy of the logs for a specific action along with the data created during the action.

This adds a function built into the Thing class to allow the action to retrieve its logs.

@barecheck
Copy link

barecheck bot commented Feb 20, 2026

Barecheck - Code coverage report

Total: 96.47%

Your code coverage diff: 0.05% ▴

Uncovered files and lines
FileLines
src/labthings_fastapi/actions.py508-509, 522, 547-548, 673, 817-818, 821, 824, 872
src/labthings_fastapi/thing.py252, 258, 283-285, 317, 405

@julianstirling julianstirling requested a review from rwb27 February 20, 2026 16:03
Copy link
Collaborator

@rwb27 rwb27 left a comment

Choose a reason for hiding this comment

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

I'm happy to approve this with one change, which is the name of Thing.get_logs. I feel fairly strongly that the name of that function should make it very explicit that it's only logs related to the current invocation. That's a minor change, so I'll approve this so you don't need another round trip from me.

It might be nice to disentangle this from the server at some point - but that's too big a change to be in response to PR comments.

I have also flagged that the logs returned will be from all Things, so it would be nice in the future to move this out of Thing and into a module-level function.

@julianstirling julianstirling merged commit 9ec8a20 into main Feb 24, 2026
14 checks passed
@julianstirling julianstirling deleted the get_logs branch February 24, 2026 10:11
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.

2 participants