From 308e8a0fcf1f627331e0772d4a457ee5edcc69f7 Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 13 Feb 2024 18:42:10 +0100 Subject: [PATCH] containers WIP --- Containerfile | 2 +- sim_runner.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Containerfile b/Containerfile index 1890a88..cefefcb 100644 --- a/Containerfile +++ b/Containerfile @@ -3,7 +3,7 @@ RUN apt update && apt install -y software-properties-common RUN add-apt-repository ppa:elmer-csc-ubuntu/elmer-csc-ppa && apt update && apt install -y elmerfem-csc RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y python3-scipy python3-tqdm python3-click python3-tabulate python3-gmsh python3-matplotlib python3-subprocess-tee python3-pip python3-numpy python3-pandas #RUN pip install --break-system-packages pyelmer -RUN pip install pyelmer +RUN pip install pyelmer gerbonara COPY *.py *.yml /nice-coils/ WORKDIR /nice-coils VOLUME /mesh diff --git a/sim_runner.py b/sim_runner.py index d0c630b..75eba6e 100644 --- a/sim_runner.py +++ b/sim_runner.py @@ -285,14 +285,15 @@ def run_mutual_inductance(ctx, target_hosts, job_file): host_log = lambda log_name: ctx.obj['log_dir'] / f'{case_name}-{log_name}-{case_id}.log' mesh_log = host_log('mesh') # host path sim_log = host_log('sim') # host path + mesh_abs = '/var/tmp/mesh' try: args = mesh_args(db, coil_id, 'mutual', mesh_file, str(workdir / 'tmp_pcb.kicad_pcb'), **kwargs) - res = subprocess.run(['ssh', host, 'podman', 'run', '-v', './mesh:/mesh:rw', 'nice-coils-runner', *args], check=True, capture_output=True, text=True) + res = subprocess.run(['ssh', host, 'podman', 'run', '-v', f'{mesh_abs}:/mesh:rw', 'nice-coils-runner', *args], check=True, capture_output=True, text=True) mesh_log.write_text(res.stdout + res.stderr) try: tqdm.tqdm.write(f'Processing {mesh_file} on {host}') - res = subprocess.run(['ssh', host, 'podman', 'run', '-v', './mesh:/mesh:rw', 'nice-coils-runner', 'python', '-m', 'coil_parasitics', 'mutual-inductance', '--sim-dir', workdir, mesh_file], check=True, capture_output=True, text=True) + res = subprocess.run(['ssh', host, 'podman', 'run', '-v', f'{mesh_abs}:/mesh:rw', 'nice-coils-runner', 'python', '-m', 'coil_parasitics', 'mutual-inductance', '--sim-dir', workdir, mesh_file], check=True, capture_output=True, text=True) sim_log.write_text(res.stdout + res.stderr) try: @@ -300,7 +301,7 @@ def run_mutual_inductance(ctx, target_hosts, job_file): 'ElmerGrid_stderr.log', 'ElmerSolver_stdout.log', 'ElmerSolver_stderr.log']: - subprocess.run(['scp', f'{host}:mesh/{workdir.name}/{fn}', str(host_log(Path(fn).stem))], check=True, capture_output=True, text=True) + subprocess.run(['scp', f'{host}:{mesh_abs}/{workdir.name}/{fn}', str(host_log(Path(fn).stem))], check=True, capture_output=True, text=True) except subprocess.CalledProcessError as e: print(f'Error copying simulation logs, rc={e.returncode}', file=sys.stderr)