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]
|
[swash]
|
||||||
input=sws/INPUT.sws
|
input=sws/INPUT.sws
|
||||||
swashrun=/opt/swash/swash/swashrun
|
path=/opt/swash
|
||||||
out=out
|
out=out_sws
|
||||||
mpi=4
|
mpi=4
|
||||||
|
|
||||||
[post]
|
[post]
|
||||||
|
|
|
@ -30,9 +30,7 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
|
||||||
|
|
||||||
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"):
|
if config.has_option("swash", "mpi"):
|
||||||
mpi = ("-mpi", config.get("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:
|
with open(tmpdir.joinpath("sws.log"), "w") as logfile:
|
||||||
log.info(f"Runing swash in '{tmpdir}'")
|
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}")
|
log.info(f"Running {cmd}")
|
||||||
|
|
||||||
swash_run = subprocess.Popen(
|
swash_run = subprocess.Popen(
|
||||||
cmd,
|
cmd, cwd=tmpdir, stdout=logfile, stderr=logfile, env={"PATH": path}
|
||||||
cwd=tmpdir,
|
|
||||||
stdout=logfile,
|
|
||||||
stderr=logfile,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
code = swash_run.wait()
|
code = swash_run.wait()
|
||||||
|
|
Loading…
Reference in a new issue