You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "1fanwang (via GitHub)" <gi...@apache.org> on 2026/09/10 23:01:41 UTC
[PR] Edge: Return 404 for missing task logs and emit failed job metrics [airflow]
1fanwang opened a new pull request, #72908:
URL: https://github.com/apache/airflow/pull/72908
Querying logs for a nonexistent task instance returned an internal server error instead of a missing resource response, while failed edge jobs omitted finish metrics entirely.
In the worker API, requesting logs for a missing task instance dereferenced None in the file task handler, raising an AttributeError and returning HTTP 500. Separately, the job state endpoint checked an invalid comparison list that prevented the failed state from matching, so finish metrics were never emitted on job failure.
This change returns a 404 Not Found error when the task instance cannot be found and corrects the state list so finish metrics emit for both successful and failed tasks.
# Testing Done
Reproduction before fix:
```bash
uv run --project providers/edge3 pytest -k "test_logfile_path_missing_ti or test_state_failed"
```
Pre-fix output:
```text
FAILED test_logs.py test_logfile_path_missing_ti_returns_404 - AttributeError: 'NoneType' object has no attribute 'get_dagrun'
FAILED test_jobs.py test_state_failed - AssertionError: expected call not found
```
Verification after fix:
```bash
uv run --project providers/edge3 pytest providers/edge3/tests/unit/edge3/worker_api/routes/test_logs.py providers/edge3/tests/unit/edge3/worker_api/routes/test_jobs.py -k "test_logfile_path or test_state_failed"
```
Post-fix output:
```text
================== 3 passed, 9 deselected, 1 warning in 4.03s ==================
```
<details>
<summary>Raw logs</summary>
```text
test_logs.py test_logfile_path PASSED [ 33%]
test_logs.py test_logfile_path_missing_ti_returns_404 PASSED [ 66%]
test_jobs.py test_state_failed PASSED [100%]
```
</details>
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Edge: Return 404 for missing task logs [airflow]
Posted by "1fanwang (via GitHub)" <gi...@apache.org>.
1fanwang commented on PR #72908:
URL: https://github.com/apache/airflow/pull/72908#issuecomment-6055350337
> Please document 404 for the push route, regenerate the OpenAPI spec, and add a regression test
@dheerajturaga done in https://github.com/apache/airflow/commit/e6633fb93eec2cbc9ba44289c245214ea0be327e. Both log routes document 404, the generated OpenAPI spec includes both responses, and authenticated regression tests cover GET and POST. The current documentation build, spellcheck and publication checks all pass.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Edge: Return 404 for missing task logs and emit failed job metrics [airflow]
Posted by "dheerajturaga (via GitHub)" <gi...@apache.org>.
dheerajturaga commented on PR #72908:
URL: https://github.com/apache/airflow/pull/72908#issuecomment-5686922628
Thanks for the fix. Could you please address these before merging?
- Rerun or investigate the failing documentation CI job so the PR is green.
- `_logfile_path()` is also used by `push_logs()`, so this change makes missing task instances return 404 from that endpoint too. Please document 404 for the push route, regenerate the OpenAPI spec, and add a regression test—or scope the 404 handling to the GET route only.
---
Drafted-by: Codex (GPT-5); reviewed by @dheerajturaga before posting
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org