49 lines
2.6 KiB
Plaintext
49 lines
2.6 KiB
Plaintext
-- Metadata of jobs to be fetched by the scheduler and to be
|
|
-- assigned to the workers
|
|
-- part of the *new* job system
|
|
JobMeta
|
|
occurrence JobOccurrence -- When should the job be executed?
|
|
-- (Possibly recurring)
|
|
relativeInTime TimeRelative Maybe -- TODO find better name
|
|
planExecutionAhead NominalDiffTime -- TODO find better name
|
|
executionTimeEpsilon NominalDiffTime Maybe
|
|
priority JobPrio
|
|
ressources JobRessources
|
|
status JobStatus
|
|
lastStartSystem UTCTime Maybe -- when did a job scheduler last order
|
|
-- a job worker to execute this job?
|
|
-- when a job is to be executed now,
|
|
-- lastStartWorker and lastFinished
|
|
-- are unset
|
|
lastStartWorker UTCTime Maybe -- when did a job worker last start
|
|
-- executing this job?
|
|
-- when no time is set, the job either
|
|
-- was never executed yet or execution
|
|
-- was just ordered (or something went
|
|
-- very wrong within the jobsystem)
|
|
lastFinished UTCTime Maybe -- when did a job worker last report
|
|
-- successful execution?
|
|
-- all "last..." fields should be set by the scheduler atomically!
|
|
retryAfter NominalDiffTime Maybe -- if set, the scheduler checks on
|
|
-- the job after this time and retries
|
|
-- the job iff lastStartWorker is set,
|
|
-- but lastFinished is unset
|
|
-- Ensure that retryAfter is sufficient
|
|
-- for this job and application, so better
|
|
-- set to higher values until we know this
|
|
-- job is definitely dead after execution
|
|
-- (pun intended)
|
|
isSystemJob Bool -- new system jobs are to be scheduled, old system jobs to be deleted on migration
|
|
appVersion AppVersion
|
|
deriving Eq Ord Show Generic
|
|
|
|
-- Actual job to be fetched and executed by the workers
|
|
-- part of the *new* job system
|
|
JobData
|
|
meta JobMetaId
|
|
content Value -- JSON representation of the job content
|
|
-- (parsing as generic Aeson Value
|
|
-- instead of Job for compatibility with
|
|
-- legacy jobs)
|
|
deriving Eq Ord Show Generic
|