Repository navigation
[AAP-96820] Put receptor work-unit operations behind an interface with a fake - #16729
Draft
chrismeyersfsu wants to merge 5 commits into
Draft
chrismeyersfsu wants to merge 5 commits into
chrismeyersfsu wants to merge 5 commits into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Move the decisions the heartbeat makes about lost instances and orphaned jobs into awx.main.tasks.adoption_decisions: which peers are lost, which lost instances the mesh gate lets through, what happens to a lost instance and its jobs, whether a running job is adopted, reaped or left alone, and whether an orphan is past the adoption deadline. The functions read plain attributes and touch no database, receptor or dispatcher, so they can be tested with simple objects. awx.main.tasks.system keeps the queries and side effects and calls the decisions. Behavior is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
gate_lost_instances now takes the mesh check as a callable and skips it when nothing is lost, so the heartbeat has no branch of its own there. New tests cover a lost instance's job the decision doesn't reap, and a heartbeat job the decision skips. Co-Authored-By: Claude <noreply@anthropic.com>
Cases that differ only in their inputs are now rows of one test, each named by its id. Co-Authored-By: Claude <noreply@anthropic.com>
Streaming results, reading status, canceling and releasing a work unit now go through ReceptorWork instead of raw receptorctl commands. The process phase, error handling, release, same-controller adoption and the work-unit reaper take a ReceptorWork. Behavior is unchanged. awx.main.tests.fake_receptor provides FakeReceptorWork, which serves the ansible-runner worker line protocol from canned events and can break a stream partway, fail status calls or lose a unit. New functional tests drive the real reattach, dedup and finalize code against it, including one that records today's behavior when a results stream breaks: a unit that succeeded is finalized failed. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
chrismeyersfsu
force-pushed
the
cmeyers-adoption-seam2-receptor-work
branch
from
October 13, 2026 09:06
c366502 to
5824cdc
Compare
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
|
3 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



SUMMARY
Stacked on #16728.
Streaming a job's results, reading a work unit's status, canceling and releasing it now go through a small
ReceptorWorkclass instead of rawreceptorctlcommands:list()work liststatus(unit_id)work status <unit>results(unit_id, startpos=None)get_work_results(..., return_socket=True, return_sockfile=True)cancel(unit_id)work cancel <unit>release(unit_id)work release <unit>The process phase, its error handling, work release, same-controller adoption (
reattach_to_work_unit) andawx_receptor_workunit_reapertake aReceptorWork. Submitting work (the transmit phase) still talks to receptorctl directly; adoption never submits. Behavior is unchanged.awx/main/tests/fake_receptor.pyadds:FakeReceptorWork, which serves the same line protocol the ansible-runner worker writes, from canned events, so AWX's real process-phase code parses it. Per unit it can end a stream after N events, fail status calls, or lose the unit.RecordingDispatcher, which stands in for the callback-receiver queue so tests can see which events would be saved.New functional tests run the real reattach, dedup and finalize code against it:
One test records today's behavior when a results stream breaks during replay: a unit that succeeded is finalized failed, with only the events read before the break. It documents the current behavior and doesn't change it. Failure testing of #16669 hit this same pattern on a live cluster, where it took a 5–25 minute run to reproduce.
ISSUE TYPE
COMPONENT NAME
STEPS TO REPRODUCE AND EXTRA INFO