Skip to content

Conversation

@richtja
Copy link
Contributor

@richtja richtja commented Jan 15, 2025

This PR introduces the suspend execution feature to the nrunner. The
suspend execution was available on the legacy runner, but we didn't move
it to the nrunner. With this feature, it is possible to pause execution
of python based task on process spawner by sending SIGTSTP signal
(ctrl+z). It is helpful for debugging test execution.

Reference: #6059
Signed-off-by: Jan Richter jarichte@redhat.com

@richtja richtja added this to the 110 - Codename TBD milestone Jan 15, 2025
@richtja richtja self-assigned this Jan 15, 2025
@richtja richtja marked this pull request as draft January 15, 2025 15:14
@richtja richtja force-pushed the runners_refactor branch 2 times, most recently from 52ef928 to 5101e9a Compare January 23, 2025 10:49
@codecov
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 90.98039% with 23 lines in your changes missing coverage. Please review.

Project coverage is 69.55%. Comparing base (fbe6a75) to head (0bda174).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
avocado/plugins/runners/sysinfo.py 83.33% 4 Missing ⚠️
avocado/core/nrunner/runner.py 96.10% 3 Missing ⚠️
avocado/core/task/statemachine.py 82.35% 3 Missing ⚠️
avocado/plugins/runners/vmimage.py 72.72% 3 Missing ⚠️
avocado/core/plugin_interfaces.py 50.00% 2 Missing ⚠️
avocado/plugins/runners/avocado_instrumented.py 88.23% 2 Missing ⚠️
avocado/plugins/runners/python_unittest.py 83.33% 2 Missing ⚠️
avocado/plugins/spawners/process.py 77.77% 2 Missing ⚠️
avocado/plugins/runners/package.py 92.30% 1 Missing ⚠️
avocado/plugins/runners/pip.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6090      +/-   ##
==========================================
+ Coverage   68.34%   69.55%   +1.21%     
==========================================
  Files         205      205              
  Lines       22268    22153     -115     
==========================================
+ Hits        15219    15409     +190     
+ Misses       7049     6744     -305     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richtja richtja force-pushed the runners_refactor branch 3 times, most recently from aeb256a to 852a64e Compare January 23, 2025 15:47
@richtja richtja force-pushed the runners_refactor branch 6 times, most recently from a09dcd6 to b76dc76 Compare March 28, 2025 13:45
@richtja richtja marked this pull request as ready for review March 28, 2025 14:56
Copy link
Contributor

@clebergnu clebergnu left a comment

Choose a reason for hiding this comment

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

Hi @richtja,

Thank you for the work in this feature!

The direction of this work, that is, implementing the pause/resume of tasks in the Spawner is definitely correct IMO. What I don't get is the scope of the refactor. AFAICT:

  1. The "PythonBaseRunner" is unclear in its purpose (it ends up not being for Python code, that is, python-unittest and avocado-instrumented only)
  2. The refactor leaves some duplication of the logic of monitoring the updates within a runner (that is, PythonBaseRunner._monitor() and BaseRunner.running_loop().
  3. It introduces a mostly uniform approach to write new runners, but still leaves some runners out (e.g. exec-test).

Can you elaborate on those points? Thanks!

@richtja richtja force-pushed the runners_refactor branch 5 times, most recently from 13ca48d to 632e9bd Compare April 17, 2025 11:47
@richtja richtja requested a review from clebergnu April 17, 2025 13:23
@richtja
Copy link
Contributor Author

richtja commented Apr 17, 2025

Hi @clebergnu, I did a refactor to move all the common code under the BaseRunner. Please take a look.

This is a refactoring of runners. It moves most of the code related to
running and monitoring processes into base class. This change removes
duplicities across the runners, and it will help with implementation of
common features like signal handling. Also it makes the future
development of new runners easier, because developers can focus on
actual runner and don't have to deal with things like process
monitoring, logging and exception handling

Signed-off-by: Jan Richter <jarichte@redhat.com>
This is a removal of legacy code for signal handling. This signal
handling was useful for the legacy runner where all tasks were running
in child processes. But now when we use spawners for creating tasks each
with different implementation, we need to handle the signal handling in
the spawners itself.

Signed-off-by: Jan Richter <jarichte@redhat.com>
@richtja richtja force-pushed the runners_refactor branch 2 times, most recently from 4d4adc8 to 573d600 Compare April 23, 2025 15:10
This commit introduces the suspend execution feature to the nrunner. The
suspend execution was available on the legacy runner, but we didn't move
it to the nrunner. With this feature, it is possible to pause execution
of python based task on process spawner by sending SIGTSTP signal
(ctrl+z). It is helpful for debugging test execution.

Reference: avocado-framework#6059
Signed-off-by: Jan Richter <jarichte@redhat.com>
@richtja richtja marked this pull request as draft April 23, 2025 15:45
@richtja richtja removed this from the 111 - Codename TBD milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review Requested

Development

Successfully merging this pull request may close these issues.

2 participants