mirror of
https://github.com/goharbor/harbor
synced 2025-04-30 11:37:50 +00:00
Merge pull request #7125 from ywk253100/190312_update_job_id
Update the job ID in flow controller
This commit is contained in:
commit
5f8c19e5ed
@ -246,12 +246,13 @@ func (f *flow) schedule() error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
allFailed = false
|
allFailed = false
|
||||||
// if the task is submitted successfully, update the status and start time
|
// if the task is submitted successfully, update the status, job ID and start time
|
||||||
if err = f.executionMgr.UpdateTaskStatus(result.TaskID, model.TaskStatusPending); err != nil {
|
if err = f.executionMgr.UpdateTaskStatus(result.TaskID, model.TaskStatusPending); err != nil {
|
||||||
log.Errorf("failed to update task status %d: %v", result.TaskID, err)
|
log.Errorf("failed to update task status %d: %v", result.TaskID, err)
|
||||||
}
|
}
|
||||||
if err = f.executionMgr.UpdateTask(&model.Task{
|
if err = f.executionMgr.UpdateTask(&model.Task{
|
||||||
ID: result.TaskID,
|
ID: result.TaskID,
|
||||||
|
JobID: result.JobID,
|
||||||
StartTime: time.Now(),
|
StartTime: time.Now(),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.Errorf("failed to update task %d: %v", result.TaskID, err)
|
log.Errorf("failed to update task %d: %v", result.TaskID, err)
|
||||||
|
@ -49,6 +49,7 @@ type ScheduleItem struct {
|
|||||||
// ScheduleResult is the result of the schedule for one item
|
// ScheduleResult is the result of the schedule for one item
|
||||||
type ScheduleResult struct {
|
type ScheduleResult struct {
|
||||||
TaskID int64
|
TaskID int64
|
||||||
|
JobID string
|
||||||
Error error
|
Error error
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,16 +120,16 @@ func (d *DefaultReplicator) Schedule(items []*ScheduleItem) ([]*ScheduleResult,
|
|||||||
"src_resource": string(src),
|
"src_resource": string(src),
|
||||||
"dst_resource": string(dest),
|
"dst_resource": string(dest),
|
||||||
}
|
}
|
||||||
_, joberr := d.client.SubmitJob(job)
|
id, joberr := d.client.SubmitJob(job)
|
||||||
if joberr != nil {
|
if joberr != nil {
|
||||||
result.Error = joberr
|
result.Error = joberr
|
||||||
results = append(results, result)
|
results = append(results, result)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
result.JobID = id
|
||||||
results = append(results, result)
|
results = append(results, result)
|
||||||
}
|
}
|
||||||
return results, nil
|
return results, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the transfer job
|
// Stop the transfer job
|
||||||
|
Loading…
x
Reference in New Issue
Block a user