Skip to content

Bound and harden the task-UUID scan fallback #71489

Open

Description

@amoghrajesh

GlueJobOperator._find_job_run_id_by_task_uuid (the task-UUID scan fallback, used when neither task_state_store nor a cached XCom id has a prior run) has a few pre-existing quality issues, carried over verbatim from main, that are worth cleaning up:

  1. Unbounded pagination. It's a while True over get_job_runs(MaxResults=50) with no page cap and no age cutoff. The no-match case — the prior attempt died before it ever called StartJobRun, which is the common retry shape — is exactly the one that walks the job's entire run history before giving up.
  2. Failure is silently swallowed. The two except Exception blocks around this scan (and the XCom lookup before it) log at warning level and return None, after which the operator submits fresh — straight into ConcurrentRunsExceededException against a run that's still alive. There's no error-level signal telling anyone why.
  3. The except Exception is broader than it needs to be. It should be narrowed to except ClientError, so a real bug in the surrounding code doesn't get silently absorbed the same way as a transient AWS-side issue.
  4. Missing IAM documentation. Anyone relying on this fallback (via resume_glue_job_on_retry=True today, or explicit durable=True on Airflow <3.3 going forward) needs glue:GetJobRuns in their task policy, on top of StartJobRun/GetJobRun. The docs don't currently call that out.

None of this is new — it's present on main today, gated behind the opt-in resume_glue_job_on_retry flag. Raised during review of #71211, initially flagged as more urgent because that PR was going to make the scan reachable by default; the default-flip was scoped back to explicit opt-in for Airflow <3.3 (and to a narrow crash-recovery window on 3.3+) in the same PR, so the original urgency no longer applies — but the underlying issues are still real for anyone who does hit this path.

Fix direction: bound the walk (a page cap, or stop once a run's StartedOn predates the DAG run), narrow the exception handling, log the fallthrough at error level with the actual reason, and document the IAM requirement.

See #71211 (comment) for the original discussion.

Activity

  1. changed the title [-]GlueJobOperator: bound and harden the task-UUID scan fallback (_find_job_run_id_by_task_uuid)[/-] [+]Bound and harden the task-UUID scan fallback[/+] on Aug 12, 2026
  2. MannXo commented on Aug 12, 2026

    @MannXo
    Contributor

    I'd like to give this a shot if it's unassigned.

  3. atanishka308 commented on Aug 12, 2026

    @atanishka308

    I would like to work on this issue.

  4. Johnkothapalli commented on Aug 13, 2026

    @Johnkothapalli

    I'm working on this. I'll keep the change to the issue's defined scope: bound the Glue job-run fallback scan, narrow AWS handling to ClientError with actionable logging, document glue:GetJobRuns, and add focused mocked pagination/error tests. I'll link the PR here once the provider checks pass.


    Drafted-by: Codex (GPT-5) (no human review before posting)

  5. Johnkothapalli commented on Aug 13, 2026

    @Johnkothapalli

    I found that #71546 was already open before my comment and covers this scope, so I won't create a duplicate implementation. Sorry for the extra notification.


    Drafted-by: Codex (GPT-5) (no human review before posting)

  6. jasperjonkhans commented on Aug 30, 2026

    @jasperjonkhans
    Contributor

    Hello, I would like to work on this, if still available.

  7. LeonxLJX commented on Aug 31, 2026

    @LeonxLJX

    Hi! I'd like to work on bounding and hardening the task-UUID scan fallback. Thanks!

  8. LeonxLJX commented on Sep 1, 2026

    @LeonxLJX

    Hi! I'd like to work on this. I'll reproduce, locate the root cause, implement a minimal fix with a regression test, and verify against the module's test suite. Please let me know if I can proceed / be assigned.

  9. neevmodh commented on Sep 22, 2026

    @neevmodh

    Hi @amoghrajesh, I'd like to work on this. Plan per your fix direction:

    • Bound the pagination walk in _find_job_run_id_by_task_uuid (page cap and/or stop once a run's StartedOn predates the DAG run)
    • Narrow except Exception to except ClientError around the scan/XCom lookup
    • Log the fallthrough at error level with the actual reason instead of swallowing at warning
    • Document the glue:GetJobRuns IAM requirement alongside the existing StartJobRun/GetJobRun docs

    Will add/extend tests covering the bounded walk and narrowed exception handling. Will open a PR.

  10. added a commit that references this issue on Oct 4, 2026
    6c0652f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions