Changed swash to use provided path in conf
This commit is contained in:
parent
0860faf8c3
commit
96d51e4a61
2 changed files with 6 additions and 10 deletions
|
@ -12,8 +12,8 @@ out=out_data
|
|||
|
||||
[swash]
|
||||
input=sws/INPUT.sws
|
||||
swashrun=/opt/swash/swash/swashrun
|
||||
out=out
|
||||
path=/opt/swash
|
||||
out=out_sws
|
||||
mpi=4
|
||||
|
||||
[post]
|
||||
|
|
|
@ -30,9 +30,7 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
|||
|
||||
log.info(f"Copying files to '{tmpdir}'")
|
||||
shutil.copy2(inp, tmpdir)
|
||||
shutil.copytree(
|
||||
pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True
|
||||
)
|
||||
shutil.copytree(pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True)
|
||||
|
||||
if config.has_option("swash", "mpi"):
|
||||
mpi = ("-mpi", config.get("swash", "mpi"))
|
||||
|
@ -42,15 +40,13 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
|||
|
||||
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
||||
log.info(f"Runing swash in '{tmpdir}'")
|
||||
path = pathlib.Path(config.get("swash", "swashrun"))
|
||||
|
||||
cmd = (config.get("swash", "swashrun"), *mpi, "-input", inp.name)
|
||||
cmd = (path.joinpath("swashrun"), *mpi, "-input", inp.name)
|
||||
log.info(f"Running {cmd}")
|
||||
|
||||
swash_run = subprocess.Popen(
|
||||
cmd,
|
||||
cwd=tmpdir,
|
||||
stdout=logfile,
|
||||
stderr=logfile,
|
||||
cmd, cwd=tmpdir, stdout=logfile, stderr=logfile, env={"PATH": path}
|
||||
)
|
||||
|
||||
code = swash_run.wait()
|
||||
|
|
Loading…
Reference in a new issue