Repository navigation
Give each asset watcher its own log file on the triggerer - #76527
Conversation
2485c1d to
284318c
Compare
|
@hussein-awala, this touches some of the same files as your PRs for issue #76209, let me know if you have any preferences on merge order |
d558328 to
e9b18c1
Compare
o-nikolas
left a comment
There was a problem hiding this comment.
This PR also has a stopping triggerer upload the task and callback logs of triggers that are still running, which is what #76514 does too. Have you and that author agreed which PR lands that part? If #76514 goes first, this one could stick to the watcher files, which would also make it a bit smaller.
triggerer_job_runner.py grows by about 600 lines here, to about 2,660. Would you be open to moving the watcher log handling (the capped logger, the rotated uploads and the orphan scan) into its own module next to utils/log/trigger_log.py? I think it'd be easier to follow, and easier to change when #76640 lands. A follow-up is fine if you'd rather not churn this PR.
Drafted-by: Kiro (claude-opus-5.5); reviewed by @o-nikolas before posting
e9b18c1 to
20f9dce
Compare
|
Thanks @o-nikolas for pointing out the overlap with #76514. The part of this PR that overlaps it is just a bug fix, so this PR doesn't need to wait for that one to merge. Since #76514 is handling that gap, I've removed that part of the code here. |
4ff0d49 to
32f685c
Compare
|
Also, moved the watcher log handling into its own module |
fc5d2e1 to
eb0e784
Compare
525c629 to
308b99a
Compare
f27ec66 to
3743fef
Compare
3743fef to
da30c4d
Compare
ramitkataria
left a comment
There was a problem hiding this comment.
Posted a couple of minor concerns but looks good to me otherwise!
shahar1
left a comment
There was a problem hiding this comment.
The split into watcher_log.py reads well and CI is green. I have four small observations inline, none blocking, and ramitkataria's two open threads still need an answer before this merges.
Smaller observations
- On the open older-provider thread: the class-name lists in
watcher_log.pytie core to what each provider's handler does to the local file after an upload, and that differs between provider versions. I'd like to see that thread answered, since core can't require a provider version. - The tests for
CappedBytesLogger,WatcherLogsandupload_watcher_log_fileare all intests/unit/jobs/test_triggerer_job.py, while the code is inairflow/utils/log/watcher_log.py.AGENTS.md(Testing Standards): "Test location mirrors source:airflow/cli/cli_parser.py→tests/cli/test_cli_parser.py." The ones that need no supervisor could move totests/unit/utils/log/test_watcher_log.py. - Four more are inline: the stale-claim takeover, parts kept with HDFS, a function-level import, and mocks without a spec.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The findings
below are observations, not blockers; an Apache Airflow
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.More on how Apache Airflow handles maintainer review:
Contributing guide.
da30c4d to
b7c89b0
Compare
b7c89b0 to
53dce0d
Compare
|
On the two points in the review summary:
|
Building on #76260.
An asset watcher's lines only reach the triggerer's stdout, so they can't be read back and are lost when the triggerer goes away. Deferred tasks and callbacks already log to a file; this gives each watcher one too, uploaded with remote logging. A follow-up adds
GET /triggers/{trigger_id}/logsto read them.triggers/trigger_id=<id>/triggerer_job_id=<id>/trigger.logon its triggerer. Lines still go to stdout by default.[triggerer] watcher_log_max_bytes,watcher_log_max_open_files). If the store stays down, old parts are dropped to keep the cap.Not in this PR: uploading on a timer so a long-running watcher's remote copy stays current, and reading the runner's last lines on stop (#76867).
How to review: start with
utils/log/watcher_log.py. About 1,050 lines of source; the rest is tests and docs.Airflow CI image, Postgres 16, LocalExecutor, S3 remote logging: one watcher logging 5 lines a second, on a triggerer that is stopped, started, killed with
kill -9, started again on the same disk and stopped (triggerer jobs 2, 4 and 5):Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines