Skip to content

Commit

Permalink
Merge pull request #90 from furiko-io/irvinlim/feat/parallel-status-i…
Browse files Browse the repository at this point in the history
…ndexes
  • Loading branch information
irvinlim authored Jun 5, 2022
2 parents 0954bd6 + c4f761f commit a110df6
Show file tree
Hide file tree
Showing 16 changed files with 1,674 additions and 149 deletions.
58 changes: 53 additions & 5 deletions apis/execution/v1alpha1/job_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ const (

// JobTerminating means that the job is completed, but not all tasks are
// terminated yet.
JobTerminating JobPhase = "Running"
JobTerminating JobPhase = "Terminating"

// JobRetryBackoff means that the job is backing off the next retry due to a
// failed task. The job is currently waiting for its retry delay before creating
Expand Down Expand Up @@ -646,10 +646,6 @@ const (
// application-level error.
TaskFailed TaskResult = "Failed"

// TaskPendingTimeout means that the task had failed to start within the
// specified pending timeout.
TaskPendingTimeout TaskResult = "PendingTimeout"

// TaskKilled means that the task is killed externally and now terminated.
TaskKilled TaskResult = "Killed"
)
Expand Down Expand Up @@ -700,6 +696,55 @@ type ParallelIndex struct {

// ParallelStatus stores the status of parallel indexes for a Job.
type ParallelStatus struct {
ParallelStatusSummary `json:",inline"`

// The status for each parallel index. The size of the list should be exactly
// equal to the total parallelism factor, even if no tasks are created yet.
Indexes []ParallelIndexStatus `json:"indexes"`
}

// ParallelIndexStatus stores the status for a single ParallelIndex in the Job.
// There should be at most one task running at a time for a single parallel
// index in the Job.
type ParallelIndexStatus struct {
// The parallel index.
Index ParallelIndex `json:"index"`

// Hash of the index.
Hash string `json:"hash"`

// Total number of tasks created for this parallel index.
CreatedTasks int64 `json:"createdTasks"`

// Overall state of the parallel index.
State IndexState `json:"state"`

// Result of executing tasks for this parallel index if it is already terminated.
// +optional
Result TaskResult `json:"result,omitempty"`
}

type IndexState string

const (
// IndexNotCreated means that no tasks have been created for the index.
IndexNotCreated IndexState = "NotCreated"

// IndexRetryBackoff means that the index is currently in retry backoff.
IndexRetryBackoff IndexState = "RetryBackoff"

// IndexStarting means that the current task in the index has not yet started running.
IndexStarting IndexState = "Starting"

// IndexRunning means that the current task in the index is currently running.
IndexRunning IndexState = "Running"

// IndexTerminated means that all tasks in the index is terminated.
IndexTerminated IndexState = "Terminated"
)

// ParallelStatusSummary stores the summary status of parallel indexes for a Job.
type ParallelStatusSummary struct {
// If true, the job is complete and currently in the process of waiting for all
// remaining tasks to be terminated.
Complete bool `json:"complete"`
Expand All @@ -709,7 +754,10 @@ type ParallelStatus struct {
//
// +optional
Successful *bool `json:"successful,omitempty"`
}

// ParallelStatusCounters stores counts of parallel indexes for a Job.
type ParallelStatusCounters struct {
// Total number of task parallel indexes that have created tasks.
Created int64 `json:"created"`

Expand Down
60 changes: 57 additions & 3 deletions apis/execution/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 43 additions & 35 deletions config/crd/bases/execution.furiko.io_jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,46 +236,54 @@ spec:
complete:
description: If true, the job is complete and currently in the process of waiting for all remaining tasks to be terminated.
type: boolean
created:
description: Total number of task parallel indexes that have created tasks.
format: int64
type: integer
failed:
description: Total number of task parallel indexes that failed (including all retries).
format: int64
type: integer
retryBackoff:
description: Total number of task parallel indexes that are currently in retry backoff.
format: int64
type: integer
running:
description: Total number of task parallel indexes that are currently running.
format: int64
type: integer
starting:
description: Total number of task parallel indexes that are currently starting.
format: int64
type: integer
succeeded:
description: Total number of task parallel indexes that are successful.
format: int64
type: integer
indexes:
description: The status for each parallel index. The size of the list should be exactly equal to the total parallelism factor, even if no tasks are created yet.
items:
description: ParallelIndexStatus stores the status for a single ParallelIndex in the Job. There should be at most one task running at a time for a single parallel index in the Job.
properties:
createdTasks:
description: Total number of tasks created for this parallel index.
format: int64
type: integer
hash:
description: Hash of the index.
type: string
index:
description: The parallel index.
properties:
indexKey:
description: If withKeys is used for parallelism, contains the index key of the job as a string.
type: string
indexNumber:
description: If withCount is used for parallelism, contains the index number of the job numbered from 0 to N-1.
format: int64
type: integer
matrixValues:
additionalProperties:
type: string
description: If withMatrix is used for parallelism, contains key-value pairs of the job as strings.
type: object
x-kubernetes-map-type: atomic
type: object
result:
description: Result of executing tasks for this parallel index if it is already terminated.
type: string
state:
description: Overall state of the parallel index.
type: string
required:
- createdTasks
- hash
- index
- state
type: object
type: array
successful:
description: If complete, contains whether the job is successful according to the ParallelCompletionStrategy.
type: boolean
terminated:
description: Total number of task parallel indexes where all tasks are completely terminated, including when no tasks are created.
format: int64
type: integer
required:
- complete
- created
- failed
- retryBackoff
- running
- starting
- succeeded
- terminated
- indexes
type: object
phase:
description: Phase stores the high-level description of a Job's state.
Expand Down
Loading

0 comments on commit a110df6

Please sign in to comment.