Skip to main content

Module expectations

Module expectations 

Source
Expand description

What tasks are expected to take, shared through the remote store, so that a machine without local history, such as a CI job on a fresh clone, can order tasks and size their shares of the cores.

The store keeps one record per branch, expectations/<name>, holding for each task the last few runs that executed it: their time, the cores they held and the memory they used. A run reads the record of its branch, else that of the default branch, as warm state is read. A run that executed tasks adds their runs to the record the store holds at the time, the branch’s or else the default branch’s, so tasks it did not run keep theirs, and saves it for its branch; the newest save replaces the last. A task is expected to take what expect makes of its runs, as local history makes of its own. QK_REMOTE_EXPECTATIONS narrows what a run may do with them: read reads them without adding to them, and off leaves them alone.

Structs§

Expectation
One run of a task, or what a task is expected to take.
Fetching
A fetch of the expectations the remote store holds, running beside whatever the run does until it needs them. Dropped unwaited, as when local history has every task, it is left to end on its own, and says nothing: the run does not wait for a fetch whose answer it does not need.

Functions§

expect
What a task is expected to take from its recent runs: the median of their times, with the cores that run held, and the most memory any of them used, since expecting too little memory is what costs.
fetch
Starts fetching what each task is expected to take from the record the remote store holds for the current branch, else for the default branch: nothing when no store is configured, QK_REMOTE_EXPECTATIONS is off or the store holds neither. A store that cannot be read is reported.
share
Adds each task’s run in runs to the record the remote store holds, and saves it for the current branch, when the store’s mode and QK_REMOTE_EXPECTATIONS let it be written and there is a branch to name. Failures are reported without failing the run.