diff --git a/swash/config.ini b/swash/config.ini index 490e6c2..cd285dd 100644 --- a/swash/config.ini +++ b/swash/config.ini @@ -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] diff --git a/swash/processing/swash.py b/swash/processing/swash.py index 7521341..edad40b 100644 --- a/swash/processing/swash.py +++ b/swash/processing/swash.py @@ -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()