Skip to content

Commit

Permalink
Update job info to receive new job waiting time key.
Browse files Browse the repository at this point in the history
Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
  • Loading branch information
jiangkaihua committed Jan 17, 2022
1 parent 93fb3ff commit d21f114
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/scheduler/api/job_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ func (ji *JobInfo) SetPodGroup(pg *PodGroup) {
ji.CreationTimestamp = pg.GetCreationTimestamp()

var err error
ji.WaitingTime, err = ji.extractWaitingTime(pg)
ji.WaitingTime, _ = ji.extractWaitingTime(pg, JobWaitingTime)
ji.WaitingTime, err = ji.extractWaitingTime(pg, v1beta1.JobWaitingTime)
if err != nil {
klog.Warningf("Error occurs in parsing waiting time for job <%s/%s>, err: %s.",
pg.Namespace, pg.Name, err.Error())
Expand All @@ -388,12 +389,12 @@ func (ji *JobInfo) SetPodGroup(pg *PodGroup) {

// extractWaitingTime reads sla waiting time for job from podgroup annotations
// TODO: should also read from given field in volcano job spec
func (ji *JobInfo) extractWaitingTime(pg *PodGroup) (*time.Duration, error) {
if _, exist := pg.Annotations[JobWaitingTime]; !exist {
func (ji *JobInfo) extractWaitingTime(pg *PodGroup, waitingTimeKey string) (*time.Duration, error) {
if _, exist := pg.Annotations[waitingTimeKey]; !exist {
return nil, nil
}

jobWaitingTime, err := time.ParseDuration(pg.Annotations[JobWaitingTime])
jobWaitingTime, err := time.ParseDuration(pg.Annotations[waitingTimeKey])
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d21f114

Please sign in to comment.