Unverified Commit 2735154e authored by Jakob Görgen's avatar Jakob Görgen
Browse files

runtime fixes in regards to preparation phase

parent 1c24e0fb
......@@ -56,9 +56,6 @@ class Run:
def name(self) -> str:
return self._simulation.name + "." + str(self._run_nr)
async def prep_dirs(self, executor=command_executor.LocalExecutor()) -> None:
await self._instantiation.prepare_directories(executor=executor)
class Runtime(metaclass=abc.ABCMeta):
"""Base class for managing the execution of multiple runs."""
......
......@@ -55,7 +55,6 @@ class LocalSimpleRuntime(run_base.Runtime):
)
if self._profile_int:
runner.profile_int = self.profile_int
await run.prep_dirs(self._executor)
await runner.prepare()
except asyncio.CancelledError:
# it is safe to just exit here because we are not running any
......@@ -132,7 +131,6 @@ class LocalParallelRuntime(run_base.Runtime):
)
if self._profile_int is not None:
runner._profile_int = self._profile_int
await run.prep_dirs(executor=self._executor)
await runner.prepare()
except asyncio.CancelledError:
# it is safe to just exit here because we are not running any
......
......@@ -132,19 +132,24 @@ class ExperimentBaseRunner(abc.ABC):
# copies.append(task)
# await asyncio.gather(*copies)
# TODO: FIXME
executor = command_executor.LocalExecutor()
self._instantiation.executor = executor
await self._instantiation.prepare()
# prepare all simulators in parallel
sims = []
for sim in self._simulation.all_simulators():
sim.prep_tar(self._instantiation)
prep_cmds = list(sim.prep_cmds(inst=self._instantiation))
executor = self.sim_executor(sim)
task = asyncio.create_task(
executor.run_cmdlist(
'prepare_' + self._simulation.name, prep_cmds, verbose=self._verbose
)
)
sims.append(task)
await asyncio.gather(*sims)
# sims = []
# for sim in self._simulation.all_simulators():
# sim.prep_tar(self._instantiation)
# prep_cmds = list(sim.prep_cmds(inst=self._instantiation))
# executor = self.sim_executor(sim)
# task = asyncio.create_task(
# executor.run_cmdlist(
# 'prepare_' + self._simulation.name, prep_cmds, verbose=self._verbose
# )
# )
# sims.append(task)
# await asyncio.gather(*sims)
async def wait_for_sims(self) -> None:
"""Wait for simulators to terminate (the ones marked to wait on)."""
......@@ -254,7 +259,6 @@ class ExperimentSimpleRunner(ExperimentBaseRunner):
return self._executor
# TODO: FIXME
class ExperimentDistributedRunner(ExperimentBaseRunner):
"""Simple experiment runner with just one executor."""
......
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