Skip to content

Commit

Permalink
chore: add visible job status function for BED-4111
Browse files Browse the repository at this point in the history
  • Loading branch information
zinic committed Feb 8, 2024
1 parent 28deef8 commit d082138
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cmd/api/src/model/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ func (s FileUploadJobs) GetValidFilterPredicatesAsStrings(column string) ([]stri
type JobStatus int

const (
JobStatusInvalid JobStatus = -1
JobStatusReady JobStatus = 0
JobStatusRunning JobStatus = 1
JobStatusComplete JobStatus = 2
JobStatusCanceled JobStatus = 3
JobStatusTimedOut JobStatus = 4
JobStatusFailed JobStatus = 5
JobStatusIngesting JobStatus = 6
JobStatusAnalyzing JobStatus = 7
JobStatusInvalid JobStatus = -1
JobStatusReady JobStatus = 0
JobStatusRunning JobStatus = 1
JobStatusComplete JobStatus = 2
JobStatusCanceled JobStatus = 3
JobStatusTimedOut JobStatus = 4
JobStatusFailed JobStatus = 5
JobStatusIngesting JobStatus = 6
JobStatusAnalyzing JobStatus = 7
JobStatusPartiallyComplete JobStatus = 8
)

Expand Down Expand Up @@ -147,6 +147,10 @@ func ParseJobStatus(jobStatusStr string) (JobStatus, error) {
return JobStatusInvalid, fmt.Errorf("no matching job status for: %s", jobStatusStr)
}

func GetVisibleJobStatuses() []JobStatus {
return []JobStatus{JobStatusComplete, JobStatusCanceled, JobStatusTimedOut, JobStatusFailed, JobStatusIngesting, JobStatusAnalyzing, JobStatusPartiallyComplete}
}

func (s JobStatus) String() string {
switch s {
case JobStatusReady:
Expand All @@ -172,7 +176,7 @@ func (s JobStatus) String() string {

case JobStatusAnalyzing:
return "ANALYZING"

case JobStatusPartiallyComplete:
return "PARTIALLYCOMPLETE"

Expand Down

0 comments on commit d082138

Please sign in to comment.