Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
severinson committed Nov 14, 2023
2 parents 0978736 + e1c7950 commit 77ab476
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 246 deletions.
30 changes: 15 additions & 15 deletions internal/scheduler/jobdb/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Job struct {
queue string
// Jobset the job belongs to.
// We store this as it's needed for sending job event messages.
jobset string
jobSet string
// Per-queue priority of this job.
priority uint32
// Requested per queue priority of this job.
Expand All @@ -43,8 +43,8 @@ type Job struct {
priorityClass types.PriorityClass
// True if the user has requested this job be cancelled
cancelRequested bool
// True if the user has requested this job's jobset be cancelled
cancelByJobsetRequested bool
// True if the user has requested this job's jobSet be cancelled
cancelByJobSetRequested bool
// True if the scheduler has cancelled the job
cancelled bool
// True if the scheduler has failed the job
Expand Down Expand Up @@ -98,7 +98,7 @@ func (job *Job) Equal(other *Job) bool {
if job.queue != other.queue {
return false
}
if job.jobset != other.jobset {
if job.jobSet != other.jobSet {
return false
}
if job.priority != other.priority {
Expand Down Expand Up @@ -132,7 +132,7 @@ func (job *Job) Equal(other *Job) bool {
if job.cancelRequested != other.cancelRequested {
return false
}
if job.cancelByJobsetRequested != other.cancelByJobsetRequested {
if job.cancelByJobSetRequested != other.cancelByJobSetRequested {
return false
}
if job.cancelled != other.cancelled {
Expand Down Expand Up @@ -167,15 +167,15 @@ func (job *Job) GetId() string {
return job.id
}

// Jobset returns the jobset the job belongs to.
// Jobset returns the jobSet the job belongs to.
func (job *Job) Jobset() string {
return job.jobset
return job.jobSet
}

// GetJobSet returns the jobset the job belongs to.
// GetJobSet returns the jobSet the job belongs to.
// This is needed for compatibility with legacyJob
func (job *Job) GetJobSet() string {
return job.jobset
return job.jobSet
}

// Queue returns the queue this job belongs to.
Expand Down Expand Up @@ -327,9 +327,9 @@ func (job *Job) CancelRequested() bool {
return job.cancelRequested
}

// CancelByJobsetRequested returns true if the user has requested this job's jobset be cancelled.
// CancelByJobsetRequested returns true if the user has requested this job's jobSet be cancelled.
func (job *Job) CancelByJobsetRequested() bool {
return job.cancelByJobsetRequested
return job.cancelByJobSetRequested
}

// WithCancelRequested returns a copy of the job with the cancelRequested status updated.
Expand All @@ -339,10 +339,10 @@ func (job *Job) WithCancelRequested(cancelRequested bool) *Job {
return j
}

// WithCancelByJobsetRequested returns a copy of the job with the cancelByJobsetRequested status updated.
// WithCancelByJobsetRequested returns a copy of the job with the cancelByJobSetRequested status updated.
func (job *Job) WithCancelByJobsetRequested(cancelByJobsetRequested bool) *Job {
j := copyJob(*job)
j.cancelByJobsetRequested = cancelByJobsetRequested
j.cancelByJobSetRequested = cancelByJobsetRequested
return j
}

Expand Down Expand Up @@ -488,10 +488,10 @@ func (job *Job) HasQueueTtlSet() bool {
return job.GetQueueTtlSeconds() > 0
}

// WithJobset returns a copy of the job with the jobset updated.
// WithJobset returns a copy of the job with the jobSet updated.
func (job *Job) WithJobset(jobset string) *Job {
j := copyJob(*job)
j.jobset = jobset
j.jobSet = jobset
return j
}

Expand Down
10 changes: 5 additions & 5 deletions internal/scheduler/jobdb/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var jobDb = NewJobDb(

var baseJob = jobDb.NewJob(
"test-job",
"test-jobset",
"test-jobSet",
"test-queue",
2,
schedulingInfo,
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestJob_TestRunsById(t *testing.T) {

func TestJob_TestWithJobset(t *testing.T) {
newJob := baseJob.WithJobset("fish")
assert.Equal(t, "test-jobset", baseJob.Jobset())
assert.Equal(t, "test-jobSet", baseJob.Jobset())
assert.Equal(t, "fish", newJob.Jobset())
}

Expand All @@ -302,9 +302,9 @@ func TestJob_TestWithCreated(t *testing.T) {
}

func TestJob_DeepCopy(t *testing.T) {
original := jobDb.NewJob("test-job", "test-jobset", "test-queue", 2, schedulingInfo, true, 0, false, false, false, 3)
original := jobDb.NewJob("test-job", "test-jobSet", "test-queue", 2, schedulingInfo, true, 0, false, false, false, 3)
original = original.WithUpdatedRun(baseJobRun.DeepCopy())
expected := jobDb.NewJob("test-job", "test-jobset", "test-queue", 2, schedulingInfo, true, 0, false, false, false, 3)
expected := jobDb.NewJob("test-job", "test-jobSet", "test-queue", 2, schedulingInfo, true, 0, false, false, false, 3)
expected = expected.WithUpdatedRun(baseJobRun.DeepCopy())

result := original.DeepCopy()
Expand Down Expand Up @@ -356,7 +356,7 @@ func TestJobSchedulingInfoFieldsInitialised(t *testing.T) {
assert.Nil(t, infoWithNilFields.GetPodRequirements().NodeSelector)
assert.Nil(t, infoWithNilFields.GetPodRequirements().Annotations)

job := jobDb.NewJob("test-job", "test-jobset", "test-queue", 2, infoWithNilFieldsCopy, true, 0, false, false, false, 3)
job := jobDb.NewJob("test-job", "test-jobSet", "test-queue", 2, infoWithNilFieldsCopy, true, 0, false, false, false, 3)
assert.NotNil(t, job.GetNodeSelector())
assert.NotNil(t, job.GetAnnotations())

Expand Down
Loading

0 comments on commit 77ab476

Please sign in to comment.