Try to fix stop job issue. Add Archive to repo.

This commit is contained in:
Jan Eitzinger
2022-02-15 11:10:49 +01:00
parent d1d6520ab5
commit 9047c69fa6
2 changed files with 22 additions and 7 deletions

View File

@@ -78,14 +78,28 @@ func (r *JobRepository) Start(job *schema.JobMeta) (id int64, err error) {
func (r *JobRepository) Stop(
jobId int64,
duration int32,
state schema.JobState,
metricStats map[string]schema.JobStatistics) {
state schema.JobState) {
stmt := sq.Update("job").
Set("job_state", state).
Set("duration", duration).
Where("job.id = ?", jobId)
if _, err := stmt.RunWith(r.DB).Exec(); err != nil {
log.Errorf("Stop job (dbid: %d) failed: %s", jobId, err.Error())
}
}
// Stop updates the job with the database id jobId using the provided arguments.
func (r *JobRepository) Archive(
jobId int64,
monitoringStatus int32,
metricStats map[string]schema.JobStatistics) {
stmt := sq.Update("job").
Set("monitoring_status", monitoringStatus).
Where("job.id = ?", jobId)
for metric, stats := range metricStats {
switch metric {
case "flops_any":