bug(jobs): maxRunAttempts=1 reads back as 0

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go, python

調査の方向性

go/job.go にあるピン留めされた Go Job API と、MaxRunAttempts のシリアライズを検証する request-builder テストから始めます。create request と、正確な ID による readback、および生成された multi-machine スキーマにおける zero の扱いを比較します。standalone Jobs が 1 という明示的な値を保持するのか、権威ある no-retry ポリシーを公開するのかを明らかにし、その契約がテストまたはドキュメントに反映されれば完了です。

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

説明

Environment

  • SDK: github.com/lightning-ai/sdk/go
  • Version: v0.0.0-20260903140713-8e137645d1a6
  • Upstream commit/tag: 8e137645d1a6b829533f0bf3cc11d2abc6c7291d / v2026.09.03
  • Machine: CPU_SMALL (cpu-2)
  • Job: non-interruptible

The standalone-Job SDK contract says 0 means unset/backend default and 1
means one attempt with no retries. Its request builder maps
JobOptions.MaxRunAttempts to spec.maxRunAttempts, and its tests verify that
field is serialized. The generated multi-machine schema is more specific: it
calls 0 "unset (legacy, no retries)." The corresponding guarantee is not
stated for standalone Jobs.

Minimal reproduction

With github.com/lightning-ai/sdk/go imported as lit and authenticated
teamspace and studio handles already resolved:

interruptible := false
job, err := lit.RunJob("retry-policy-reproducer", lit.Machine("cpu-2"), "true", lit.JobOptions{
	Teamspace:      teamspace,
	Studio:         studio,
	Interruptible:  &interruptible,
	MaxRunAttempts: 1,
})
if err != nil {
	log.Fatal(err)
}
defer func() { _ = job.Stop() }()

fmt.Printf("created: max=%d current=%d\n", job.MaxRunAttempts(), job.CurrentRunAttempt())

readback, err := lit.GetJob(job.Name(), lit.JobOptions{Teamspace: teamspace})
if err != nil {
	log.Fatal(err)
}
fmt.Printf("readback: max=%d current=%d\n", readback.MaxRunAttempts(), readback.CurrentRunAttempt())

The observed job was submitted through the Python SDK with
max_run_attempts=1. Both Python and the pinned Go SDK read the same exact job
back as 0; the Go SDK source and unit tests independently establish that its
create path serializes nonzero MaxRunAttempts. We did not spend another live
job merely to repeat the same backend request through Go.

Expected

The created and subsequently fetched job retain maxRunAttempts=1, or the API
returns another authoritative field proving that the job cannot retry.

Actual

The submission path set max_run_attempts=1, but the created job and later
exact-ID readback reported:

current_run_attempt=1
max_run_attempts=0

The job was stopped before entering Running; started_at remained null.

Impact

For a cost-bounded executor, current_run_attempt=1 only describes the current
history. It does not prove that a second attempt cannot occur after a later
failure. Because the documented meaning of 0 is "unset/backend default," the
readback cannot attest the requested no-retry policy before compute effects.
The safe response is therefore to reject and stop the job.

Questions

  1. Is normalizing maxRunAttempts=1 to 0 intentional?
  2. For standalone Jobs, does 0 have the same stable legacy-no-retry meaning
    documented for multi-machine jobs, or may a backend default retry?
  3. If 0 guarantees no retries, can that guarantee be documented in the
    standalone-Job API and exposed as an effective retry policy?
  4. Otherwise, can the service preserve and return the explicit value 1?

References

主要言語
Python
スター
13
フォーク
4
平均マージ
1日 2時間
マージ済み PR(30日)
40

環境構築

はじめの一歩

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

Lightning-AI/sdk のほかの issue

Lightning-AI/sdk の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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