worker: normalize job logging

The format is now always 'JOB_ID' (JOB_TYPE). This means that we also know
the job type when a job is finished or when it failed.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-11-24 12:12:32 +01:00 committed by Ondřej Budai
parent dc7968d5c7
commit 76d8a75184

View file

@ -104,7 +104,7 @@ func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls
return err
}
logrus.Infof("Running '%s' job %v\n", job.Type(), job.Id())
logrus.Infof("Running job '%s' (%s)\n", job.Id(), job.Type())
ctx, cancelWatcher := context.WithCancel(context.Background())
go WatchJob(ctx, job)
@ -112,12 +112,12 @@ func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls
err = impl.Run(job)
cancelWatcher()
if err != nil {
logrus.Warnf("Job %s failed: %v", job.Id(), err)
logrus.Warnf("Job '%s' (%s) failed: %v", job.Id(), job.Type(), err)
// Don't return this error so the worker picks up the next job immediately
return nil
}
logrus.Infof("Job %s finished", job.Id())
logrus.Infof("Job '%s' (%s) finished", job.Id(), job.Type())
return nil
}