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

74 embed gurobi #75

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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
24 changes: 22 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
.github/
.venv/
.vscode/
.idea/
ci/
.env
doc/
gurobi/
htmlcov/
local_test/
*.egg-info/
temp/
unit_test/
.env
.env.local
.env-template
.gitignore
.taplo.toml
CHANGELOG.md
CONTRIBUTING.md
dev.Dockerfile
docker-compose.worker-only.yml
docker-compose.yml
LICENSE
run.bat
run.sh
run_windows.sh
test-results.xml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,6 @@ test-results.xml

.env.*

temp/
temp/
gurobi/
.idea/
22 changes: 21 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
FROM python:3.8-slim-buster
FROM python:3.8-slim-bookworm

WORKDIR /app
RUN apt update && \
apt install -y wget && \
apt-get clean

ENV GUROBI_HOME=/app/gurobi/
ENV PATH="/app/gurobi/bin:$PATH"
ENV LD_LIBRARY_PATH="/app/gurobi/lib"
ENV CASADI_GUROBI_VERSION="110"
ENV GUROBI_VERSION_URL="11.0.3"
ENV GUROBI_VERSION_URL_MAJOR="11.0"

# This env var is for casadi.
ENV GUROBI_VERSION="$CASADI_GUROBI_VERSION"

# This env var is for gurobi
ENV GRB_LICENSE_FILE="/app/gurobi/gurobi.lic"


RUN mkdir -p /app/gurobi && \
wget -qO- https://packages.gurobi.com/${GUROBI_VERSION_URL_MAJOR}/gurobi${GUROBI_VERSION_URL}_linux64.tar.gz | tar xvz --strip-components=2 -C /app/gurobi

COPY requirements.txt /app/grow_worker/requirements.txt
RUN pip install -r /app/grow_worker/requirements.txt --no-cache-dir
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.worker-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
networks:
omotes:
external: true

services:
grow_worker:
build:
context: .
environment:
INFLUXDB_HOSTNAME: omotes_influxdb
INFLUXDB_PORT: 8096
INFLUXDB_USERNAME: root
INFLUXDB_PASSWORD: 9012

RABBITMQ_HOSTNAME: rabbitmq-nwn
RABBITMQ_PORT: 5672
RABBITMQ_USERNAME: root
RABBITMQ_PASSWORD: 5678
RABBITMQ_VIRTUALHOST: omotes_celery

GROW_TASK_TYPE: grow_optimizer_default
LOG_LEVEL: DEBUG
volumes:
- "./gurobi.lic:/app/gurobi/gurobi.lic"
networks:
- omotes
deploy:
replicas: 3
resources:
limits:
cpus: '4'
memory: 4gb
memswap_limit: 4gb
12 changes: 12 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@
. .venv/bin/activate
. ci/linux/_load_dot_env.sh .env.local

export DIR_TO_ROOT="$PWD"

export GUROBI_HOME="${DIR_TO_ROOT}/gurobi"
export PATH="${GUROBI_HOME}/bin:$PATH"
export LD_LIBRARY_PATH="${GUROBI_HOME}/lib"
export CASADI_GUROBI_VERSION="110"
export GUROBI_VERSION_URL="11.0.3"
export GUROBI_VERSION_URL_MAJOR="11.0"

export GUROBI_VERSION="$CASADI_GUROBI_VERSION"
export GRB_LICENSE_FILE="${DIR_TO_ROOT}/gurobi.lic"

PYTHONPATH="src/" python3 -m grow_worker.worker
Loading