Skip to content

Commit 2e0ebe7

Browse files
committed
Update infrastructure to python3.11
1 parent d32e01b commit 2e0ebe7

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

Dockerfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
FROM ghcr.io/imperialcollegelondon/anvil-app-server:latest
1+
FROM python:3.11
2+
3+
RUN wget -O - https://apt.corretto.aws/corretto.key | gpg --dearmor -o /usr/share/keyrings/corretto-keyring.gpg && \
4+
echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corretto.aws stable main" | tee /etc/apt/sources.list.d/corretto.list
5+
6+
RUN apt-get update && apt-get install -y java-11-amazon-corretto-jdk && rm -rf /var/lib/apt/lists/*
7+
8+
WORKDIR /apps
9+
10+
RUN mkdir /anvil-data
11+
12+
RUN useradd anvil
13+
RUN chown -R anvil:anvil /anvil-data
14+
USER anvil
15+
216
ENTRYPOINT []
317

418
USER root

client_code/Main/FiguresPanel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def calculate(self, inputs, start_year, end_year, expert_mode=False):
6161

6262
def build_warnings(self):
6363
self.warnings_panel.clear()
64-
warnings = init_vals["layout"]["Warnings"]["Not required"]
64+
warnings = init_vals["layout"].get("Warnings", {}).get("Not required", [])
6565

6666
for key in warnings:
6767
name, output, plot_type, _ = warnings[key]

client_code/Plots.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ def plot_stacked_area(plot, model_solution, output, title, axis_unit):
5353
data = []
5454
total = None
5555
for name, y in _prepare_rows(model_output, x):
56-
if "total" in name.lower():
57-
total = _partial_scatter(
58-
x, y, name, mode="lines", line=dict(width=4, color="black")
59-
)
60-
elif all(val <= 0 for val in y):
61-
data.append(
62-
_partial_scatter(x, y, name=name, mode="lines", stackgroup="two")
63-
)
64-
else:
65-
data.append(
66-
_partial_scatter(x, y, name=name, mode="lines", stackgroup="one")
67-
)
56+
try:
57+
if "total" in name.lower():
58+
total = _partial_scatter(
59+
x, y, name, mode="lines", line=dict(width=4, color="black")
60+
)
61+
elif all(val <= 0 for val in y):
62+
data.append(
63+
_partial_scatter(x, y, name=name, mode="lines", stackgroup="two")
64+
)
65+
else:
66+
data.append(
67+
_partial_scatter(x, y, name=name, mode="lines", stackgroup="one")
68+
)
69+
except TypeError:
70+
pass
6871
if total:
6972
data.append(total)
7073
plot.data = data

scripts/convert_spreadsheet.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$ErrorActionPreference = "Stop"
22
$path = Resolve-Path $args[0]
33

4-
docker run --pull always --rm -it -v ${path}:/opt/excel_to_code/input.xlsx:ro -v ${pwd}:/opt/excel_to_code/work/ ghcr.io/imperialcollegelondon/calc2050_excel_to_code:main bash ./run.sh
4+
docker run --pull always --rm -it -v ${path}:/opt/excel_to_code/input.xlsx:ro -v ${pwd}:/opt/excel_to_code/work/ ghcr.io/imperialcollegelondon/calc2050_excel_to_code:icl bash ./run.sh
55
Copy-Item -Path .\model\_interface2050.cpython-39-x86_64-linux-gnu.so -Destination .\server_code\
66
Copy-Item -Path .\model\interface2050.py -Destination .\server_code\

scripts/convert_spreadsheet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spreadsheet=$(realpath "$1")
2222
docker run --pull always --rm -it -u "$(id -u)":"$(id -g)" \
2323
-v "${spreadsheet}":/opt/excel_to_code/input.xlsx:ro \
2424
-v "$(pwd)":/opt/excel_to_code/work/ \
25-
ghcr.io/imperialcollegelondon/calc2050_excel_to_code:main \
25+
ghcr.io/imperialcollegelondon/calc2050_excel_to_code:icl \
2626
bash ./run.sh
2727

2828
cp model/_interface2050.cpython-39-x86_64-linux-gnu.so model/interface2050.py server_code/

0 commit comments

Comments
 (0)