Skip to content

Commit 7a9682c

Browse files
committed
Merge branch 'develop' into proforma
2 parents f938582 + bb0716b commit 7a9682c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1893
-222
lines changed

.bash_profile

-19
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,6 @@ export DYLD_LIBRARY_PATH # for Mac
2929
#==============================================================================
3030

3131

32-
#------------------------------------------------------------------------------
33-
34-
# Uncomment the following if you are using the Xpress solver
35-
#------------------------------------------------------------------------------
36-
#XPRESSDIR="/usr/local/opt/xpress"
37-
#DYLD_LIBRARY_PATH="${XPRESSDIR}/lib:${SRC_DIR}:${DYLD_LIBRARY_PATH}" # for Mac
38-
#LD_LIBRARY_PATH="${XPRESSDIR}/lib:${SRC_DIR}:${LD_LIBRARY_PATH}" # for Linux
39-
#CLASSPATH="${XPRESSDIR}/lib/xprs.jar:${XPRESSDIR}/lib/xprb.jar:${XPRESSDIR}/lib/xprm.jar:${CLASSPATH}"
40-
#PATH="${XPRESSDIR}/bin:${PATH}"
41-
#
42-
#export PATH
43-
#export XPRESS="$XPRESSDIR/bin"
44-
#export DYLD_LIBRARY_PATH
45-
#export LD_LIBRARY_PATH
46-
#export CLASSPATH
47-
#source /opt/xpressmp/bin/xpvars.sh
48-
#==============================================================================
49-
50-
5132
#------------------------------------------------------------------------------
5233
# You can change the following to add Julia to your system Path
5334
#------------------------------------------------------------------------------

.github/disabled_cbc_workflows/push_test_cbc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
- name: Check django logs
2727
run: docker logs django
2828
- name: test
29-
run: docker-compose exec -T celery python manage.py test reo.tests.test_custom_rates reo.tests.test_demand_ratchet -v 2 --failfast --no-input
29+
run: docker-compose exec -T celery python manage.py test reoptjl.test.test_job_endpoint -v 2 --failfast --no-input

.github/scripts/decrypt.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22

3-
transcrypt/transcrypt --flush-credentials -y || true
4-
transcrypt/transcrypt -c aes-256-cbc -p "$TRANSCRYPT_PASSWORD" -y
3+
# transcrypt/transcrypt --flush-credentials -y || true
4+
# transcrypt/transcrypt -c aes-256-cbc -p "$TRANSCRYPT_PASSWORD" -y
55

66

.github/workflows/pull_request_tests.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v2
21-
- name: Decrypt
22-
env:
23-
TRANSCRYPT_PASSWORD: ${{ secrets.TRANSCRYPT_PASSWORD }}
24-
run: ./.github/scripts/decrypt.sh
21+
# - name: Decrypt
22+
# env:
23+
# TRANSCRYPT_PASSWORD: ${{ secrets.TRANSCRYPT_PASSWORD }}
24+
# run: ./.github/scripts/decrypt.sh
2525
- name: Make keys.py
2626
env:
2727
NREL_DEV_API_KEY: ${{ secrets.NREL_DEV_API_KEY }}
2828
run: ./.github/scripts/make_keys.py.sh
2929
- name: Build containers
30-
run: docker-compose up -d
30+
run: docker-compose -f docker-compose.highs.yml up -d
3131
- name: Check running containers
3232
run: docker ps -a
3333
- name: Wait for julia_api
3434
uses: jakejarvis/wait-action@master
3535
with:
3636
time: '150s'
37-
- name: test
38-
run: docker exec reopt_api_celery_1 python manage.py test -v 2 --failfast --no-input
37+
- name: test v3 validator
38+
run: docker exec reopt_api_celery_1 python manage.py test reoptjl.test.test_validator -v 2 --failfast --no-input
39+
- name: test v3 http.jl endpoints
40+
run: docker exec reopt_api_celery_1 python manage.py test reoptjl.test.test_http_endpoints -v 2 --failfast --no-input

