Repository navigation
Conversation
e220072 to
849d275
Compare
Add the registry for request_handlers.py so we can refactor _handle_request in handlers
…NotImplementedError with registry dispach
8d75303 to
4de5af1
Compare
… tests client is now a required field in WatchedSubProcess so we now have to pass a mock to satisfy the constructor
handle_mask_secret does not use the client field but it requires the client:Client because it needs to satisfy the uniform handler contract stipulated by the registry dispatcher
move GetAssetByName GetAssetByUri GetAssetsByAlias GetAssetEventByAsset GetAssetEventByAssetAlias TriggerDagRun GetDagRun GetDag GetTaskRescheduleStartDate GetTaskBreadcrumbs ValidateInletsAndOutlets CreateHITLDetailPayload GetTaskStore SetTaskStore DeleteTaskStore ClearTaskStore GetAssetStoreByName GetAssetStoreByUri SetAssetStoreByName SetAssetStoreByUri DeleteAssetStoreByName DeleteAssetStoreByUri ClearAssetStoreByName ClearAssetStoreByUri to decorator registry
remove GetAssetByName GetAssetByUri GetAssetsByAlias GetAssetEventByAsset GetAssetEventByAssetAlias TriggerDagRun GetDagRun GetDag GetTaskRescheduleStartDate GetTaskBreadcrumbs ValidateInletsAndOutlets CreateHITLDetailPayload GetTaskStore SetTaskStore DeleteTaskStore ClearTaskStore GetAssetStoreByName GetAssetStoreByUri SetAssetStoreByName SetAssetStoreByUri DeleteAssetStoreByName DeleteAssetStoreByUri ClearAssetStoreByName ClearAssetStoreByUri from isinstance chain
Replace cached_property with a property backed by _client. attrs was silently resolving the client to None at runtime, causing NoneType failures when trigger code requested connections or dag run state. The setter allows subclasses like TriggerRunnerSupervisor to inject or override the client during construction.
attrs was preventing a @Property named 'client' from being defined because it owned a field with the same name. Renaming the field to _client with alias='client' keeps the constructor interface unchanged while freeing up the 'client' name for the lazy-init property.
|
@JH-A-Kim — converting this to draft because it currently has merge conflicts with See the PR quality criteria. This is an automated first-pass triage note drafted by an AI-assisted tool and may get things wrong; once you've addressed it, a real Apache Airflow maintainer takes the next look. (why the first pass is automated) Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting |
…andlers and supervisor tests
|
@ashb Would it be possible to get a review? Thank you! |
|
@ashb Would i be able to get a review? Thanks! |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Description
This PR implements the changes specified in #65827
The goal of this pull request is to refactor the
_handle_requestmethod by replacing a long,isinstanceelifchain with a Handler Registry design pattern. This improves maintainability, and prevents future code bloat as new requests are added.In test_triggerer_job.py multiple tests failed on client as it was not seeing the
client. What ended up being the problem is thattriggerer_job_runner.pywas lazy initializing the client and was only creating a client when it strictly needed it, but becauseattrswas causing some conflicts with it, theclientwas being set toNonecausing failures. The solution ended up being removing the lazy initialization, creating the client inside thestartand then updating the tests cases to align with the new specification for the client being set inWatchedSubProcessinstead of the individual processesors.Key Changes
request_handlers.py. Shared handlers are now used through the decorator.raise NotImplementedError()with the registry system for WatchedSubProcess.super()for shared messages, and for any supervisor specific special cases they are still handled in-line.test_integration.py, andtest_triggerer_job.pytest cases updated to align with the new specification for client being set in WatchedSubProcess instead in individual processors.Handlers Moved
Moved the following handlers to the registry:
GetAssetByName
GetAssetByUri
GetAssetsByAlias
GetAssetEventByAsset
GetAssetEventByAssetAlias
TriggerDagRun
GetDagRun
GetDag
GetTaskRescheduleStartDate
GetTaskBreadcrumbs
ValidateInletsAndOutlets
CreateHITLDetailPayload
GetTaskStore
SetTaskStore
DeleteTaskStore
ClearTaskStore
Asset store CRUD:
GetAssetStoreByName
GetAssetStoreByUri
SetAssetStoreByName
SetAssetStoreByUri
DeleteAssetStoreByName
DeleteAssetStoreByUri
ClearAssetStoreByName
ClearAssetStoreByUri
Was generative AI tooling used to co-author this PR?
Generated-by: [Sonnet 4.6] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Important
🛠️ Maintainer triage note for @JH-A-Kim · by
@potiuk· 2026-07-02 17:46 UTCSome review feedback from
@ferruzziis waiting on you:@ferruzzineed a reply or a fix.The ball is in your court — you've been assigned to this PR. Reply or push a fix in each thread, then mark them resolved.
Automated triage — may be imperfect; a maintainer takes the next look.