-
Notifications
You must be signed in to change notification settings - Fork 21
WIP: a new rototron engine #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rjbs
wants to merge
2
commits into
fastmail:main
Choose a base branch
from
rjbs:rototron-bis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b140047
to
945aca5
Compare
15d3cd9
to
3a95bf4
Compare
f23a1b1
to
4022b0d
Compare
32f29ba
to
39ade23
Compare
059d588
to
5767a8f
Compare
aabeec7
to
aafd26b
Compare
747f6ee
to
10212ce
Compare
This is not perfect, or probably even 10 years perfect, but I think it's a big improvement, and should be pretty easy to finish delivering. The old rototron worked like this: every week has a Weeks Since Epoch number, WSE every rotor has a list of workers for each rotor: candidate-list = all workers for rotor, deterministically sorted for each day in the week being scheduled: CANDIDATE: until scheduled or worker list exhausted: candidate = delete candidate-list[ WSE % candidate-list.size ] if candidate is unavailable or on leave next CANDIDATE GOOD: Because the WSE number is stable within a week, the first choice for any day in the week is the same, as is the second. That means a week will favor being one person. If that person is not available for 2 days, the same person is likely to be fallback. BAD: Not too much prevents week 1's first choice from being week 2's second choice, meaning the odds of getting two weeks in a row, when somebody is out for a week, are poorly defined. (Insert link to number theory about coprimality here.) BAD: Rotors are entirely unaware of each other, so nothing much prevents someone being assigned three rotations in a week. The new rototron (not fully implemented yet) works like this: every week has a Weeks Since Epoch number, WSE every rotor has a map of workers to fixed preference¹ every rotor-worker has a level of rotor-fatigue² ROTOR: for each rotor: for every worker in worker map: if worker has any other rotor assignment in this date range: mark worker as one level less preferable for every level of preferability: select set of workers available on the most days³ for each worker in this set: select set of workers with the lowest rotor-fatigue candidate = set[ WSE % set.size ] schedule candidate for all available dates in range redo ROTOR with unscheduled days 1: Preference is a number. The lower the preference number, the more likely someone is to be scheduled. Thing of preference:1 as being "first string". For most rotors, the usual plumbers will all have preference 1, and I (rjbs) might have preference 3. For escalation, a full-time escalation handler would have preference 1, and most everyone else preference 2. 2: I bet we'll want to adjust how rotor fatigue works, but right now your level of rotor fatigue is the number of days you were on rotation in the last 90 days. This builds up every time you're on duty, and fades off over time. 3: If everybody is available all week, the set is everybody. If two people are out one day, it's everybody but those two. If everybody is out exactly one day, it's everybody again. Rotor fatigue probably has two problems. First, if a rotation is done by one person for 90d and then a second person is added to rotation with the same preference, they'd be on rotation 45d before getting a break. be on rotation for 45d straight. Second, it's per-rotor, which may or may not be noticeable over time. Still, it should be easy to adjust its behavior over time, and this was easy to implement. The next likely steps are: 1. Replace the availability checker callback with something acting kind of or exactly like the AvailabilityChecker class in Rototron1. 2. Treat the rototron's own schedule (persisted in SQLite or something) as canonical, with the JMAP duty roster calendar treated as a published copy.
30b72ca
to
03519d5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is not perfect, or probably even 10 years perfect, but I think it's a big improvement, and should be pretty easy to finish delivering.
The old rototron worked like this:
GOOD: Because the WSE number is stable within a week, the first choice for any day in the week is the same, as is the second. That means a week will favor being one person. If that person is not available for 2 days, the same person is likely to be fallback.
BAD: Not too much prevents week 1's first choice from being week 2's second choice, meaning the odds of getting two weeks in a row, when somebody is out for a week, are poorly defined. (Insert link to number theory about coprimality here.)
BAD: Rotors are entirely unaware of each other, so nothing much prevents someone being assigned three rotations in a week.
The new rototron (not fully implemented yet) works like this:
1: Preference is a number. The lower the preference number, the more
likely someone is to be scheduled. Thing of preference:1 as being
"first string". For most rotors, the usual plumbers will all have
preference 1, and I (rjbs) might have preference 3. For escalation,
a full-time escalation handler would have preference 1, and most
everyone else preference 2.
2: I bet we'll want to adjust how rotor fatigue works, but right now
your level of rotor fatigue is the number of days you were on
rotation in the last 90 days. This builds up every time you're on
duty, and fades off over time.
3: If everybody is available all week, the set is everybody. If two
people are out one day, it's everybody but those two. If everybody
is out exactly one day, it's everybody again.
Rotor fatigue probably has two problems. First, if a rotation is done by one person for 90d and then a second person is added to rotation with the same preference, they'd be on rotation 45d before getting a break. be on rotation for 45d straight. Second, it's per-rotor, which may or may not be noticeable over time. Still, it should be easy to adjust its behavior over time, and this was easy to implement.
The next likely steps are:
Replace the availability checker callback with something acting kind of or exactly like the AvailabilityChecker class in Rototron1.
Treat the rototron's own schedule (persisted in SQLite or something) as canonical, with the JMAP duty roster calendar treated as a published copy.