# ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
...
...
@@ -20,9 +18,20 @@
# You should have received a copy of the GNU General Public License along
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
#
# $Id: $
"""
This __init__ module for this constraints python package defines the 'API' to:
- filter a list of schedulable scheduling_units by checking their constraints: see method filter_scheduling_units_using_constraints
- sort a (possibly filtered) list of schedulable scheduling_units evaluating their constraints and computing a 'finess' score: see method get_sorted_scheduling_units_scored_by_constraints
These main methods are used in the dynamic_scheduler to pick the next best scheduling unit, and compute the midterm schedule.
Currently we have only one SchedulingConstraintsTemplate in TMSS, named 'constraints', version 1.
But, it is envisioned that we we get more templates.
So, based on the template the actual filter and score methods are selected from a specific module.
By convention we use one module per template. Currently, we have and use only module template_constraints_v1.py
If/When we add a new SchedulingConstraintsTemplate, then we should add a new module with the specific filter and score methods,
and add a extra 'if' in the strategy pattern used here. (see below for implementation)
"""
importlogging
...
...
@@ -33,6 +42,17 @@ from typing import NamedTuple
fromlofar.sas.tmss.tmss.tmssappimportmodels
fromlofar.sas.tmss.tmss.exceptionsimport*
################## main data struct and methods ##################
classScoredSchedulingUnit(NamedTuple):
'''struct for collecting scores per constraint and a weighted_score for a scheduling_unit at the given start_time