[FLINK-38933][python] Expose runtime context information in Python UDX FunctionContext
commit d62be55 ↗ · apache/flink · · committed Mar 29, 2026 · +329−116 · base 004268ad2f43
Agent prompt
what a new run launched now would send
Python table UDXs cannot read runtime task information from FunctionContext that Java UDX already exposes: task name, task name with subtasks, parallelism, max parallelism, subtask index, and attempt number.
Goal: align Python with Java so a UDX’s open(FunctionContext) can read those values for the executing task. Propagate the info from the Java Python operators through the Flink fn-execution protobuf protocol into Python FunctionContext. When the info is not present, getters should return None.
Acceptance: scalar/async/aggregate Python UDX paths that construct FunctionContext from the serialized fn payload should surface the same six pieces of information; unit-level FunctionContext behavior matches the above defaults; an end-to-end UDF can observe non-empty task name, positive parallelism, and non-negative subtask index at runtime.
Interface contract — the change must expose exactly this surface:
FunctionContext exposes get_task_name(), get_task_name_with_subtasks(), get_number_of_parallel_subtasks(), get_max_number_of_parallel_subtasks(), get_index_of_this_subtask(), get_attempt_number(); all return None when unset.
Work only inside this repository checkout. Make the code change the task
describes, keeping the diff focused — no drive-by refactors.
When you are done, leave your changes committed or in the working tree;
they are collected automatically.
Stay on this snapshot checkout (`task/ycb_flink_cd62be55c09a7`). Never checkout, pull, or rebase onto `main`. That branch is a README-only orphan.
Stay on this HEAD. Do not fetch another default branch. Push only on the Cursor-created `crazy-cursor/…` side branch from this HEAD.
Some past runs of this task were launched with a different prompt (the prompt template changed since, or those runs predate this benchmark's stored prompt). Each run persists the exact prompt it sent at launch — that per-launch record is the audit trail; this page shows only the current one.
Reference diff
The task commit's diff against its first parent — the judge's comparison target.