Skip to content

Commit c96619d

Browse files
author
Arief Rahmansyah
authored
Refactor JobState to string (caraml-dev#379)
1 parent 9b21e1b commit c96619d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

api/turing/api/ensembler_images_api.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ func (c EnsemblerImagesController) BuildImage(
6767
if err != nil {
6868
return InternalServerError("unable to get MLP project for the router", err.Error())
6969
}
70-
log.Infof("project: %v", project)
7170

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

8887
go func() {
8988
if err := c.EnsemblerImagesService.BuildImage(project, pyFuncEnsembler, request.RunnerType); err != nil {
90-
log.Errorf("unable to build ensembler image", err.Error())
89+
log.Errorf("unable to build ensembler image: %s", err.Error())
9190
}
9291
}()
9392

api/turing/imagebuilder/imagebuilder.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (js JobStatus) IsActive() bool {
5151
return js.State == JobStateActive
5252
}
5353

54-
type JobState int
54+
type JobState string
5555

5656
const (
5757
// jobDeletionTimeoutInSeconds is the maximum time to wait for a job to be deleted from a cluster
@@ -60,14 +60,17 @@ const (
6060
jobDeletionTickDurationInMilliseconds = 100
6161
// jobCompletionTickDurationInSeconds is the interval at which the API server checks if a job has completed
6262
jobCompletionTickDurationInSeconds = 5
63+
)
64+
65+
const (
6366
// JobStateActive is the status of the image building job is active
64-
JobStateActive = JobState(iota)
65-
// JobStateFailed is when the image building job has failed
66-
JobStateFailed
67+
JobStateActive JobState = "active"
6768
// JobStateSucceeded is when the image building job has succeeded
68-
JobStateSucceeded
69+
JobStateSucceeded JobState = "succeeded"
70+
// JobStateFailed is when the image building job has failed
71+
JobStateFailed JobState = "failed"
6972
// JobStateUnknown is when the image building job status is unknown
70-
JobStateUnknown
73+
JobStateUnknown JobState = "unknown"
7174
)
7275

7376
// BuildImageRequest contains the information needed to build the OCI image

0 commit comments

Comments
 (0)