chore(jobsystem): add more model fields
This commit is contained in:
parent
ab8bbb5495
commit
9b3b5c1a99
@ -2,9 +2,39 @@
|
||||
-- assigned to the workers
|
||||
-- part of the *new* job system
|
||||
JobMeta
|
||||
occurrence JobOccurrence -- When should the job be executed?
|
||||
-- (Possibly recurring)
|
||||
ressources JobRessources
|
||||
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 JobPriority
|
||||
ressources JobRessources
|
||||
status JobStatus
|
||||
lastStartSystem LocalTime 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 LocalTime 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 LocalTime 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
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
-- SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||
-- SPDX-FileCopyrightText: 2022-2023 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||
--
|
||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
@ -16,6 +16,8 @@ import Import.NoModel
|
||||
|
||||
import qualified Yesod.Auth.Util.PasswordStore as PWStore
|
||||
|
||||
import qualified Data.SemVer as SemVer
|
||||
|
||||
|
||||
type Count = Sum Integer
|
||||
type Points = Centi
|
||||
@ -67,3 +69,5 @@ type SessionFileReference = Digest SHA3_256
|
||||
|
||||
type QualificationName = CI Text
|
||||
type QualificationShorthand = CI Text
|
||||
|
||||
type AppVersion = SemVer.Version
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
module Model.Types.Jobsystem
|
||||
( JobOccurrence(..)
|
||||
, JobPriority(..)
|
||||
, JobRessource(..), JobRessources(..)
|
||||
, module Jobsys.Basics
|
||||
) where
|
||||
|
||||
import Import.NoModel
|
||||
|
||||
import Jobsys.Basics (TimeRelative, JobStatus)
|
||||
|
||||
|
||||
nullaryPathPiece ''TimeRelative $ camelToPathPiece' 2
|
||||
pathPieceJSON ''TimeRelative
|
||||
derivePersistFieldJSON ''TimeRelative
|
||||
|
||||
|
||||
newtype JobOccurrence = JobOccurrence
|
||||
{ jobOccurrence :: Occurrence LocalTime () -- latter is specialtime; not used yet
|
||||
@ -19,6 +28,20 @@ deriveJSON defaultOptions
|
||||
derivePersistFieldJSON ''JobOccurrence
|
||||
|
||||
|
||||
-- | Priorities of jobs to be executed. Note that Top < ... < Least must hold, so be careful with constructor order!
|
||||
data JobPriority
|
||||
= JobPrioTop
|
||||
| JobPrioHigh
|
||||
| JobPrioMedium
|
||||
| JobPrioLow
|
||||
| JobPrioLeast
|
||||
deriving (Eq, Ord, Enum, Bounded, Read, Show, Generic)
|
||||
deriving anyclass (Universe, Finite, NFData)
|
||||
|
||||
nullaryPathPiece ''JobPriority $ camelToPathPiece' 2
|
||||
pathPieceJSON ''JobPriority
|
||||
|
||||
|
||||
data JobRessource
|
||||
= JobResCPU
|
||||
| JobResMemory
|
||||
|
||||
Reference in New Issue
Block a user