.github/workflows/push_tests.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
- name: Decrypt
18-
env:
19-
TRANSCRYPT_PASSWORD: ${{ secrets.TRANSCRYPT_PASSWORD }}
20-
run: ./.github/scripts/decrypt.sh
17+
# - name: Decrypt
18+
# env:
19+
# TRANSCRYPT_PASSWORD: ${{ secrets.TRANSCRYPT_PASSWORD }}
20+
# run: ./.github/scripts/decrypt.sh
2121
- name: Make keys.py
2222
env:
2323
NREL_DEV_API_KEY: ${{ secrets.NREL_DEV_API_KEY }}
2424
run: ./.github/scripts/make_keys.py.sh
2525
- name: Build containers
26-
run: docker-compose up -d
26+
run: docker-compose -f docker-compose.highs.yml up -d
2727
- name: Check running containers
2828
run: docker ps -a
2929
- name: Wait for julia_api
3030
uses: jakejarvis/wait-action@master
3131
with:
3232
time: '150s'
33-
- name: test
34-
run: docker exec reopt_api_celery_1 python manage.py test -v 2 --failfast --no-input
33+
- name: test v3 validator
34+
run: docker exec reopt_api_celery_1 python manage.py test reoptjl.test.test_validator -v 2 --failfast --no-input
35+
- name: test v3 http.jl endpoints
36+
run: docker exec reopt_api_celery_1 python manage.py test reoptjl.test.test_http_endpoints -v 2 --failfast --no-input

.gitignore

