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

fix(api): Refactor JobState to string #379

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions api/turing/api/ensembler_images_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func (c EnsemblerImagesController) BuildImage(
if err != nil {
return InternalServerError("unable to get MLP project for the router", err.Error())
}
log.Infof("project: %v", project)

ensembler, err := c.EnsemblersService.FindByID(
*options.EnsemblerID,
Expand All @@ -87,7 +86,7 @@ func (c EnsemblerImagesController) BuildImage(

go func() {
if err := c.EnsemblerImagesService.BuildImage(project, pyFuncEnsembler, request.RunnerType); err != nil {
log.Errorf("unable to build ensembler image", err.Error())
log.Errorf("unable to build ensembler image: %s", err.Error())
}
}()

Expand Down
15 changes: 9 additions & 6 deletions api/turing/imagebuilder/imagebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (js JobStatus) IsActive() bool {
return js.State == JobStateActive
}

type JobState int
type JobState string

const (
// jobDeletionTimeoutInSeconds is the maximum time to wait for a job to be deleted from a cluster
Expand All @@ -60,14 +60,17 @@ const (
jobDeletionTickDurationInMilliseconds = 100
// jobCompletionTickDurationInSeconds is the interval at which the API server checks if a job has completed
jobCompletionTickDurationInSeconds = 5
)

const (
// JobStateActive is the status of the image building job is active
JobStateActive = JobState(iota)
// JobStateFailed is when the image building job has failed
JobStateFailed
JobStateActive JobState = "active"
// JobStateSucceeded is when the image building job has succeeded
JobStateSucceeded
JobStateSucceeded JobState = "succeeded"
// JobStateFailed is when the image building job has failed
JobStateFailed JobState = "failed"
// JobStateUnknown is when the image building job status is unknown
JobStateUnknown
JobStateUnknown JobState = "unknown"
)

// BuildImageRequest contains the information needed to build the OCI image
Expand Down
Loading