Skip to content

Commit

Permalink
Run xxx-taskrunner develop containerrs with hotswapping (#3845)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
kbirk and github-actions[bot] authored Jun 13, 2024
1 parent 4da6b17 commit 597d9d7
Show file tree
Hide file tree
Showing 13 changed files with 363 additions and 137 deletions.
127 changes: 81 additions & 46 deletions containers/scripts/docker-compose-taskrunner.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,85 @@
---
services:
gollm-taskrunner:
container_name: gollm-taskrunner
image: ghcr.io/darpa-askem/gollm-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ-ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ-PASSWORD: "terarium123"
TERARIUM_MQ-USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST-TYPE: "gollm"
OPENAI_API_KEY: "${secret_gollm_openai_key}"
depends_on:
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
taskrunner-dev-builder:
build:
dockerfile: ../../packages/taskrunner/Dockerfile
target: taskrunner_dev_builder
container_name: taskrunner-dev-builder
volumes:
- ../../packages/taskrunner:/taskrunner

mira-taskrunner:
container_name: mira-taskrunner
image: ghcr.io/darpa-askem/mira-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ-ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ-PASSWORD: "terarium123"
TERARIUM_MQ-USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST-TYPE: "mira"
depends_on:
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
gollm-taskrunner:
build:
dockerfile: ./packages/gollm/Dockerfile
target: gollm_taskrunner_builder
container_name: gollm-taskrunner
image: ghcr.io/darpa-askem/gollm-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ_ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ_PASSWORD: "terarium123"
TERARIUM_MQ_USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST_TYPE: "gollm"
OPENAI_API_KEY: "${secret_gollm_openai_key}"
depends_on:
taskrunner-dev-builder:
condition: service_started
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
volumes:
- ../../packages/gollm:/gollm_task
- ../../packages/taskrunner:/taskrunner
command: /gollm_task/dev.sh

funman-taskrunner:
container_name: funman-taskrunner
image: ghcr.io/darpa-askem/funman-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ-ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ-PASSWORD: "terarium123"
TERARIUM_MQ-USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST-TYPE: "funman"
depends_on:
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
mira-taskrunner:
build:
dockerfile: ../../packages/mira/Dockerfile
target: mira_taskrunner_builder
container_name: mira-taskrunner
image: ghcr.io/darpa-askem/mira-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ_ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ_PASSWORD: "terarium123"
TERARIUM_MQ_USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST_TYPE: "mira"
depends_on:
taskrunner-dev-builder:
condition: service_started
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
volumes:
- ../../packages/mira:/mira_task
- ../../packages/taskrunner:/taskrunner
command: /mira_task/dev.sh

funman-taskrunner:
build:
dockerfile: ../../packages/funman/Dockerfile
target: funman_taskrunner_builder
container_name: funman-taskrunner
image: ghcr.io/darpa-askem/funman-taskrunner:latest
networks:
- terarium
environment:
TERARIUM_MQ_ADDRESSES: "amqp://rabbitmq:5672"
TERARIUM_MQ_PASSWORD: "terarium123"
TERARIUM_MQ_USERNAME: "terarium"
TERARIUM_TASKRUNNER_REQUEST_TYPE: "funman"
depends_on:
taskrunner-dev-builder:
condition: service_started
rabbitmq:
condition: service_healthy
extra_hosts:
- "${local_host_name}:host-gateway"
volumes:
- ../../packages/funman:/funman_task
- ../../packages/taskrunner:/taskrunner
command: /funman_task/dev.sh
40 changes: 40 additions & 0 deletions packages/funman/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
funman_task.egg-info

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
mira.egg-info
__pycache__
61 changes: 41 additions & 20 deletions packages/funman/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Build the Spring Boot application
FROM eclipse-temurin:17.0.11_9-jdk-focal AS taskrunner_builder
FROM eclipse-temurin:17.0.11_9-jdk-focal AS funman_taskrunner_builder

###### DEV ONLY ######
#VVVVVVVVVVVVVVVVVVVVV

# These deps are installed only for use during local development

# Install Python
RUN apt-get update && apt-get install -y --no-install-recommends \

Check failure on line 10 in packages/funman/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y --no-install-recommends \

Check failure on line 13 in packages/funman/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
python3.10 \
wget \
git \
python3-pip && \
rm -rf /var/lib/apt/lists/*

# Install funman-api
COPY ./packages/funman/funman-version.txt /funmanVersion.txt
RUN COMMIT_SHA="$(cat /funmanVersion.txt)" && \
echo "Using FUNMAN commit $COMMIT_SHA" && \
wget --progress=dot:giga -O funman.tar.gz "https://github.com/DARPA-ASKEM/funman-api/archive/${COMMIT_SHA}.tar.gz" && \
tar -zxvf funman.tar.gz && \
rm funman.tar.gz && \
mv -v funman-* funman-api
WORKDIR /funman-api
RUN pip install --no-cache-dir . && \
pip install --no-cache-dir auxiliary_packages/funman_dreal && \
pip install --no-cache-dir auxiliary_packages/funman_demo

#^^^^^^^^^^^^^^^^^^^^
######################

WORKDIR /taskrunner

Expand All @@ -14,37 +46,26 @@ FROM ghcr.io/darpa-askem/funman-base:latest

WORKDIR /

# Install OpenJDK JRE and git
# Install OpenJDK JRE and wget
RUN apt-get update && \

Check failure on line 50 in packages/funman/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
apt-get install -y --no-install-recommends openjdk-17-jre-headless && \
apt-get install -y --no-install-recommends git && \
apt-get install -y --no-install-recommends \
openjdk-17-jre-headless && \
rm -rf /var/lib/apt/lists/*

# Copy the Spring Boot fat JAR from the builder image
COPY --from=taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Copy the echo script for testing
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py
COPY --from=funman_taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Install funman-api
RUN echo "Cache bust so we can always pull latest Funman" $(date -u)
COPY ./packages/funman/funman-version.txt /funmanVersion.txt

RUN git clone https://github.com/DARPA-ASKEM/funman-api.git

COPY --from=funman_taskrunner_builder /funman-api /funman-api
WORKDIR /funman-api
RUN COMMIT_SHA=$(cat /funmanVersion.txt) && \
echo "Using FUNMAN commit $COMMIT_SHA" && \
git reset --hard $COMMIT_SHA
RUN pip install --no-cache-dir . && \
pip install --no-cache-dir auxiliary_packages/funman_dreal && \
pip install --no-cache-dir auxiliary_packages/funman_demo
pip install --no-cache-dir auxiliary_packages/funman_dreal && \
pip install --no-cache-dir auxiliary_packages/funman_demo

# Install taskrunner
WORKDIR /
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py
COPY ./packages/taskrunner/setup.py /taskrunner/setup.py
COPY ./packages/taskrunner/taskrunner.py /taskrunner/taskrunner.py

WORKDIR /taskrunner
RUN pip install --no-cache-dir -e .

Expand Down
11 changes: 11 additions & 0 deletions packages/funman/dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# ensure the volume mounted python code is using editable mode
echo "Installing python tasks"
cd /funman_task
pip install -e .

# run it
echo "Running taskrunner"
cd /taskrunner
./gradlew --project-cache-dir /tmp/.gradle/$$ bootRun
40 changes: 40 additions & 0 deletions packages/gollm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
gollm_task.egg-info

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
mira.egg-info
__pycache__
60 changes: 39 additions & 21 deletions packages/gollm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
# Build the Spring Boot application
FROM eclipse-temurin:17.0.11_9-jdk-focal AS taskrunner_builder
FROM eclipse-temurin:17.0.11_9-jdk-focal AS gollm_taskrunner_builder

###### DEV ONLY ######
#VVVVVVVVVVVVVVVVVVVVV

# These deps are installed only for use during local development

# Install Python
RUN apt-get update && apt-get install -y --no-install-recommends \

Check failure on line 10 in packages/gollm/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y --no-install-recommends \

Check failure on line 13 in packages/gollm/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
python3.10 \
wget \
python3-pip && \
rm -rf /var/lib/apt/lists/*

# Install gollm
COPY ./packages/gollm/gollm-version.txt /gollmVersion.txt
RUN COMMIT_SHA="$(cat /gollmVersion.txt)" && \
echo "Using GoLLM commit $COMMIT_SHA" && \
wget --progress=dot:giga -O gollm.tar.gz "https://github.com/DARPA-ASKEM/GoLLM/archive/${COMMIT_SHA}.tar.gz" && \
tar -zxvf gollm.tar.gz && \
rm gollm.tar.gz && \
mv GoLLM-* GoLLM
WORKDIR /GoLLM
RUN pip install --no-cache-dir .

#^^^^^^^^^^^^^^^^^^^^
######################

WORKDIR /taskrunner

COPY ./packages/taskrunner .

RUN ./gradlew bootJar

WORKDIR /

# ------------------------------------------------------------------------------

# Set up the Python image with JRE
Expand All @@ -16,35 +47,22 @@ WORKDIR /

# Install OpenJDK JRE and wget
RUN apt-get update && \

Check failure on line 49 in packages/gollm/Dockerfile

View workflow job for this annotation

GitHub Actions / Lint Docker Files / Lint Docker Files

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
apt-get install -y --no-install-recommends openjdk-17-jre-headless && \
apt-get install -y --no-install-recommends wget && \
rm -rf /var/lib/apt/lists/*
apt-get install -y --no-install-recommends \
openjdk-17-jre-headless && \
rm -rf /var/lib/apt/lists/*

# Copy the Spring Boot fat JAR from the builder image
COPY --from=taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Copy the echo script for testing
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py
COPY --from=gollm_taskrunner_builder /taskrunner/build/libs/*.jar /taskrunner.jar

# Install GoLLM
RUN echo "Cache bust so we can always pull latest GoLLM" $(date -u)
COPY ./packages/gollm/gollm-version.txt /gollmVersion.txt
RUN COMMIT_SHA=$(cat /gollmVersion.txt) && \
echo "Using GoLLM commit $COMMIT_SHA" && \
wget -O gollm.tar.gz https://github.com/DARPA-ASKEM/GoLLM/archive/${COMMIT_SHA}.tar.gz

RUN tar -zxvf gollm.tar.gz && \
rm gollm.tar.gz
RUN mv GoLLM-* GoLLM

COPY --from=gollm_taskrunner_builder /GoLLM /GoLLM
WORKDIR /GoLLM
RUN pip install --no-cache-dir -e .
RUN pip install --no-cache-dir .

# Install taskrunner
WORKDIR /
COPY ./packages/taskrunner/src/test/resources/echo.py /echo.py
COPY ./packages/taskrunner/setup.py /taskrunner/setup.py
COPY ./packages/taskrunner/taskrunner.py /taskrunner/taskrunner.py

WORKDIR /taskrunner
RUN pip install --no-cache-dir -e .

Expand Down
Loading

0 comments on commit 597d9d7

Please sign in to comment.