Repository navigation
Conversation
This comment was marked as spam.
This comment was marked as spam.
|
Hi @shahar1 @Vamsi-klu I ran the unit tests and local simulation for this PR. Environment:
Unit Test Results:
Local Simulation (
Note: I don't have GCP credentials to run the actual system tests against real Composer infrastructure. The unit tests and local simulation validate the control flow, but real GCP validation is still needed. |
OK: dag.test() completed for composer -- final state: success
the sync `dag_run_sensor` and deferred `defer_dag_run_sensor` both
matched on dag_run_id='manual__simulated' via the composer_dag_run_id branch. |
|
@nnguyen168 could you please run the existing System Test for this operator and shared the screenshot for the latest run? |
When asking to run the system tests, I always refer to a real GCP instance - simulating it against a mock isn't helpful (maybe with exception for very specific services in GCP that have emulators). |
|
I've validated the unit tests (75/75 passing) and local simulation, but I don't have GCP credits remaining to run the full system test against real Composer infrastructure (~$2-4 cost per run). Could a maintainer or someone with GCP access help run the system test and share the results? Alternatively, is there a CI workflow for system tests that can be triggered? |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Reorder the example Dag so each CloudComposerTriggerDAGRunOperator runs before its sibling CloudComposerDAGRunSensor, and have the sensors pull the freshly minted run id from XCom via the new templated composer_dag_run_id field. The previous "execution_range=[now -1d, now]" form was evaluated at Dag-parse time -- before the Composer environment existed -- so the empty-window fix from PR apache#67052 would have caused the sensor to wait forever, the same way it did when PR apache#61046 was reverted. Adds a defensive timeout on the Dag-run sensors so any future regression back into the windowed code path fails CI fast instead of hanging the worker. Leaves the external-task sensors on the legacy windowed path deliberately; the analogous bug in _check_task_instances_states is tracked at apache#67051 and the inline note flags that the example must be restructured at the same time when that issue lands. Adds unit coverage for: the new template_fields entry, Jinja rendering of an xcom_pull template, run-id-path success/wait/precedence in poke(), parse-time source guard against re-introducing datetime.now(), and the matching trigger paths (run-id branch precedence + polling). Ships a local simulation harness (dev/simulate_composer_system_test.py) that mocks all GCP surfaces and drives the example via dag.test() end-to-end so contributors without GCP credentials can reproduce the proof.
Extract a shared Composer window helper used by sensor and trigger paths, use a half-open [start, end) window, skip null dates, normalize naive API timestamps to UTC, default empty allowed_states, and exhaust dagRuns pagination. Add unit coverage for boundary, null/naive dates, pagination, and sensor/trigger parity.
The project-structure check requires the new utils/composer.py module to have mirrored unit coverage, and the docs spellcheck rejects the informal wording and abbreviated parameter names that leak into the generated API pages.
51b9629 to
f884665
Compare
Then we should close it @Vamsi-klu -> you seem to open a lot of PRs with Claude Code but it seems you do not test it. If you cannot run system test now, it means your changes are theorethical and basically you are throwing testing over the wall to someone else. Which is not a good idea. I am closing all Google provider ones from you in this case - feel free to reopen your PRs for providers with a proof that you actuallly run the tests manually with real Google account. Also whenever we release a provider with such changes you are requested to installl an test such modified provider with real google service. The providers are supposed to be run with raal services they are accessing and not "theorethically" fixed. |
What is the change?
CloudComposerDAGRunSensorandCloudComposerDAGRunTriggernow succeed only when at least one Composer Dag run falls inside the requested execution window and every in-window run is in an allowed state. An empty window means keep waiting, not success.Why did I do it?
The old window check returned success whenever it saw no in-window run in a disallowed state, so a window with no matching runs at all passed immediately. Unrelated out-of-window runs could make the sensor succeed even though the run it was waiting for never happened.
closes: #57512
How did I do it?
I extracted shared helpers into
utils/composer.py, used by both the sync sensor and the deferrable trigger: a half-open[start, end)window, null-date skipping, naive timestamps normalized to UTC, and emptyallowed_statesdefaulting to["success"]. The hook'sget_dag_runsnow exhausts REST pagination.composer_dag_run_idis templated, and the system test example pins each sensor to the run id minted by an upstreamCloudComposerTriggerDAGRunOperatorvia XCom, with a defensive timeout. The external-task sensors stay on the legacy windowed path; that anti-pattern is tracked in #67051.What's the impact?
No more false successes from empty windows. Users who relied on the old behavior should set a finite
timeoutor pincomposer_dag_run_id, since an empty window now waits.What's the test plan?
Unit tests for the sensor, trigger, hook pagination, and the new window utilities (boundary, null and naive dates, run-id precedence, template rendering). I ran ruff, the provider pytest suite for these files, and the prek ruff hooks. The live Composer system test was not run; it needs real GCP infrastructure.
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5) and Claude Code (Opus 4.7 1M) following the guidelines