[runtime][python] Support TaskManager reuse across Flink Agents jobs

オープン
#1,291 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, python

調査の方向性

Read #943 and #1281 first, then trace the Python runtime's dependency-generation lifecycle, function cache, and Pemja classloading and native-library ownership. Validate sequential Session job reuse, concurrent jobs, and recovery of one job while another remains active, including Application Mode. Done means jobs load their intended code and resources without stale imports, cross-job cache reuse, or cleanup disrupting active jobs, and the documented support boundary is updated.

索引モデルが issue の本文から書いたものです。

説明

priority/minor tech debt
Search before asking
  • I searched existing issues. This tracks the broader cross-job lifecycle work deferred from #943 and #1281.
Description

Support multiple Flink Agents jobs that use the Python runtime reusing the same TaskManager JVM, either sequentially or concurrently. This includes Python jobs and Java jobs with Python components.

The scope includes:

  • Multiple jobs submitted to a Session cluster.
  • Multiple jobs launched by the same application in Application Mode.

The relevant boundary is reuse of the same TaskManager process. Separate applications with dedicated TaskManagers do not share this process state.

Background and known gaps

#943 addresses dependency-generation changes during failover of the same JobID. It explicitly leaves cross-job reuse and cleanup of process-global Python state outside its scope. #1281 reports consecutive-job startup failures, and #1282 documents the limitation and recommends restarting the Session cluster before submitting another job that uses the Python runtime.

The broader support work needs to address:

  1. Pemja classloading and native-library ownership. #1281 reproduced startup failures in successive Session jobs when the distribution JAR is not in lib, including NoSuchFieldException: loadedLibraryNames and PyObject cannot be cast to PyObject. Loading Pemja parent-first avoided those failures in the reported tests, but does not establish cross-job support.
  2. Python imports and dependency lifecycle. Job completion does not deactivate the job's dependency generation. A subsequent job importing the same package name can reuse an old module from sys.modules, potentially executing stale code or accessing resources in a deleted dependency directory.
  3. Function-cache isolation. The Python function cache is keyed by (module, qualname), without job or dependency-generation identity, so different jobs can reuse the same cached function.
  4. Coordination between active jobs. A dependency-generation refresh clears the process-wide function cache. As discussed in #943, this can interfere with another job's cache lookup and introduces a possible KeyError race. Cleanup must also preserve modules and paths still needed by active jobs.

The Session startup failures were reproduced in #1281. The concurrent-job race and Application Mode scenarios still need end-to-end validation; we should not assume the same classloading failure occurs in every deployment layout.

Expected outcome

Define and validate the supported cross-job lifecycle, including sequential reuse, concurrent execution, and recovery of one job while another remains active. Jobs should load their intended code and resources without stale imports, cross-job cache reuse, or cleanup interfering with other jobs. Update the documented support boundary once these guarantees are established.

This issue tracks the overall support gap; it does not prescribe a particular implementation or recommend a parent-first configuration as a complete workaround.

Priority

Minor. We have not yet seen a concrete user requirement for this capability. The report in #1281 came from local Quickstart validation, with no production use case reported. We therefore consider this a low-priority follow-up and can revisit its priority when concrete user scenarios emerge.

主要言語
Java
スター
497
フォーク
193
平均マージ
2日 21時間
マージ済み PR(30日)
68

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/flink-agents のほかの issue

apache/flink-agents の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。