You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
/* |
|
------------------------------------------------------------------------------------------------------------------------ |
|
####### dune ####### Copyright (c) 2021 losyme ##################################################### MIT License ####### |
|
------------------------------------------------------------------------------------------------------------------------ |
|
*/ |
|
|
|
package model |
|
|
|
import ( |
|
"forge.chapril.org/dune/jw" |
|
"forge.chapril.org/losyme/errors" |
|
) |
|
|
|
func selectNextJob(jr jw.JobsRunning, jtr jw.JobsToRun) (*jw.Job, error) { |
|
// AFINIR |
|
return nil, nil |
|
} |
|
|
|
func (m *Model) NextJob(namespace string) (*jw.Job, error) { |
|
job, err := m.Storage.NextJob(namespace, selectNextJob) |
|
if err != nil { |
|
m.Logger.Warning( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
"Cannot retrieve the next job to run", |
|
"reason", err, |
|
) |
|
|
|
return nil, errors.WithMessage(err, "cannot retrieve the next job to run") ///////////////////////////////////// |
|
} |
|
|
|
if job == nil { |
|
return nil, nil |
|
} |
|
|
|
job.Session += 1 |
|
job.Result = nil |
|
|
|
m.Logger.Info( //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
"Next job", |
|
append( |
|
job.Fields(), |
|
"attempt", job.Attempt, |
|
"session", job.Session, |
|
)..., |
|
) |
|
|
|
return job, nil |
|
} |
|
|
|
/* |
|
######################################################################################################## @(°_°)@ ####### |
|
*/
|
|
|