hkc-8010 opened a new pull request, #65457:
URL: https://github.com/apache/airflow/pull/65457

   When a trigger's `serialize()` return value references a classpath whose 
module lives inside `dags/` (e.g., `helpers.emr_sensor_helpers.MyTrigger`), the 
Triggerer subprocess raises `ModuleNotFoundError` because `sys.path` never 
includes the DAG bundle root.
   
   PR #55894 fixed this gap for DagBag parsing, the worker (task runner), the 
DAG processor, and the CLI — but the `TriggerRunner` subprocess was missed 
entirely.
   
   ## Changes
   
   - **`airflow-core/src/airflow/executors/workloads/trigger.py`** — add 
`bundle_info: BundleInfo | None = None` to `RunTrigger`, mirroring the 
`BaseDagBundleWorkload` pattern used by `ExecuteTask`.
   - **`airflow-core/src/airflow/jobs/triggerer_job_runner.py`**:
     - `_create_workload()` now populates `bundle_info` from 
`trigger.task_instance.dag_model.bundle_name` / 
`trigger.task_instance.dag_run.bundle_version` when a task instance is present; 
asset-based triggers (no task instance) leave it `None`.
     - New `TriggerRunner._ensure_bundle_on_syspath()` — calls 
`DagBundlesManager().get_bundle(...)`, `bundle.initialize()`, and appends the 
bundle root to `sys.path` (with deduplication), mirroring the 
callback-supervisor pattern already in `task-sdk`.
     - `TriggerRunner.create_triggers()` — calls `_ensure_bundle_on_syspath()` 
before `get_trigger_by_classpath()`.
   - **`airflow-core/tests/unit/jobs/test_triggerer_job.py`** — five new tests 
covering `bundle_info` population, `sys.path` mutation, deduplication, and 
failure logging.
   
   closes: #65455
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Sonnet 4.6 (1M context)
   
   Generated-by: Claude Sonnet 4.6 (1M context) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to