Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add a Visible Job Status Function #404

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm im going to check out why my editor didnt format this! I think I may have been the last person to touch this file

)

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
Loading