Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,67 @@ jobs:
export _GRID2OP_FORCE_TEST=1
python -m unittest grid2op/tests/fromChronix2grid.py

test_powermodels:
executor: python312
resource_class: medium+ # install_julia step killed w/"small"
steps:
- checkout
- run:
command: |
sudo apt-get update
sudo apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
name: Install Python dependencies
command: |
source venv_test/bin/activate
python -m pip install -U pip setuptools wheel pytest
- run:
name: Install Grid2op
command: |
source venv_test/bin/activate
# below (1 line) is fine when released pandamodelsbackend works w/grid2op
# python -m pip install -e .[powermodels]
# but when need special PdMdB repo, in this case to work with grid2op 1.11dev, use below (2 lines)
python -m pip install -e .
python -m pip install 'git+https://github.com/MOSSLab-MIT/PandaModelsBackend.git@g2o_v1p11'
pip freeze
- run:
name: Install Julia and power software
command: |
source venv_test/bin/activate
./utils/install_julia.sh 1.10.4
python -m pip install julia
julia -e 'using Pkg; Pkg.add(["PandaModels", "PyCall"])'
- run:
name: Environment information
command: |
source venv_test/bin/activate
pip list
pip list | grep -e power -e grid -e panda
which python python-jl julia
python --version
python-jl --version
julia --version
julia -e 'using Pkg; Pkg.status(); Pkg.status(outdated=true)'
julia -e 'using PyCall; math = pyimport("math"); print(math.sin(math.pi/4))'
- run:
name: Test PowerModels in PandaPower
command: |
source venv_test/bin/activate
pyMm=$(python -c "import sys;print(f'{sys.version_info.major}.{sys.version_info.minor}')")
python -m pytest -v venv_test/lib/python$pyMm/site-packages/pandapower/test/opf/test_pandamodels_runpm.py
# use python-jl instead of python above if get a static libpython error
- run:
name: Test PandaModelsBackend
command: |
source venv_test/bin/activate
pyMm=$(python -c "import sys;print(f'{sys.version_info.major}.{sys.version_info.minor}')")
python venv_test/lib/python$pyMm/site-packages/pandamodelsbackend/tests/test_backend_api.py
# use python-jl instead of python above if get a static libpython error


install39:
executor: python39
resource_class: small
Expand Down Expand Up @@ -395,6 +456,7 @@ workflows:
- legacy_lightsim_old_pp
- legacy_lightsim
- test_chronix2grid
- test_powermodels

install:
jobs:
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def my_test_suite():
],
"chronix2grid": [
"ChroniX2Grid>=1.2.0.post1"
]
],
"powermodels": [
"PandaModelsBackend"
],
}
}
pkgs["extras"]["test"] += pkgs["extras"]["optional"]
Expand Down
113 changes: 113 additions & 0 deletions utils/install_julia.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#!/bin/bash
# install julia vX.Y.Z: ./install-julia.sh X.Y.Z
# install julia nightly: ./install-julia.sh nightly

# LICENSE
#
# Copyright © 2013 by Steven G. Johnson, Fernando Perez, Jeff
# Bezanson, Stefan Karpinski, Keno Fischer, Jake Bolewski, Takafumi
# Arakaki, and other contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# stop on error
set -e
VERSION="$1"

case "$VERSION" in
nightly)
BASEURL="https://julialangnightlies-s3.julialang.org/bin"
JULIANAME="julia-latest"
;;
[0-9]*.[0-9]*.[0-9]*)
BASEURL="https://julialang-s3.julialang.org/bin"
SHORTVERSION="$(echo "$VERSION" | grep -Eo '^[0-9]+\.[0-9]+')"
JULIANAME="$SHORTVERSION/julia-$VERSION"
;;
[0-9]*.[0-9])
BASEURL="https://julialang-s3.julialang.org/bin"
SHORTVERSION="$(echo "$VERSION" | grep -Eo '^[0-9]+\.[0-9]+')"
JULIANAME="$SHORTVERSION/julia-$VERSION-latest"
;;
*)
echo "Unrecognized VERSION=$VERSION, exiting"
exit 1
;;
esac

case $(uname) in
Linux)
case $(uname -m) in
x86_64)
ARCH="x64"
case "$JULIANAME" in
julia-latest)
SUFFIX="linux64"
;;
*)
SUFFIX="linux-x86_64"
;;
esac
;;
i386 | i486 | i586 | i686)
ARCH="x86"
case "$JULIANAME" in
julia-latest)
SUFFIX="linux32"
;;
*)
SUFFIX="linux-i686"
;;
esac
;;
*)
echo "Do not have Julia binaries for this architecture, exiting"
exit 1
;;
esac
echo "$BASEURL/linux/$ARCH/$JULIANAME-$SUFFIX.tar.gz"
curl -L "$BASEURL/linux/$ARCH/$JULIANAME-$SUFFIX.tar.gz" | tar -xz
sudo ln -s $PWD/julia-*/bin/julia /usr/local/bin/julia
julia -e 'import Pkg; Pkg.add("PyCall");'
julia -e 'import Pkg; Pkg.Registry.update(); Pkg.add("PandaModels"); Pkg.build(); Pkg.resolve();'
;;
Darwin)
if [ -e /usr/local/bin/julia ]; then
echo "/usr/local/bin/julia already exists, exiting"
exit 1
elif [ -e julia.dmg ]; then
echo "julia.dmg already exists, exiting"
exit 1
elif [ -e ~/julia ]; then
echo "~/julia already exists, exiting"
exit 1
fi
curl -Lo julia.dmg "$BASEURL/mac/x64/$JULIANAME-mac64.dmg"
hdiutil mount -mountpoint /Volumes/Julia julia.dmg
cp -Ra /Volumes/Julia/*.app/Contents/Resources/julia ~
ln -s ~/julia/bin/julia /usr/local/bin/julia
# TODO: clean up after self?
;;
*)
echo "Do not have Julia binaries for this platform, exiting"
exit 1
;;
esac