diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py index 45c1e10aae66aa8c9bc53b8d74ae93825dcdbf10..413c28a1f1bfb9f529d2c335ddec662a0311aeb4 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py @@ -1019,7 +1019,7 @@ def assign_or_unassign_resources(subtask: Subtask): # Reason about stations only for observations with a station list if subtask.specifications_template.type.value == SubtaskType.Choices.OBSERVATION.value and \ "stations" in subtask.specifications_doc and "station_list" in subtask.specifications_doc["stations"]: - _check_stations_for_observations(subtask, ra_spec) + _do_assignment_for_observations_with_required_station_check(subtask, ra_spec) else: with RARPC.create() as rarpc: try: @@ -1028,7 +1028,7 @@ def assign_or_unassign_resources(subtask: Subtask): raise SubtaskSchedulingException("Cannot schedule/unschedule subtask id=%d. The required resources are not (fully) available." % subtask.pk) -def _check_stations_for_observations(subtask: Subtask, ra_spec): +def _do_assignment_for_observations_with_required_station_check(subtask: Subtask, ra_spec) -> bool: """ Try to detect conflicts and re-assign if possible. :param subtask: @@ -1047,7 +1047,7 @@ def _check_stations_for_observations(subtask: Subtask, ra_spec): lst_stations_in_conflict = get_stations_in_conflict(subtask.id) lst_stations = determine_stations_which_can_be_assigned(subtask, lst_stations_in_conflict) ra_spec = update_specification(ra_spec, lst_stations) - + return assigned def get_stations_in_conflict(subtask_id): """