Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 automatically generate benchmark l ps #34

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv/
website/
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
python -m venv /tmp/venv
pip install --upgrade pip pre-commit
pre-commit install
pre-commit run --all-files
pre-commit run --all-files
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use a lightweight base image with micromamba support
FROM mambaorg/micromamba

# Set environment variables for micromamba
ENV MAMBA_DOCKERFILE_ACTIVATE=1
ENV CONDA_ENV_NAME=pypsa-eur

# Set working directory to /app
WORKDIR /app

# Install git for cloning repositories
RUN micromamba install -n base -c conda-forge git -y

# Copy the current directory (your local files) into /app
COPY . /app

# Clone the PyPSA-Eur repository into /app/pypsa-eur
RUN git clone https://github.com/PyPSA/pypsa-eur.git /app/pypsa-eur

# Check the current commit and checkout the specified commit
# RUN cd /app/pypsa-eur
# git checkout b328169
RUN micromamba env create -f pypsa-eur/envs/environment.yaml --yes

# Run boot.sh when the container starts
ENTRYPOINT [ "/app/boot.sh" ]
24 changes: 24 additions & 0 deletions boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash


micromamba install -n pypsa-eur -c conda-forge pip -y

micromamba install -n pypsa-eur -c conda-forge git -y

micromamba install -n pypsa-eur -c conda-forge time -y


micromamba run -n pypsa-eur pip install git+https://github.com/open-energy-transition/linopy.git@only-generate-problem-files --no-deps


# Get the config files for the sample problems from ... and put them in /pypsa-eur/config
cp -r benchmarks/pypsa/* pypsa-eur/config
# Get the solver_benchmark_pypsa_eur.py and place it in the /pypsa-eur folder
mv pypsa-eur/config/solver_benchmark_pypsa_eur.py pypsa-eur/

sed -i '/cf_solving = solving\["options"\]/a\ kwargs["keep_files"] = cf_solving.get("keep_files", True)' pypsa-eur/scripts/solve_network.py

cd /app/pypsa-eur
micromamba run -n pypsa-eur python solver_benchmark_pypsa_eur.py --configfile config/pypsa-eur-elec-10-lvopt-3h.yaml

exec /bin/bash
Loading