Skip to content
Snippets Groups Projects
Commit 5fd743bf authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-320: minor tweaks

parent a75bf41c
No related branches found
No related tags found
2 merge requests!308Resolve TMSS-495,!306Resolve TMSS-320
......@@ -583,8 +583,7 @@ def create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id: int
def start_handling(self):
from lofar.common import isProductionEnvironment
if isProductionEnvironment():
logger.fatal("Do not use this tool to simulate running a scheduling_unit in a production environment! Exiting!")
exit(1)
raise RuntimeError("Do not use this tool to simulate running a scheduling_unit in a production environment!")
super().start_handling()
......@@ -614,13 +613,14 @@ def create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id: int
for task_blueprint in scheduling_unit.task_blueprints.all():
for subtask in task_blueprint.subtasks.filter(inputs=None,
state__value=models.SubtaskState.Choices.DEFINED.value).all():
if self.need_to_handle(subtask):
subtask.start_time = datetime.utcnow() + task_blueprint.relative_start_time
while subtask.state.value != models.SubtaskState.Choices.SCHEDULED.value:
try:
schedule_subtask_and_update_successor_start_times(subtask)
except SubtaskSchedulingException:
except SubtaskSchedulingException as e:
# try again, a bit later
subtask.state = models.SubtaskState.objects.get(value=models.SubtaskState.Choices.DEFINED.value)
update_start_time_and_shift_successors_until_after_stop_time(subtask, subtask.start_time + timedelta(hours=3))
......@@ -773,6 +773,8 @@ def main_scheduling_unit_blueprint_simulator():
stop_event = threading.Event()
with BusListenerJanitor(create_scheduling_unit_blueprint_simulator(scheduling_unit_blueprint_id, stop_event=stop_event,
delay=options.event_delay, duration=options.duration,
handle_observations=bool(options.observation), handle_pipelines=bool(options.pipeline),
handle_QA=bool(options.QA), handle_ingest=bool(options.ingest),
exchange=options.exchange, broker=options.broker)):
stop_event.wait()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment