Skip to content

Add pending task tracking to Guest for workload monitoring#4696

Draft
skycastlelily wants to merge 1 commit intomainfrom
task-tracking
Draft

Add pending task tracking to Guest for workload monitoring#4696
skycastlelily wants to merge 1 commit intomainfrom
task-tracking

Conversation

@skycastlelily
Copy link
Collaborator

Implements task counters on Guest objects to track pending test executions during the execute phase. This enables:

  • Resource management and cleanup decisions based on guest workload
  • Progress monitoring across distributed test execution
  • Proper state handling during abort scenarios
  • Foundation for future load balancing enhancements

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@skycastlelily skycastlelily marked this pull request as draft March 13, 2026 14:36
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces pending task tracking on Guest objects, which is a valuable addition for workload monitoring and resource management. The implementation is thread-safe and handles task increments and decrements correctly, including in abort scenarios.

I've identified two areas for improvement in tmt/steps/execute/__init__.py to enhance code clarity and conciseness. One is simplifying a loop for finding a discover phase, and the other is removing a redundant condition check.

Comment on lines +1305 to +1309
discover_phase = None
for discover in self.plan.discover.phases(classes=(DiscoverPlugin,)):
if discover.name == discover_phase_name and discover.enabled_by_when:
discover_phase = discover
break
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Simplify finding the discover phase. Use next() with a generator expression for conciseness and improved readability.

                    discover_phase = next((
                        discover for discover in self.plan.discover.phases(classes=(DiscoverPlugin,))
                        if discover.name == discover_phase_name and discover.enabled_by_when),
                        None)


# Check if this test runs on any of the current guests
for guest in guests:
if test.enabled_on_guest is None or test.enabled_on_guest(guest):
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Remove the redundant test.enabled_on_guest is None check. The enabled_on_guest attribute is a method and can never be None, so this check is always false.

                                if test.enabled_on_guest(guest):

  Implements task counters on Guest objects to track pending test executions during the execute phase. This enables:

  - Resource management and cleanup decisions based on guest workload
  - Progress monitoring across distributed test execution
  - Proper state handling during abort scenarios
  - Foundation for future load balancing enhancements
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.

1 participant