containers WIP

This commit is contained in:
jaseg 2024-02-13 18:42:10 +01:00
parent 57cb1e3dd7
commit 308e8a0fcf
2 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -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)