This is a very big merge request from the misused branch TMSS-671 into master. The branch has been open for way too long, accumulating too many features trying to finish dynamic scheduling as one big feature. My apologies for that.
We discussed in the team that we want this branch to be merged into master, even though dynamic scheduling as one big feature is not finished yet.
What is finished on this branch (and should be reviewed):
- scheduling a subtask does not require the resource assigner anymore. (Any direct TMSS-RA connection has been removed)
- scheduling a subtask does take into account reserved and/or used stations, and checks if the max_nr_missing requirement in the station_groups specification is met.
- there is a new TMSS-RA-Adapter: a scheduled observation makes a reservation in the RA. And a scheduled observation in RA/OTDB/MoM makes a reservation in TMSS. Thus, the two systems can be used in the transitioning period, each blocking the others availability, thus preventing accidents.
- moved scheduling code into a class Scheduler in dynamic_scheduling.py
- made the scheduler event driven, doing a scheduling-run upon receiving 'changed' events for reservations, constraints, project priorities/states, etc.
- made the scheduler interruptible: When doing a (long lasting) scheduling-run, it can be interrupted to 'start over' using the lastest changes in projects/reservations/constraints/etc.
- The constraints are evaluated, but as can be seen in various skipped tests, not all constraints are evaluated correctly.... These are too be fixed in new (small!) tickets.
- The generic concept that constraints tell us if a schedulingunit can be scheduled in a certain time window works.
- The generic concept that constraints tell us how 'good' a schedulingunit fits at a certain time stamp works.
- The generic concept that all constraint scores are weighed to compute one 'weighed_score' per schedulingunit to sort the best fitting unit in a window works.
- constraint weights can be changed, also triggering the event driven scheduler.
- fixed_time 'at'-this-timestamp scheduling works. Any unit with the fixed_time 'at' constraint is scheduled, no matter how far in the future (taking into account reservations/other units)
- introduced the 'unschedulable' status, meaning that given these constraints and specs, a unit cannot be scheduled: Thus, the status becomes unschedulable, thus the user must take actions.
- many more small changes/fixes/improvements/refactorings....
Let's focus in this review at:
- proper code
- enough test coverage
- clear test goals
Small fixes improvements coming out of the review can and will be done in this MR. For bigger ones, or for major features that need to be addressed we create a new JIRA ticket for follow-up.
The result is that after this MR has been merged to master, we still have a stable and usable master branch, including the above functionality/features, and a set of tickets to address the outstanding dynamic scheduling issues.