Skip to content

Commit

Permalink
Add common docker runtime arguments (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn authored Jan 25, 2022
1 parent d77c80d commit 7ee13be
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on: [push, pull_request]
env:
PYTHON_VERSION: '3.9'

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:

precommit:
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

0.3.1 (2022-01-24)
------------------

* Added parameters to docker run commands to better reflect how containers are executed

0.3.0 (2021-10-08)
------------------

Expand Down
2 changes: 1 addition & 1 deletion evalutils/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION = (0, 3, 0)
VERSION = (0, 3, 1)

__version__ = ".".join(map(str, VERSION))
4 changes: 2 additions & 2 deletions evalutils/evalutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ def score_aggregates(self):

totals = self._case_results.sum()

for s in totals.index:
aggregate_results[s]["sum"] = totals[s]
for s in ["true_positives", "false_positives", "false_negatives"]:
aggregate_results[s]["sum"] = int(totals[s])

tp = aggregate_results["true_positives"]["sum"]
fp = aggregate_results["false_positives"]["sum"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ RUN python -m pip install --user -rrequirements.txt
COPY --chown=algorithm:algorithm process.py /opt/algorithm/

ENTRYPOINT python -m process $0 $@

## ALGORITHM LABELS ##

# These labels are required
LABEL nl.diagnijmegen.rse.algorithm.name={{ cookiecutter.algorithm_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
./build.sh

VOLUME_SUFFIX=$(dd if=/dev/urandom bs=32 count=1 | md5sum | cut --delimiter=' ' --fields=1)
MEM_LIMIT="4g" # Maximum is currently 30g, configurable in your algorithm image settings on grand challenge

docker volume create {{ cookiecutter.package_name|lower }}-output-$VOLUME_SUFFIX

# Do not change any of the parameters to docker run, these are fixed
docker run --rm \
--memory="${MEM_LIMIT}" \
--memory-swap="${MEM_LIMIT}" \
--network="none" \
--cap-drop="ALL" \
--security-opt="no-new-privileges" \
--shm-size="128m" \
--pids-limit="256" \
-v $SCRIPTPATH/test/:/input/ \
-v {{ cookiecutter.package_name|lower }}-output-$VOLUME_SUFFIX:/output/ \
{{ cookiecutter.package_name|lower }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ VOLUME_SUFFIX=$(dd if=/dev/urandom bs=32 count=1 | md5sum | cut --delimiter=' '

docker volume create {{ cookiecutter.package_name|lower }}-output-$VOLUME_SUFFIX

# Do not change any of the parameters to docker run, these are fixed
docker run --rm \
--memory=4g \
--memory="4g" \
--memory-swap="4g" \
--network="none" \
--cap-drop="ALL" \
--security-opt="no-new-privileges" \
--shm-size="128m" \
--pids-limit="256" \
-v $SCRIPTPATH/test/:/input/ \
-v {{ cookiecutter.package_name|lower }}-output-$VOLUME_SUFFIX:/output/ \
{{ cookiecutter.package_name|lower }}
Expand Down
3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ markers =
slow
filterwarnings =
error
ignore:.*The default dtype for empty Series will be 'object' instead of 'float64' in a future version.*:DeprecationWarning:pandas
ignore:.*The default dtype for empty Series will be 'object' instead of 'float64' in a future version.*
ignore:.*Use pandas.concat instead\.:FutureWarning

0 comments on commit 7ee13be

Please sign in to comment.