Skip to content

Commit

Permalink
feat: add snakemake container to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-oet committed Sep 23, 2024
1 parent 48ce8f2 commit 7c0dc2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 62 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/ci.yaml

This file was deleted.

45 changes: 11 additions & 34 deletions .github/workflows/generate_nc_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,25 @@ on:
jobs:
generate_nc_files:
runs-on: ubuntu-latest
container:
image: mambaorg/micromamba:latest # Use a Docker image with micromamba
container: snakemake/snakemake:v8.20.4 # Use the Docker container for the entire job

steps:
- name: Checkout Repositories
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for versioning

- name: Install Git
run: |
apt-get update && apt-get install -y git
- name: Clone PyPSA-Eur
- name: Clone PyPSA-eur Repository
run: |
git clone --branch master https://github.com/PyPSA/pypsa-eur.git
cd pypsa-eur
git checkout a69373b9
git clone --branch master https://github.com/PyPSA/pypsa-eur.git
cd pypsa-eur
git checkout a69373b9
- name: Set Up Conda Environment
- name: Set Up Environment
run: |
micromamba create -f envs/environment.yaml -n pypsa-eur
micromamba activate pypsa-eur
micromamba install -y -n pypsa-eur python=3.8 # Ensure python version
micromamba run -n pypsa-eur pip install git+https://github.com/open-energy-transition/linopy.git@only-generate-problem-files --no-deps
cd pypsa-eur
- name: Run Snakemake Commands
run: |
cd pypsa-eur
micromamba run -n pypsa-eur time snakemake -call all --cores all --printshellcmds --configfile ~/code/solver-benchmark/benchmarks/pypsa/pypsa-eur-sec-2-lv1-3h.yaml
micromamba run -n pypsa-eur time snakemake -call solve_elec_networks --cores all --printshellcmds --configfile ~/code/solver-benchmark/benchmarks/pypsa/pypsa-eur-elec-10-lvopt-3h.yaml
micromamba run -n pypsa-eur time snakemake -call results/networks/elec_s_20_ec_lv1_24h_op.nc --cores all --printshellcmds --configfile ~/code/solver-benchmark/benchmarks/pypsa/pypsa-eur-elec-20-lv1-3h-op.yaml
micromamba run -n pypsa-eur time snakemake -call results/networks/elec_s_20_ec_lv1_24h_op.nc --cores all --printshellcmds --configfile ~/code/solver-benchmark/benchmarks/pypsa/pypsa-eur-elec-20-lv1-3h-op-ucconv.yaml
micromamba run -n pypsa-eur time python pypsa-wind+sol+ely-1h-ucwind.py
micromamba run -n pypsa-eur time python pypsa-wind+sol+ely-1h.py
micromamba env create -f envs/environment.yaml --yes
micromamba run -n pypsa-eur pip install git+https://github.com/open-energy-transition/linopy.git@only-generate-problem-files --no-deps
micromamba run -n pypsa-eur snakemake results/networks/elec_s_20_ec_lv1_3h_op.nc --cores all --printshellcmds --configfile ../benchmarks/pypsa/pypsa-eur-elec-20-lv1-3h-op.yaml ; echo -e '\a'
- name: Copy NC Files
run: |
# Replace this with the actual path to your NC file
cp /tmp/linopy-problem-*.nc ~/code/solver-benchmarks/runner/benchmarks/
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: nc-files
path: ~/code/solver-benchmarks/runner/benchmarks/*.nc

0 comments on commit 7c0dc2e

Please sign in to comment.