Skip to content

Commit

Permalink
Improve infrastructure (docker, requirements, coverage, gitignore)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaMuravjov committed Mar 2, 2024
1 parent b04d4aa commit 6e1b833
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 11 deletions.
153 changes: 153 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Tests output
test/pocr_data/**/actual_*

# Temp pytest-cov config
.temp_coveragerc

# Temp RAM usage file
temp_ram_usage.txt

# Local files
.playground

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

#IDE
.idea/
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ test/pocr_data/**/actual_*
# Temp pytest-cov config
.temp_coveragerc

# Temp RAM usage file
temp_ram_usage.txt

# Local files
.playground/**
data

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
26 changes: 18 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FROM graphblas/pygraphblas-minimal:v4.2.2
FROM python:3.9-slim as builder

ADD . /CFPQ_PyAlgo
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /CFPQ_PyAlgo
RUN git submodule init
RUN git submodule update
WORKDIR /app

WORKDIR /CFPQ_PyAlgo/deps/CFPQ_Data
RUN python3 setup.py install
COPY requirements.txt /app/
COPY deps/CFPQ_Data /app/deps/CFPQ_Data

WORKDIR /CFPQ_PyAlgo
RUN pip3 install pygraphblas==5.1.8.0
RUN pip3 install -r requirements.txt
RUN cd deps/CFPQ_Data && python3 setup.py install

FROM python:3.9-slim

RUN apt update
RUN apt install time

COPY --from=builder /usr/local /usr/local

WORKDIR /app
COPY . /app
77 changes: 77 additions & 0 deletions Dockerfile-all-tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Download base image here: https://figshare.com/ndownloader/files/42214812
FROM pearl-ase23:v1
ENV PEARL_DIR=/root/eval

# Common utilities
RUN apt-get update && apt-get install -y git sed time bsdmainutils vim

# POCR dependencies
RUN apt-get update && apt-get install -y \
cmake \
gcc \
g++ \
libtinfo-dev \
libz-dev \
zip \
wget \
npm

# Gigascale dependencies
RUN apt-get update && apt-get install -y openjdk-17-jdk ant python2

# Graspan dependencies
RUN apt-get update && apt-get install -y \
build-essential \
wget \
make \
g++ \
libboost-all-dev \
git
RUN wget -qO- https://sourceforge.net/projects/boost/files/boost/1.62.0/boost_1_62_0.tar.gz | tar xvz -C /usr/local
ENV BOOST_ROOT=/usr/local/boost_1_62_0
ENV LD_LIBRARY_PATH=$BOOST_ROOT/stage/lib:$LD_LIBRARY_PATH

## POCR dependency, that needs to be built from sources
RUN git clone https://github.com/kisslune/SVF.git /SVF \
&& cd /SVF \
&& /bin/bash -c "source ./build.sh" \
&& echo 'pushd /SVF > /dev/null && source setup.sh && popd > /dev/null' >> /root/.bashrc
ENV SVF_DIR=/SVF

# POCR (general-purpose CFL-r tool)
RUN git clone https://github.com/kisslune/POCR.git /POCR \
&& cd /POCR \
&& /bin/bash -c "source ./../SVF/setup.sh && source ./build.sh" \
&& echo 'pushd /POCR > /dev/null && source setup.sh && popd > /dev/null' >> /root/.bashrc
ENV POCR_DIR=/POCR

# Gigascale (specialized CFL-r tools)
RUN git clone https://bitbucket.org/jensdietrich/gigascale-pointsto-oopsla2015.git /gigascale
RUN sed -i 's/python /python2 /g' /gigascale/run.sh
RUN sed -i 's/-d64 //g' /gigascale/run.sh
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
ENV GIGASCALE_DIR=/gigascale

# Graspan (general-purpose CFL-r tool)
RUN git clone https://github.com/Graspan/Graspan-C.git /graspan
RUN sed -i 's|/home/aftab/Downloads/boost_1_62_installed|'$BOOST_ROOT'|g' /graspan/src/makefile
RUN sed -i 's|/home/aftab/Downloads/boost_1_62_installed|'$BOOST_ROOT'|g' /graspan/src/run
RUN cd /graspan/src && make
ENV GRASPAN_DIR=/graspan

# CFPQ_PyAlgo dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y python3.9 python3.9-distutils python3.9-dev python3-pip
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
RUN python3 -m pip install --upgrade pip

# CFPQ_PyAlgo (this tool)
COPY requirements.txt /py_algo/requirements.txt
COPY deps/CFPQ_Data /py_algo/deps/CFPQ_Data
RUN pip3 install pygraphblas==5.1.8.0
RUN cd /py_algo && pip3 install -r requirements.txt
RUN cd /py_algo/deps/CFPQ_Data && python3 setup.py install
COPY . /py_algo
2 changes: 1 addition & 1 deletion collect_diff_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "Collecting coverage for files modified after commit:"
git --no-pager log -n 1 $MERGE_BASE_COMMIT

echo
MODIFIED_FILES=$(git diff --name-only $MERGE_BASE_COMMIT | grep '.py$' | grep -v '^test')
MODIFIED_FILES=$(git diff --name-only $MERGE_BASE_COMMIT | grep '.py$' | grep '^src')
echo "Changed Python files:"
echo $MODIFIED_FILES

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tqdm
pytest
tqdm==4.62.2
pytest==8.0.1
pytest-benchmark
pytest-cov
cfpq_data==1.0.2
Expand Down

0 comments on commit 6e1b833

Please sign in to comment.