The ExpectationManager is the main class of this package.
The ExpectationManager class is a stateful class which tracks the status of Expectations and PackageContainerExpectations, and communicates with Workers in order to work on them.
Upon startup, one (1) instance of each of these classes are spun up:
ExpectationManager, the main class of this package. It is a stateful class that is responsible for interfacing with Workers and Workforce.- The
ExpectationTracker, a stateful class. Responsible for keeping track of allExpectationsandPackageContainerExpectations. - The
EvaluationSchedulerResponsible for triggering an Evaluation in a timely manner. - The
WorkInProgressTrackerResponsible for tracking jobs that are currently in progress by one of the Workers.
When an Evaluation is triggered (by EvaluationScheduler), an instance of the EvaluationRunner is created. This instance is short-lived and is teared down after the Evaluation is completed.
Evaluations are triggered continously (by EvaluationScheduler) every few seconds.
During an Evaluation the following things happen:
-
Update of incoming data If there have been any incoming data (from Package Manager), such as expectations, packageContainerExpectations or restart/abort-commands, update the
trackedExpectationsaccordingly. -
Evaluate all TrackedExpectations The TrackedExpectations all have a current state. An evaluation evaluated the state and possibly changes the state to another state. For example, if a TrackedExpectation is in a WAITING state, it might be moved to READY and then to WORKING. The Evaluations are done in 2 passes:
- The first pass evaluates TrackedExpectations that are in some certain states, in parallel.
- The first pass evaluates the rest of TrackedExpectations, in series.
-
Evaluate all TrackedPackageContainers
- Set up any Monitors for the TrackedPackageContainer.
- Run any cronjobs that are scheduled to run.