Skip to content

Commit 9e46f9d

Browse files
authored
KEP-2170: Add the TrainJob state transition design (#2298)
* KEP-2170: Add the TrainJob state transition design Signed-off-by: Yuki Iwai <[email protected]> * Replace actual jobs with TrainJob Signed-off-by: Yuki Iwai <[email protected]> * Remove the JobSet conditions propagation and Add expanding runtime framework interfaces for each plugin Signed-off-by: Yuki Iwai <[email protected]> * Expand the Creation Failed reasons Signed-off-by: Yuki Iwai <[email protected]> * Rename Completed to Complete Signed-off-by: Yuki Iwai <[email protected]> --------- Signed-off-by: Yuki Iwai <[email protected]>
1 parent 2e1e125 commit 9e46f9d

File tree

1 file changed

+83
-0
lines changed
  • docs/proposals/2170-kubeflow-training-v2

1 file changed

+83
-0
lines changed

docs/proposals/2170-kubeflow-training-v2/README.md

+83
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,43 @@ type TrainJob struct {
279279
Status TrainJobStatus `json:"status,omitempty"`
280280
}
281281

282+
const (
283+
// TrainJobSuspended means the TrainJob is suspended.
284+
TrainJobSuspended string = "Suspended"
285+
286+
// TrainJobComplete means that the TrainJob has completed its execution.
287+
TrainJobComplete string = "Complete"
288+
289+
// TrainJobFailed means that the actual jobs have failed its execution.
290+
TrainJobFailed string = "Failed"
291+
292+
// TrainJobCreated means that the actual jobs creation has succeeded.
293+
TrainJobCreated string = "Created"
294+
)
295+
296+
const (
297+
// TrainJobSuspendedReason is the "Suspended" condition reason.
298+
// When the TrainJob is suspended, this is added.
299+
TrainJobSuspendedReason string = "Suspended"
300+
301+
// TrainJobResumedReason is the "Suspended" condition reason.
302+
// When the TrainJob suspension is changed from True to False, this is added.
303+
TrainJobResumedReason string = "Resumed"
304+
305+
// TrainJobJobsCreationSucceededReason is the "Created" condition reason.
306+
// When the creating objects succeeded after building succeeded, this is added.
307+
TrainJobJobsCreationSucceededReason string = "JobsCreationSucceeded"
308+
309+
// TrainJobJobsBuildFailedReason is the "Created" condition reason.
310+
// When the building objects based on the TrainJob and the specified runtime failed,
311+
// this is added.
312+
TrainJobJobsBuildFailedReason string = "JobsBuildFailed"
313+
314+
// TrainJobJobsCreationFailedReason is "Created" condition reason.
315+
// When the creating objects failed even though building succeeded, this is added.
316+
TrainJobJobsCreationFailedReason string = "JobsCreationFailed"
317+
)
318+
282319
type TrainJobSpec struct {
283320
// Reference to the training runtime.
284321
// The field is immutable.
@@ -916,6 +953,52 @@ spec:
916953
claimName: user-123-volume
917954
```
918955
956+
### State Transition
957+
958+
In this section, we're explaining the TrainJob state transition (`.status.conditions`).
959+
The basic TrainJob state machine is the below.
960+
Especially, if we specify the TrainingRuntime or ClusterTrainingRuntime as a runtime,
961+
the TrainJob terminal condition (`Failed` or `Complete`) is decided based on the JobSet terminal state (`status.terminalState`)
962+
instead of computing from JobSet conditions.
963+
964+
```mermaid
965+
stateDiagram-v2
966+
#CREATION
967+
state created_choice <<choice>>
968+
[*] --> created_choice: TrainJob is submitted.
969+
created_choice --> Created=True: Succeeded to build and deploy Jobs.
970+
created_choice --> Created=False: Failed to build and deploy Jobs.
971+
Created=False --> Created=False: Wait for updated appropriate TrainJob.
972+
Created=False --> Created=True: Succeeded to build and deploy Jobs.
973+
974+
#SUSPENSION
975+
state suspended_choice <<choice>>
976+
Created=True --> suspended_choice: Handle TrainJob suspension.
977+
suspended_choice --> Suspended=True: TrainJob is suspended.
978+
Suspended=True --> Suspended=True: Wait for unsuspending.
979+
Suspended=True --> Suspended=False: TrainJob is unsuspended.
980+
suspended_choice --> Suspended=False: TrainJob is not suspended.
981+
982+
#FAILURE
983+
state terminal_choice <<choice>>
984+
Suspended=False --> terminal_choice: Actual Jobs go to terminal phase.
985+
terminal_choice --> Failed=True: Actual Jobs (e.g., JobSet) failed.
986+
Failed=True --> [*]
987+
988+
#COMPLETION
989+
terminal_choice --> Complete=True: Actual Jobs (e.g., JobSet) completed.
990+
Complete=True --> [*]
991+
```
992+
993+
In the above state transition, the `Created=False` will happen in the following situations and
994+
those different situations can be identified by the condition reasons (`.status.conditions.[type="Created"].reason`).
995+
996+
- `JobsBuildFailed`: When the TrainJob controller failed to construct objects (resources) using the [runtime framework interfaces](../../../pkg/runtime.v2/framework/interface.go)
997+
- `JobsCreationFailed`: When the TrainJob controller succeeded to construct objects, but it failed to deploy objects to the cluster.
998+
999+
Additionally, we extend the [runtime framework interfaces](../../../pkg/runtime.v2/framework/interface.go)
1000+
to allow each plugin to propagate the arbitrary conditions to the TrainJob.
1001+
9191002
## The Training Runtime API
9201003

9211004
The `TrainingRuntime` is the pre-created configurations of model training on the cluster,

0 commit comments

Comments
 (0)