w-yfan opened a new pull request, #30264: URL: https://github.com/apache/flink/pull/30264
## What is the purpose of the change Calling `get_attempt_number()` from a PyFlink DataStream function in thread mode raises `AttributeError`. The embedded Python wrapper still looks for the method on Java's `RuntimeContext`. Java now exposes it through `RuntimeContext.getTaskInfo()`. Five other task metadata getters in the same wrapper use the removed methods. [FLINK-41826](https://issues.apache.org/jira/browse/FLINK-41826) ## Brief change log - Read the attempt number, subtask index, parallelism, maximum parallelism, task name and task name with subtasks from Java's `TaskInfo`. - Add a thread-mode DataStream test that reads all six values in `MapFunction.open()`. It checks the metadata from both subtasks of a named operator with parallelism 2 and maximum parallelism 8. ## Verifying this change On the Apache Flink 2.2.1 distribution, all six calls raised `AttributeError` in thread mode before the fix. With the updated Python wrapper they returned the same values as process mode. The new regression test body also failed on the original wrapper at `getAttemptNumber` and passed with the fix. The standard `unittest` entry point for `EmbeddedDataStreamStreamTests.test_runtime_context_task_info` also failed before the fix and passed afterward, using this branch's Python sources and local Flink 2.4-SNAPSHOT JVM test artifacts. ## Does this pull request potentially affect one of the following parts? - Dependencies, public API signatures and serializers: no. - Per-record runtime path: no change to record processing. The wrapper calls `getTaskInfo()` when user code requests one of these values. - Deployment, recovery and the S3 file system connector: no. ## Documentation This restores existing documented Python APIs. It introduces no new feature. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes Generated-by: OpenAI Codex CLI 0.173.0-alpha.4.1 (GPT-6.2) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
