Background jobs
Material Management is executing 5 background jobs during its runtime. These jobs are using Quartz (link) for scheduling these jobs.
How scheduling works
On startup the service’s pod will read the configuration, and based on the values in the cyclicTasks section under description_of_the_runtime_configuration_values it will (re)-schedule the jobs. The following options are considered:
-
If the interval values are matching in the configuration and in the scheduled job, no action is taken
-
If the intervals are different, the job will be re-scheduled
-
If the job was not scheduled before, it will be scheduled now with the values in the configuration
In case there is a configuration update performed as described in uploading_new_configuration, the service will check if any of the intervals changed, and will reschedule the job in case its required.
Job execution
Whenever Quartz notices that one of the scheduled jobs has to be executed, it will signal all available replicas, and based on a race-condition via locking, one of the replicas will start executing the job.
Whenever a job starts or completes execution, the JobHistory table in the database will be updated with the details, including success indicator, date and time, and errorText.
If a job is failing during execution, there is an additional retry scheduled in 5 minutes after the failure. If the retry also fails, the scheduling will return to the normal configured intervals.
Jobs and what do they do
BlockExpiredMaterials
Searches for all materials, which fulfill the following criteria:
-
ExpirationDate is in the past
-
Material is currently active
-
Material is not used up yet
-
There is no Expired block on the material yet
Creates an Expired block for all of the materials which were found in the above query.
BlockOverExposedMaterials
Searches for all materials which fulfill the following criteria:
-
Material is active
-
Msl of the material does not have (close-to) infinite FloorLife
-
Material has been exposed for longer than the MSL settings allow
-
FirstOpenedTimestamp is not null
-
Material is not used up yet
-
There is no OverExposed block on the material yet
Creates an OverExposed block for all of the materials which were found in the above query.
SetMaterialsInactive
Searches for all materials which fulfill the following criteria:
-
Material was not used for a while. The threshold is CyclicTasks.inactiveMaterialThreshold from the configuration
-
Material is active
-
Material is not a Master for a Single which was used recently
-
Material is not set to a location
Deactivates the material, setting the Active flag to false (or 0 in the database). Deactivation removes all blocks which can be re-added during activation. It will not delete blocks, which can not be re-evaluated later.