Commit 9b38f830 authored by S. Lackner's avatar S. Lackner

[code] Move init operations to onSimulationBegins

parent d7208f83
......@@ -106,6 +106,8 @@ class Batsim(object):
self.nb_jobs_failed = 0
self.nb_jobs_timeout = 0
self.initialized = False
self.jobs_manually_changed = set()
self.has_dynamic_job_submissions = False
......@@ -120,6 +122,7 @@ class Batsim(object):
self._read_bat_msg()
self.scheduler.onAfterBatsimInit()
self.initialized = True
def time(self):
return self._current_time
......@@ -445,7 +448,7 @@ class Batsim(object):
self.nb_jobs_failed +
self.nb_jobs_timeout +
self.nb_jobs_killed) == self.nb_jobs_scheduled and
not self.has_dynamic_job_submissions):
not self.has_dynamic_job_submissions) and self.initialized:
self.notify_submission_finished()
else:
self.notify_submission_continue()
......
......@@ -29,25 +29,22 @@ class BaseBatsimScheduler(BatsimScheduler):
"""
def __init__(self, scheduler, options):
super().__init__(options)
self._scheduler = scheduler
self._options = options
self._jobmap = {}
def onAfterBatsimInit(self):
self._scheduler.debug(
"decision process is executing after batsim init", type="on_init")
def onSimulationBegins(self):
self._scheduler.info(
"Simulation begins",
type="simulation_begins_received")
self._scheduler._batsim = self.bs
self._scheduler._update_time()
self._scheduler._on_pre_init()
self._scheduler.on_init()
self._scheduler._on_post_init()
def onSimulationBegins(self):
self._scheduler.info(
"Simulation begins",
type="simulation_begins_received")
def onSimulationEnds(self):
self._scheduler._update_time()
self._scheduler.info(
......
......@@ -18,6 +18,9 @@ class ValidatingMachine(BatsimScheduler):
self.scheduler = scheduler
def onAfterBatsimInit(self):
self.scheduler.onAfterBatsimInit()
def onSimulationBegins(self):
self.nb_res = self.bs.nb_res
self.availableResources = SortedSet(range(self.nb_res))
self.jobs_waiting = []
......@@ -30,9 +33,6 @@ class ValidatingMachine(BatsimScheduler):
self.bs.start_jobs = self.start_jobs
self.scheduler.bs = self.bs
self.scheduler.onAfterBatsimInit()
def onSimulationBegins(self):
self.scheduler.onSimulationBegins()
def onSimulationEnds(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment