Merge pull request #14762 from ywk253100/210427_task_not_found_master

Read upstream job ID as ID when it isn't null
This commit is contained in:
Wenkai Yin(尹文开) 2021-04-29 10:58:48 +08:00 committed by GitHub
commit 30664995c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,13 +49,10 @@ func (h *HookHandler) Handle(ctx context.Context, sc *job.StatusChange) error {
logger := log.GetLogger(ctx)
jobID := sc.JobID
// when a "KindScheduled" job is scheduled by a periodical job, it's "JobID" field
// is set as "87bbdee19bed5ce09c48a149@1605104520" which contains "@". In this case,
// read the parent periodical job ID from "sc.Metadata.UpstreamJobID"
if sc.Metadata.JobKind == job.KindScheduled {
if len(sc.Metadata.UpstreamJobID) > 0 {
jobID = sc.Metadata.UpstreamJobID
}
// the "JobID" field of some kinds of jobs are set as "87bbdee19bed5ce09c48a149@1605104520" which contains "@".
// In this case, read the parent periodical job ID from "sc.Metadata.UpstreamJobID"
if len(sc.Metadata.UpstreamJobID) > 0 {
jobID = sc.Metadata.UpstreamJobID
}
tasks, err := h.taskDAO.List(ctx, &q.Query{
Keywords: map[string]interface{}{