Clockwork
The engine of clockwork (§CW-D-7): it turns the nominal times of the schedules in a book into batch jobs.
| Inherits | QObject |
In the namespace clockwork. Declared in src/libs/libclockwork/clockwork/Clockwork.hpp.
Detailed description
advance() does all the work. It reads the clock once, and for each schedule it records the end of a busy run, counts the nominal times in (lastNominal, now], applies the catch-up policy when there is more than one, applies the overlap policy, submits what may start, and saves the book. A timer only wakes it, at the next time or after 60 s at most, so a late timer or a suspended computer costs time and never a firing. advance() also runs at start(), when a job of the queue changes status, and after each write of a schedule.
The engine never reads the wall clock and never reads an environment variable. Its clock and its random stream are functions, as the clock of batch::BatchQueue is. A test gives a scripted clock and a seeded stream, and every count is exact.
A run is busy from its submit until its batch job reaches done, failed, stopped or canceled. A job that the queue no longer holds, or a job with the same id that another submitter made, ends the run as canceled.