Skip to content

Commit

Permalink
Merge pull request #33 from elephant-track/v0.6
Browse files Browse the repository at this point in the history
ELEPHANT server v0.5.6 -> v0.6.0
  • Loading branch information
ksugar authored Nov 12, 2024
2 parents b27850d + 056f4f1 commit 7029289
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 354 deletions.
36 changes: 4 additions & 32 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
name: Test

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
Expand All @@ -10,35 +10,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
id: cache
with:
path: ~/miniconda
key: ubuntu-conda-${{ hashFiles('environment.yml') }}
- name: Install Conda
if: steps.cache.outputs.cache-hit != 'true'
- name: Test with pytest in
run: |
wget https://repo.continuum.io/miniconda/Miniconda3-py37_4.11.0-Linux-x86_64.sh
bash Miniconda3-py37_4.11.0-Linux-x86_64.sh -bfp ~/miniconda
rm Miniconda3-py37_4.11.0-Linux-x86_64.sh
source ~/miniconda/etc/profile.d/conda.sh
conda init
conda install -c conda-forge -y mamba
mamba clean -qafy
mamba env update -f environment.yml
- name: Install dependencies
run: |
~/miniconda/bin/python -m pip install --upgrade pip
~/miniconda/bin/python -m pip install flake8 pytest
- name: Install package
run: |
~/miniconda/bin/python -m pip install ./elephant-core
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
~/miniconda/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
~/miniconda/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
~/miniconda/bin/pytest
make build
make test
22 changes: 4 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04
FROM pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
# Modified from https://github.com/tiangolo/uwsgi-nginx-flask-docker (Apache license)

LABEL maintainer="Ko Sugawara <[email protected]>"
Expand All @@ -21,23 +21,6 @@ RUN set -x \
ENV PATH /opt/conda/bin:$PATH
SHELL ["/bin/bash", "-c"]

# Install Python modules
COPY ./environment.yml /tmp/environment.yml
RUN sed -i '/.\/elephant-core/d' /tmp/environment.yml \
&& curl -OL https://repo.continuum.io/miniconda/Miniconda3-py37_4.11.0-Linux-x86_64.sh \
&& bash Miniconda3-py37_4.11.0-Linux-x86_64.sh -bfp /opt/conda \
&& rm Miniconda3-py37_4.11.0-Linux-x86_64.sh \
&& . /opt/conda/etc/profile.d/conda.sh \
&& conda init \
&& echo "conda activate base" >> ~/.bashrc \
&& conda install -c conda-forge -y mamba=0.19.1 \
&& mamba clean -qafy \
&& mamba env update -f /tmp/environment.yml \
&& mamba clean -qafy \
&& rm -rf /tmp/elephant-core \
&& rm /tmp/environment.yml
RUN mamba install jupyter

# Install and set up RabbbitMQ
COPY docker/install-rabbitmq.sh /tmp/install-rabbitmq.sh
RUN chmod +x /tmp/install-rabbitmq.sh && /tmp/install-rabbitmq.sh && rm /tmp/install-rabbitmq.sh
Expand All @@ -56,6 +39,9 @@ RUN groupadd -r nginx && useradd -r -g nginx nginx
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# install pypi packages
COPY requirements.txt /tmp/requirements.txt
RUN python -m pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
# RUN pip install memory_profiler line_profiler
# RUN pip install --no-deps stardist==0.8.3 csbdeep==0.7.2 numba==0.56.0 llvmlite==0.39.0 natsort==8.1.0

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM elephant-server:0.5.6
FROM elephant-server:0.6.0

LABEL maintainer="Ko Sugawara <[email protected]>"

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ help:

ELEPHANT_GPU?=all
ELEPHANT_WORKSPACE?=${PWD}/workspace
ELEPHANT_IMAGE_NAME?=elephant-server:0.5.6
ELEPHANT_IMAGE_NAME?=elephant-server:0.6.0
ELEPHANT_NVIDIA_GID?=$$(ls -n /dev/nvidia0 2>/dev/null | awk '{print $$4}')
ELEPHANT_DOCKER?=docker
ELEPHANT_RABBITMQ_NODENAME?=rabbit@localhost
Expand Down Expand Up @@ -82,7 +82,7 @@ notebook: warmup

test:
$(ELEPHANT_DOCKER) build -t $(ELEPHANT_IMAGE_NAME)-test -f Dockerfile-test . && $(ELEPHANT_DOCKER) image prune -f
$(ELEPHANT_DOCKER) run -it --rm $(ELEPHANT_IMAGE_NAME)-test
$(ELEPHANT_DOCKER) run --rm $(ELEPHANT_IMAGE_NAME)-test

apptainer-build:
apptainer build --fakeroot elephant.sif elephant.def
Expand Down
2 changes: 1 addition & 1 deletion docker/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ file=/var/run/supervisor%(ENV_ELEPHANT_BATCH_ID)s.sock
nodaemon=true

[program:uwsgi]
command=/opt/conda/bin/uwsgi --ini /etc/uwsgi/uwsgi.ini
command=uwsgi --ini /etc/uwsgi/uwsgi.ini
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
Expand Down
2 changes: 1 addition & 1 deletion elephant-core/elephant/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
# ==============================================================================
"""Version definition."""

__version__ = "0.5.6"
__version__ = "0.6.0"
23 changes: 7 additions & 16 deletions elephant.def
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Bootstrap: docker
From: nvidia/cuda:11.3.1-runtime-ubuntu20.04
From: pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime

%files
./docker /docker
./script /opt/elephant/script
./app /app
./elephant-core /src/elephant-core
./environment.yml /src/environment.yml
./requirements.txt /src/requirements.txt

%environment
export UWSGI_UID=$(id -u)
Expand Down Expand Up @@ -38,22 +38,13 @@ From: nvidia/cuda:11.3.1-runtime-ubuntu20.04
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Python modules
sed -i 's/.\/elephant-core/\/src\/elephant-core/g' /src/environment.yml \
&& curl -OL https://repo.continuum.io/miniconda/Miniconda3-py37_4.11.0-Linux-x86_64.sh \
&& bash Miniconda3-py37_4.11.0-Linux-x86_64.sh -bfp /opt/conda \
&& rm Miniconda3-py37_4.11.0-Linux-x86_64.sh \
&& . /opt/conda/etc/profile.d/conda.sh \
&& conda init \
&& echo "conda activate base" >> ~/.bashrc \
&& conda install -c conda-forge -y mamba==0.19.1 \
&& mamba clean -qafy \
&& mamba env update -f /src/environment.yml \
&& mamba clean -qafy \
&& rm -rf /src/elephant-core \
&& rm /src/environment.yml
# install pypi packages
python -m pip install -r /src/requirements.txt && rm /src/requirements.txt
python -m pip install /src/elephant-core && rm -r /src/elephant-core

# Install and set up RabbbitMQ
# Install Python modules
sed -i 's/sudo //g' /docker/install-rabbitmq.sh
chmod +x /docker/install-rabbitmq.sh && /docker/install-rabbitmq.sh
echo "rabbitmq-server \$@" > /rabbitmq.sh
chmod +x /rabbitmq.sh
Expand Down
2 changes: 1 addition & 1 deletion elephant_server.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"outputs": [],
"source": [
"%env ELEPHANT_SERVER_VERSION = v0.5.6"
"%env ELEPHANT_SERVER_VERSION = v0.6.0"
]
},
{
Expand Down
Loading

0 comments on commit 7029289

Please sign in to comment.