Added mpi information to logs
This commit is contained in:
parent
eca2636e08
commit
67fa3a09a5
1 changed files with 12 additions and 6 deletions
|
@ -28,20 +28,26 @@ if out.exists():
|
||||||
with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
||||||
tmpdir = pathlib.Path(tmp_raw)
|
tmpdir = pathlib.Path(tmp_raw)
|
||||||
|
|
||||||
if config.has_option("swash", "mpi"):
|
|
||||||
mpi = ("-mpi", config.get("swash", "mpi"))
|
|
||||||
else:
|
|
||||||
mpi = ()
|
|
||||||
|
|
||||||
log.info(f"Copying files to '{tmpdir}'")
|
log.info(f"Copying files to '{tmpdir}'")
|
||||||
shutil.copy2(inp, tmpdir)
|
shutil.copy2(inp, tmpdir)
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True
|
pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if config.has_option("swash", "mpi"):
|
||||||
|
mpi = ("-mpi", config.get("swash", "mpi"))
|
||||||
|
log.info(f"Using mpi with {mpi}")
|
||||||
|
else:
|
||||||
|
mpi = ()
|
||||||
|
|
||||||
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
||||||
log.info(f"Runing swash in '{tmpdir}'")
|
log.info(f"Runing swash in '{tmpdir}'")
|
||||||
|
|
||||||
|
cmd = (config.get("swash", "swashrun"), "-input", inp.name, *mpi)
|
||||||
|
log.info(f"Running {cmd}")
|
||||||
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
(config.get("swash", "swashrun"), "-input", inp.name, *mpi),
|
cmd,
|
||||||
cwd=tmpdir,
|
cwd=tmpdir,
|
||||||
stdout=logfile,
|
stdout=logfile,
|
||||||
stderr=logfile,
|
stderr=logfile,
|
||||||
|
|
Loading…
Reference in a new issue