From 56f1b6db3ea05b8682feb4bbb32e919e22c2a8a3 Mon Sep 17 00:00:00 2001 From: chun9l <97897047+chun9l@users.noreply.github.com> Date: Sat, 18 May 2024 18:41:03 +0100 Subject: [PATCH 1/3] Revert achlys dockerfile and change venv --- models/achlys/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/achlys/Dockerfile b/models/achlys/Dockerfile index a70a90a..d85d177 100644 --- a/models/achlys/Dockerfile +++ b/models/achlys/Dockerfile @@ -1,9 +1,9 @@ -FROM achlys-ubuntu +FROM linusseelinger/achlys-ubuntu RUN apt update && apt install -y inotify-tools && \ rm -rf /var/lib/apt/lists/* -RUN apt install -y python3-pip python3-venv && \ +RUN apt install -y python3-pip python3-virtualenv && \ python3 -m venv venv && \ . venv/bin/activate && \ pip install umbridge From f58e2de21d740c03c58bf57575157101131da165 Mon Sep 17 00:00:00 2001 From: chun9l <97897047+chun9l@users.noreply.github.com> Date: Sat, 18 May 2024 19:14:58 +0100 Subject: [PATCH 2/3] Add command to start server --- models/gs2/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/models/gs2/Dockerfile b/models/gs2/Dockerfile index 1c33f07..6f27470 100644 --- a/models/gs2/Dockerfile +++ b/models/gs2/Dockerfile @@ -36,7 +36,8 @@ RUN echo 'alias pip=pip3' >> $HOME/.bashrc RUN echo 'export GK_SYSTEM=gnu_ubuntu' >> $HOME/.bashrc -RUN pip install ford netCDF4==1.6.2 +RUN python -m venv venv && . venv/bin/activate && \ + pip install ford netCDF4==1.6.2 umbridge pyrokinetics RUN git clone https://whornsby@bitbucket.org/gyrokinetics/gs2.git /usr/gs2 @@ -51,5 +52,8 @@ RUN echo ${GK_SYSTEM} RUN make -IMakefiles depend RUN make -IMakefiles gs2 - #RUN make -IMakefiles tests + +COPY server.py fast.in . + +CMD . venv/bin/activate && python server.py From f0b20e08eb011677b9aea8e087591656b0d587e8 Mon Sep 17 00:00:00 2001 From: chun9l <97897047+chun9l@users.noreply.github.com> Date: Sat, 18 May 2024 19:15:29 +0100 Subject: [PATCH 3/3] only mkdir if didnt exist --- models/gs2/server.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/gs2/server.py b/models/gs2/server.py index a3491f7..d2d392b 100644 --- a/models/gs2/server.py +++ b/models/gs2/server.py @@ -3,7 +3,6 @@ import os import csv from pyrokinetics import Pyro -import numpy as np from datetime import datetime from fileinput import FileInput @@ -21,7 +20,7 @@ def get_output_sizes(self, config): def __call__(self, parameters, config): input_file = "fast.in" # Select input file - os.system("mkdir restart") # GS2 needs this folder otherwise will fail + os.system("mkdir -p restart") # GS2 needs this folder otherwise will fail with FileInput(files=input_file, inplace=True) as file: checkpoint = 0 for line in file: