Refactor scheduler to move existing stateful parts into an implementation of DataStoreInterface
Context
This is dependent on the work done in !190 (merged) to create DataStoreInterface
.
That MR already persists any state changes into some implementation of this interface. The next step is to move all the stateful logic in Scheduler
behind an implementation of the interface too and make Scheduler
itself a fairly trivial abstraction that handles interactions with the underlying data store (whether that be the moved in-memory objects of the current implementation, or an SQL database using the implementation added in !190 (merged)). This avoids keeping two copies of the state, and makes it possible for multiple instances of Scheduler
to share the same state.
Task Description
-
Extend the interface to allow easily getting instances of Job
to use -
Extend the interface to support getting useful metrics such as number of queued jobs -
Add an implementation of the interface using the various dictionaries that are currently in Scheduler
-
Update Scheduler
to use the interface rather than its internal dictionaries of jobs
Acceptance Criteria
All stateful interactions in Scheduler
are performed via the interface rather than on some instance-specific state.