+6-4
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ all_data*
114114
docs/formulation/*aux
115115
docs/formulation/*log
116116

117-
# Customized docker files
118-
docker-compose.xpressOS.yml
119-
Dockerfile.xpressOS.pyjul
120-
121117
/.werf_secret_key
118+
119+
# Customized solver setup and docker files
120+
julia_src/xpress/licenseserver
121+
julia_src/Dockerfile.xpress
122+
docker-compose.xpress.yml
123+
julia_src/xpress/solver_setup.sh

.helm/templates/julia-deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
containers:
3535
- name: {{ .Chart.Name }}-julia
3636
image: {{ index .Values.werf.image "julia-api" }}
37-
args: ["julia", "--project=/opt/julia_src", "http.jl"]
37+
args: ["julia", "--project=/opt/julia_src/xpress", "xpress/http.jl"]
3838
ports:
3939
- containerPort: 8081
4040
envFrom:

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ Classify the change according to the following categories:
2727
### Patches
2828

2929

30+
## v3.4.0
31+
### Minor Updates
32+
#### Added
33+
- Added the following BAU outputs: lifecycle_chp_standby_cost_after_tax, lifecycle_elecbill_after_tax, lifecycle_production_incentive_after_tax, lifecycle_outage_cost, lifecycle_MG_upgrade_and_fuel_cost
34+
### Changed
35+
- Updated REopt.jl version to 0.39.1 along with updates to other dependencies
36+
#### Fixed
37+
- Fixed setting of default Generator `installed_cost_per_kw` so that user inputs are not overridden
38+
- Avoid /summary endpoint error with off-grid runs where there is no ElectricTariff
39+
40+
## v3.3.0
41+
### Changed
42+
- Updates to REopt.jl for passing API key
43+
3044
## v3.2.3
3145
### Minor Updates
3246
##### Changed

Jenkinsfile

+10
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,22 @@ pipeline {
6565
WERF_LOG_VERBOSE = "true"
6666
WERF_SYNCHRONIZATION = ":local"
6767
XPRESS_LICENSE_HOST = credentials("reopt-api-xpress-license-host")
68+
LICENSESERVER_URL = credentials("reopt-api-xpress-licenseserver-url")
6869
NREL_ROOT_CERT_URL_ROOT = credentials("reopt-api-nrel-root-cert-url-root")
6970
}
7071

7172
stages {
7273
stage("deploy") {
7374
stages {
75+
stage("solver setup") {
76+
steps {
77+
dir("julia_src/xpress/licenseserver") {
78+
git url: env.LICENSESERVER_URL
79+
}
80+
sh "cp julia_src/xpress/licenseserver/Dockerfile.xpress julia_src/"
81+
}
82+
}
83+
7484
stage("lint") {
7585
steps {
7686
withCredentials([string(credentialsId: "reopt-api-werf-secret-key", variable: "WERF_SECRET_KEY")]) {

docker-compose.highs.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
version: "2.1"
2+
3+
services:
4+
5+
redis:
6+
image: redis
7+
command: redis-server
8+
expose:
9+
- 6379
10+
11+
db:
12+
image: postgres
13+
restart: always
14+
environment:
15+
- POSTGRES_USER=reopt
16+
- POSTGRES_PASSWORD=reopt
17+
- POSTGRES_DB=reopt
18+
expose:
19+
- 5432
20+
21+
celery:
22+
build:
23+
context: .
24+
dockerfile: Dockerfile
25+
image: base-api-image
26+
command: >
27+
"celery -A reopt_api worker -l info"
28+
environment:
29+
- APP_ENV=local
30+
- SQL_HOST=db
31+
- SQL_PORT=5432
32+
- REDIS_HOST=redis
33+
volumes:
34+
- .:/opt/reopt
35+
depends_on:
36+
- db
37+
- redis
38+
- julia
39+
40+
django:
41+
build:
42+
context: .
43+
dockerfile: Dockerfile
44+
image: base-api-image
45+
command: >
46+
"python manage.py migrate
47+
&& /opt/reopt/bin/wait-for-it.bash -t 0 julia:8081 -- python manage.py runserver 0.0.0.0:8000"
48+
environment:
49+
- APP_ENV=local
50+
- SQL_HOST=db
51+
- SQL_PORT=5432
52+
- REDIS_HOST=redis
53+
depends_on:
54+
- db
55+
- redis
56+
- julia
57+
ports:
58+
- 8000:8000
59+
volumes:
60+
- .:/opt/reopt
61+
62+
julia:
63+
container_name: julia_api
64+
build:
65+
context: julia_src/
66+
dockerfile: Dockerfile.highs
67+
environment:
68+
- SOLVER=HiGHS
69+
command: julia --project=/opt/julia_src/highs highs/http.jl
70+
ports:
71+
- "8081:8081"
72+
volumes:
73+
- ./julia_src:/opt/julia_src

docker-compose.nginx.yml

+1-10
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,16 @@ services:
7474
- django-nginx
7575
restart: "on-failure"
7676

77-
licenseserver:
78-
build:
79-
context: julia_src/xpress/licenseserver
80-
mac_address: c4:b3:01:d3:d5:eb
81-
command: xpserver
82-
expose:
83-
- 27100
84-
8577
julia-nginx:
8678
container_name: julia-nginx
8779
build:
8880
context: julia_src/
81+
dockerfile: Dockerfile.highs
8982
command: bash ./run_julia_servers.sh 8
9083
environment:
9184
- JULIA_NUM_THREADS=2
9285
expose:
9386
- 8081
94-
depends_on:
95-
- licenseserver
9687
volumes:
9788
- ./julia_src:/opt/julia_src
9889

docker-compose.nojulia.yml

-9
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,5 @@ services:
6565
volumes:
6666
- .:/opt/reopt
6767

68-
licenseserver:
69-
container_name: licenseserver-nojul
70-
build:
71-
context: julia_src/xpress/licenseserver
72-
mac_address: c4:b3:01:d3:d5:eb
73-
command: xpserver
74-
expose:
75-
- 27100
76-
7768
volumes:
7869
pgdata:

docker-compose.yml

-13
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,13 @@ services:
5858
- 8000:8000
5959
volumes:
6060
- .:/opt/reopt
61-
62-
licenseserver:
63-
container_name: xpress_license_server
64-
build:
65-
context: julia_src/xpress/licenseserver
66-
mac_address: c4:b3:01:d3:d5:eb
67-
command: xpserver
68-
expose:
69-
- 27100
7061

7162
julia:
7263
container_name: julia_api
7364
build:
7465
context: julia_src/
75-
args:
76-
- XPRESS_LICENSE_HOST=xpress_license_server
7766
command: julia --project=/opt/julia_src http.jl
7867
ports:
7968
- "8081:8081"
80-
depends_on:
81-
- licenseserver
8269
volumes:
8370
- ./julia_src:/opt/julia_src

julia_src/Dockerfile

-23
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
FROM reopt/xpressbase AS xpress
2-
31
FROM julia:1.8.5
42

53
# Install NREL root certs for machines running on NREL's network.
64
ARG NREL_ROOT_CERT_URL_ROOT=""
75
RUN set -x && if [ -n "$NREL_ROOT_CERT_URL_ROOT" ]; then curl -fsSLk -o /usr/local/share/ca-certificates/nrel_root.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_root.pem" && curl -fsSLk -o /usr/local/share/ca-certificates/nrel_xca1.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_xca1.pem" && update-ca-certificates; fi
86
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
97

10-
# Install Xpress solver for client
11-
ENV XPRESSDIR=/opt/xpressmp
12-
ENV XPRESS=/opt/xpressmp/bin
13-
ENV LD_LIBRARY_PATH=${XPRESSDIR}/lib:${LD_LIBRARY_PATH}
14-
ENV LIBPATH=${XPRESSDIR}/lib:${LIBPATH}
15-
ARG CLASSPATH=${XPRESSDIR}/lib/xprs.jar:${CLASSPATH}
16-
ARG CLASSPATH=${XPRESSDIR}/lib/xprb.jar:${CLASSPATH}
17-
ENV CLASSPATH=${XPRESSDIR}/lib/xprm.jar:${CLASSPATH}
18-
ENV PATH=${XPRESSDIR}/bin:${PATH}
19-
20-
WORKDIR /opt/reopt/solver
21-
COPY --from=xpress /opt/reopt/solver .
22-
RUN sed -i -e 's/\r$//' install.sh
23-
ARG XPRESS_LICENSE_HOST=licenseserver
24-
RUN set -x && printf "f\nc\n\nn\n\n${XPRESS_LICENSE_HOST}\ny\n" | ./install.sh >> license_info.txt;
25-
RUN rm xp8.12.3_linux_x86_64.tar.gz
26-
27-
# Install gfortran for /ghpghx
28-
RUN apt-get update && apt-get install -y \
29-
gfortran
30-
318
# Install Julia packages
329
ENV JULIA_NUM_THREADS=2
3310
WORKDIR /opt/julia_src/

julia_src/Dockerfile.highs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM julia:1.8.5
2+
3+
# Install NREL root certs for machines running on NREL's network.
4+
ARG NREL_ROOT_CERT_URL_ROOT=""
5+
RUN set -x && if [ -n "$NREL_ROOT_CERT_URL_ROOT" ]; then curl -fsSLk -o /usr/local/share/ca-certificates/nrel_root.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_root.pem" && curl -fsSLk -o /usr/local/share/ca-certificates/nrel_xca1.crt "${NREL_ROOT_CERT_URL_ROOT}/nrel_xca1.pem" && update-ca-certificates; fi
6+
ENV REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
7+
8+
# Install Julia packages
9+
ENV JULIA_NUM_THREADS=2
10+
11+
WORKDIR /opt/julia_src
12+
COPY . .
13+
RUN julia --project=/opt/julia_src/highs -e 'import Pkg; Pkg.instantiate();'
14+
RUN julia --project=/opt/julia_src/highs highs/precompile.jl
15+
EXPOSE 8081
16+
17+
CMD ["bash"]

julia_src/TODO.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Make separate functions which all/some http.jl uses for any solver
2+
Added HiGHS and Cbc to the same Julia env setup with http.jl, in julia_src/highs env
3+
Add input to Settings input for choice of solver between HiGHS and Cbc

julia_src/docker-compose.yml

-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
version: "2.1"
22

33
services:
4-
licenseserver:
5-
container_name: xpress_license_server_dev
6-
build:
7-
context: ./xpress/licenseserver
8-
mac_address: c4:b3:01:d3:d5:eb
9-
command: xpserver
10-
expose:
11-
- 27100
124

135
julia:
146
container_name: julia_api_dev
157
build:
168
context: .
17-
args:
18-
- XPRESS_LICENSE_HOST=xpress_license_server_dev
199
command: julia --project="/opt/julia_src" http.jl
2010
ports:
2111
- "8081:8081"

0 commit comments

Comments
 (0)