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

improve handing of background tasks in the coordinator #1579

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

jluebbe
Copy link
Member

@jluebbe jluebbe commented Jan 24, 2025

With many places and resources, saving them can take seconds and block the main loop.
Avoid that by moving that off to an executor thread.

Also split the background tasks so they don't block each other needlessly.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
With many resources, yaml.dump(resources) takes a few seconds. To avoid
blocking the main loop for this long, make a copy and serialize via a
threaded executor.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Reacquiring orphaned resources can take some time, but we don't want to
block saving or scheduling in the meantime, so split them into separate
asyncio tasks.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
As the state is saved in a separate thread, longer times are not
as problematic, so move them to debug log level.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.

Project coverage is 56.0%. Comparing base (fc33503) to head (aea1add).
Report is 5 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/remote/coordinator.py 0.0% 45 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1579     +/-   ##
========================================
- Coverage    56.1%   56.0%   -0.1%     
========================================
  Files         170     170             
  Lines       13287   13306     +19     
========================================
  Hits         7458    7458             
- Misses       5829    5848     +19     
Flag Coverage Δ
3.10 56.0% <0.0%> (-0.1%) ⬇️
3.11 56.0% <0.0%> (-0.1%) ⬇️
3.12 56.0% <0.0%> (-0.1%) ⬇️
3.13 56.0% <0.0%> (-0.1%) ⬇️
3.9 56.0% <0.0%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@jluebbe jluebbe merged commit 4f6a805 into labgrid-project:master Jan 24, 2025
9 of 11 checks passed
@jluebbe jluebbe deleted the avoid-loop-blocking branch January 24, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants