Skip to content

Commit

Permalink
Merge pull request #1378 from virtualcell/Container-deploy-fixes
Browse files Browse the repository at this point in the history
Series of changes to get BSTS to approve of 7.7 Container
  • Loading branch information
CodeByDrescher authored Nov 15, 2024
2 parents 09470a2 + 796e148 commit f35690b
Show file tree
Hide file tree
Showing 24 changed files with 533 additions and 171 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/bsts_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ jobs:

- name: Install Perl # for BioNetGen
run: |
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends perl
sudo apt update -y
sudo apt install -y --no-install-recommends perl
- name: Install XPP
run: |
sudo apt-get install -y --no-install-recommends xppaut
sudo apt install -y --no-install-recommends xppaut
- name: Install Go (for Singularity)
uses: actions/setup-go@v3
Expand All @@ -47,7 +47,7 @@ jobs:
OS: linux
ARCH: amd64
run: |
sudo apt-get install -y --no-install-recommends \
sudo apt install -y --no-install-recommends \
build-essential \
libseccomp-dev \
pkg-config \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install hdf5 tools needed for testing
run: sudo apt-get -y update && sudo apt-get -y install hdf5-tools
run: sudo apt -y update && sudo apt -y install hdf5-tools

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
8 changes: 4 additions & 4 deletions docker/build/Dockerfile-admin-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ RUN $JAVA_HOME/bin/jlink \
--output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM debian:buster-slim
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17
RUN apt-get -y update && \
apt-get install -y curl dnsutils apt-utils libfreetype6 fontconfig fonts-dejavu openssh-client && \
RUN apt -y update && \
apt install -y curl dnsutils apt-utils libfreetype6 fontconfig fonts-dejavu openssh-client && \
mkdir -p /usr/local/app/lib

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
6 changes: 3 additions & 3 deletions docker/build/Dockerfile-api-dev
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17 and Python 3.9

RUN apt-get -y update && \
apt-get install -y --no-install-recommends curl dnsutils apt-utils libfreetype6 fontconfig fonts-dejavu && \
RUN apt -y update && \
apt install -y --no-install-recommends curl dnsutils apt-utils libfreetype6 fontconfig fonts-dejavu && \
mkdir -p /usr/local/app/lib

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
8 changes: 4 additions & 4 deletions docker/build/Dockerfile-batch-dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM ghcr.io/virtualcell/vcell-solvers:v0.8.2

RUN apt-get -y update && \
apt-get install -y curl && \
apt-get install -y wget gdebi-core apt-utils libfreetype6 fontconfig fonts-dejavu && \
RUN apt -y update && \
apt install -y curl && \
apt install -y wget gdebi-core apt-utils libfreetype6 fontconfig fonts-dejavu && \
pip3 install thrift

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
6 changes: 3 additions & 3 deletions docker/build/Dockerfile-clientgen-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ RUN $JAVA_HOME/bin/jlink \
--output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM debian:buster-slim
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

RUN mkdir -p /usr/local/app && \
apt-get -y update && \
apt-get -y install wget apt-utils libfreetype6 fontconfig fonts-dejavu
apt -y update && \
apt -y install wget apt-utils libfreetype6 fontconfig fonts-dejavu

RUN mkdir /installer && cd /installer && \
wget --quiet -O install4j_unix_10_0_5.tar.gz \
Expand Down
6 changes: 3 additions & 3 deletions docker/build/Dockerfile-data-dev
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ COPY --from=jre-build /javaruntime $JAVA_HOME

# now we have Java 17 and Python 3.9

RUN apt-get -y update && \
apt-get -y install openssh-client screen apt-utils libfreetype6 fontconfig fonts-dejavu && \
RUN apt -y update && \
apt -y install openssh-client screen apt-utils libfreetype6 fontconfig fonts-dejavu && \
mkdir -p /usr/local/app

RUN python3 -m pip install poetry && poetry config cache-dir "/poetry/.cache"
ENV PATH="/root/.poetry/bin:/root/.local/bin:$PATH"

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
8 changes: 4 additions & 4 deletions docker/build/Dockerfile-db-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ RUN $JAVA_HOME/bin/jlink \
--output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM debian:buster-slim
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

RUN mkdir -p /usr/local/app && \
apt-get -y update && \
apt-get -y install screen apt-utils libfreetype6 fontconfig fonts-dejavu
apt -y update && \
apt -y install screen apt-utils libfreetype6 fontconfig fonts-dejavu

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
8 changes: 4 additions & 4 deletions docker/build/Dockerfile-sched-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ RUN $JAVA_HOME/bin/jlink \
--output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM debian:buster-slim
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME


RUN mkdir -p /usr/local/app && \
apt-get -y update && \
apt-get -y install openssh-client curl screen apt-utils libfreetype6 fontconfig fonts-dejavu
apt -y update && \
apt -y install openssh-client curl screen apt-utils libfreetype6 fontconfig fonts-dejavu

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
8 changes: 4 additions & 4 deletions docker/build/Dockerfile-submit-dev
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ RUN $JAVA_HOME/bin/jlink \
--output /javaruntime

# Define base image and copy in jlink created minimal Java 17 environment
FROM debian:buster-slim
FROM debian:bullseye-slim
ENV JAVA_HOME=/opt/java/openjdk
ENV PATH "${JAVA_HOME}/bin:${PATH}"
COPY --from=jre-build /javaruntime $JAVA_HOME

RUN mkdir -p /usr/local/app && \
apt-get -y update && \
apt-get -y install openssh-client screen apt-utils libfreetype6 fontconfig fonts-dejavu
apt -y update && \
apt -y install openssh-client screen apt-utils libfreetype6 fontconfig fonts-dejavu

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata
RUN unlink /etc/localtime || true
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Expand Down
4 changes: 2 additions & 2 deletions docker/swarm/README_DockerSwarmConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ install jq (utility for json processing)
install poetry (for building/installing vcell-admin)

```bash
sudo apt-get install -y jq
sudo apt-get install -y python3-poetry
sudo apt install -y jq
sudo apt install -y python3-poetry
```

## Install singularity [more info linux](https://singularity.lbl.gov/install-linux)
Expand Down
4 changes: 2 additions & 2 deletions pythonCopasiOpt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.10-slim-buster
FROM python:3.10-slim-bullseye

RUN apt -y update && apt -y upgrade && \
apt-get install -y curl
apt install -y curl

RUN mkdir -p /usr/local/app/vcell/installDir && \
mkdir -p /usr/local/app/vcell/installDir/python/vcell_opt
Expand Down
57 changes: 24 additions & 33 deletions vcell-cli-utils/vcell_cli_utils/cli.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import glob
import json
import os
import shutil
import stat
import sys
import tempfile
from dataclasses import dataclass
from typing import List

import biosimulators_utils.sedml.utils
import fire
import libsedml as lsed
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
Expand All @@ -23,12 +19,9 @@
from biosimulators_utils.combine.validation import validate
from biosimulators_utils.combine.data_model import CombineArchiveContentFormat

# from biosimulators_utils.plot.data_model import PlotFormat # noqa: F401
from biosimulators_utils.report.data_model import DataSetResults, ReportResults, ReportFormat # noqa: F401
from biosimulators_utils.report.io import ReportWriter
from biosimulators_utils.sedml.data_model import Report, Plot2D, Plot3D, DataSet
from biosimulators_utils.sedml.data_model import Report, Plot2D, Plot3D, DataSet, SedDocument
from biosimulators_utils.sedml.io import SedmlSimulationReader, SedmlSimulationWriter
from libsedml import SedReport, SedPlot2D, SedDocument

# Move status PY code here
# Create temp directory
Expand Down Expand Up @@ -150,30 +143,29 @@ def get_all_dataref_and_curves(sedml_path):
all_plot_curves = {}
all_report_dataref = {}

sedml = lsed.readSedML(sedml_path)
sedml: SedDocument = SedmlSimulationReader().run(sedml_path)

for output in sedml.getListOfOutputs():
if type(output) == SedPlot2D:
for output in sedml.outputs:
if isinstance(output, Plot2D):
all_curves = {}
for curve in output.getListOfCurves():
for curve in output.curves:
all_curves[curve.getId()] = {
'x': curve.getXDataReference(),
'y': curve.getYDataReference()
}
all_plot_curves[output.getId()] = all_curves
if type(output) == SedReport:
for dataset in output.getListOfDataSets():
all_plot_curves[output.id] = all_curves
if isinstance(output, Report):
for dataset in output.data_sets():

######
if output.getId() in all_report_dataref:

all_report_dataref[output.getId()].append({
if output.id in all_report_dataref:
all_report_dataref[output.id].append({
'data_reference': dataset.getDataReference(),
'data_label': dataset.getLabel()
})
else:
all_report_dataref[output.getId()] = []
all_report_dataref[output.getId()].append({
all_report_dataref[output.id] = []
all_report_dataref[output.id].append({
'data_reference': dataset.getDataReference(),
'data_label': dataset.getLabel()
})
Expand Down Expand Up @@ -297,23 +289,22 @@ def gen_plots_for_sed2d_only_2(sedml_path, result_out_dir):
def gen_plots_for_sed2d_only(sedml_path, result_out_dir):
all_plot_curves = {}

sedml: SedDocument = lsed.readSedML(sedml_path)
sedml: SedDocument = SedmlSimulationReader().run(sedml_path)

# Generate all_plot_curves
for output in sedml.getListOfOutputs():
if not isinstance(output, SedPlot2D):
all_plot_curves = {}
for output in sedml.outputs:
if not isinstance(output, Plot2D):
continue
sed_plot_2d: SedPlot2D = output
sed_plot_2d: Plot2D = output
all_curves = {}
all_plot_curves = {}


for curve in sed_plot_2d.getListOfCurves():
all_curves[curve.getId()] = {
'x': curve.getXDataReference(),
'y': curve.getYDataReference()
for curve in sed_plot_2d.curves:
all_curves[curve.id] = {
'x': curve.x_data_generator,
'y': curve.y_data_generator
}
all_plot_curves[sed_plot_2d.getId()] = all_curves
all_plot_curves[sed_plot_2d.id] = all_curves


all_plots = dict(all_plot_curves)
Expand Down Expand Up @@ -348,8 +339,8 @@ def gen_plots_for_sed2d_only(sedml_path, result_out_dir):

for curve_id, data in curve_dat_dict.items(): # data <--> (dict)all_curves.values()
shouldLabel = True
for series_name in labelMap[data['y']]:
sns.lineplot(data=df, x=data['x'], y=series_name, ax=ax, label=(curve_id if shouldLabel else None))
for series_name in labelMap[data['y'].id]:
sns.lineplot(data=df, x=data['x'].id, y=series_name, ax=ax, label=(curve_id if shouldLabel else None))
ax.set_ylabel('')
shouldLabel = False
plt.savefig(os.path.join(result_out_dir, plot_id + '.pdf'), dpi=300)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public String callPython(String functionName, String... arguments) throws Python
* @throws InterruptedException if the python process was interrupted
* @throws IOException if there was a system IO failure
*/

@Deprecated
public static void callNonSharedPython(String cliCommand, String sedmlPath, String resultOutDir)
throws InterruptedException, IOException, PythonStreamException {
if (lg.isWarnEnabled()) lg.warn("Using old style python invocation!");
Expand Down
7 changes: 4 additions & 3 deletions vcell-cli/src/main/java/org/vcell/cli/run/OmexHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ public OmexHandler(String omexPath, String outDir) throws IOException {
int indexOfLastSlash = omexPath.lastIndexOf("/");
this.omexName = omexPath.substring(indexOfLastSlash + 1);
this.tempPath = RunUtils.getTempDir();
Path archiveTempDirPath = Files.copy(Paths.get(omexPath), Paths.get(RunUtils.getTempDir(), "archive_to_execute.omex"));
try {
replaceMetadataRdfFiles(Paths.get(omexPath));
this.archive = new CombineArchive(new File(omexPath));
replaceMetadataRdfFiles(archiveTempDirPath);
this.archive = new CombineArchive(archiveTempDirPath.toFile());
if (this.archive.hasErrors()){
String message = "Unable to initialise OMEX archive "+this.omexName+": "+this.archive.getErrors();
logger.error(message);
throw new IOException(message);
}
}catch (CombineArchiveException | JDOMException | ParseException e) {
String message = String.format("Unable to initialise OMEX archive \"%s\", archive maybe corrupted", this.omexName);
logger.error(message+": "+e.getMessage(), e);
logger.error("{}: {}", message, e.getMessage());
throw new IOException(e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion vcell-cli/src/main/java/org/vcell/cli/run/RunUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public static void zipResFiles(File dirPath) throws IOException {

public static String getTempDir() throws IOException {
String tempPath = String.valueOf(java.nio.file.Files.createTempDirectory(
RunUtils.VCELL_TEMP_DIR_PREFIX + UUID.randomUUID().toString()).toAbsolutePath());
RunUtils.VCELL_TEMP_DIR_PREFIX + UUID.randomUUID()).toAbsolutePath());
logger.info("TempPath Created: " + tempPath);
return tempPath;
}
Expand Down
Loading

0 comments on commit f35690b

Please sign in to comment.