Skip to content

Extract DB operations from TriggerRunnerSupervisor into overridable methods#65680

Open
ephraimbuddy wants to merge 1 commit intoapache:mainfrom
astronomer:extract-db-operations-triggerer
Open

Extract DB operations from TriggerRunnerSupervisor into overridable methods#65680
ephraimbuddy wants to merge 1 commit intoapache:mainfrom
astronomer:extract-db-operations-triggerer

Conversation

@ephraimbuddy
Copy link
Copy Markdown
Contributor

Add overridable hooks on TriggerRunnerSupervisor so the DB-backed Trigger.* calls can be swapped for Execution API calls in a follow-up for AIP-92 (isolate DAG processor, callback processor, and triggerer from core services):

  • on_trigger_event / on_trigger_failure wrap Trigger.submit_event / Trigger.submit_failure.
  • fetch_trigger_details / fetch_non_task_trigger_ids wrap the bulk fetches used during update_triggers.
  • build_trigger_workloads extracts the session-scoped workload construction out of update_triggers, leaving update_triggers as a pure diff/enqueue step. As a side effect, DBDagBag, the log renderer, and the trigger fetches are now only created when there are new triggers to process, which removes a small amount of idle metadata-DB work on each loop iteration.

Also fix the return annotation on
Trigger.fetch_trigger_ids_with_non_task_associations from set[str] to set[int] to match the actual PK type.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Opus 4.7

…ethods

Add overridable hooks on TriggerRunnerSupervisor so the DB-backed
Trigger.* calls can be swapped for Execution API calls in a follow-up
for AIP-92 (isolate DAG processor, callback processor, and triggerer
from core services):

- on_trigger_event / on_trigger_failure wrap Trigger.submit_event /
  Trigger.submit_failure.
- fetch_trigger_details / fetch_non_task_trigger_ids wrap the bulk
  fetches used during update_triggers.
- build_trigger_workloads extracts the session-scoped workload
  construction out of update_triggers, leaving update_triggers as a
  pure diff/enqueue step. As a side effect, DBDagBag, the log
  renderer, and the trigger fetches are now only created when there
  are new triggers to process, which removes a small amount of idle
  metadata-DB work on each loop iteration.

Also fix the return annotation on
Trigger.fetch_trigger_ids_with_non_task_associations from set[str]
to set[int] to match the actual PK type.
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.

1 participant