ChRISPile
Syntactical sugar for running ChRIS plugins locally.
Abstract
chrispile generates wrapper scripts around docker run (or podman run).
These scripts automatically locate mount points for the position arguments
/incoming and /outgoing for
ChRIS plugin apps.
Additionally, the wrapper sets sane defaults for running the container.
Background
Traditionally, docker run is a very verbose command with user-unfriendly defaults.
Of course there are good reasons for this design (security isolation)
but it is tedious and confusing to work with.
- the default user is
rootso you will needsudoto removeoutputdir. - container timezone is UTC
- stopped containers occupy disk space
- GPU is invisible
- user needs to specify image name and command
- folders containing data need to be typed out
chrispile aims to hide this complexity from users.
WARNING: it is not a good idea to use chrispile unless you understand why it is helpful. You gotta learn the basics: what is docker?
Example
mkdir data output
cp scan.nii.gz data
chrispile run -- fnndsc/pl-fetal-brain-mask:1.0.0 --inputPathFilter scan.nii.gz data output
The command above is translated to:
docker run
# clean up the stopped container after it exists
--rm
# run as yourself so that the output is readable+writable by you
--user $(id -u):$(id -g)
# if plugin meta specifies min_gpu_limit, GPU is enabled
# GPU support is detected as --runtime=nvidia (legacy) or --gpus all (native)
--gpus all
# set the timezone in case your plugin logs timestamps
-v /etc/localtime:/etc/localtime:ro
# resolve input and output paths
# SELinux label flag ':z' is appended to volume options if necessary
-v /home/jenni/data:/incoming:ro -v /home/jenni/output:rw
# container image name and command
fnndsc/pl-fetal-brain-mask:1.0.0 fetal_brain_mask
# user specified options
--inputPathFilter scan.nii.gz
# volume mountpoints
/incoming /outgoing
Installation
pip install chrispile
Usage
$ chrispile --help
usage: chrispile [-h] [-V] {run,api,install,list,uninstall} ...
Generate wrapper scripts around docker or podman run to easily run ChRIS plugins
optional arguments:
-h, --help show this help message and exit
info:
-V, --version show program's version number and exit
subcommands:
{run,api,install,list,uninstall}
run run a ChRIS plugin
api query the system for information
install install a ChRIS plugin as an executable
list list installed ChRIS plugins
uninstall uninstall a ChRIS plugin
Run Plugin
$ chrispile run --help
usage: chrispile run [--dry-run] [--reload-from] -- dock_image [args ...] inputdir/ outputdir/
positional arguments:
dock_image container image of the ChRIS plugin
args arguments to pass to the ChRIS plugin
optional arguments:
-h, --help show this help message and exit
-d, --dry-run print command to run withour running it
-e src, --reload-from src
mount given host directory as source folder for rapid development
Run Example
docker pull fnndsc/pl-simpledsapp:2.0.0
# setup test data
mkdir input output
touch input/{a,b,c}
Dry Run
$ chrispile run --dry-run -- fnndsc/pl-simpledsapp:2.0.0 --dummyFloat 3.5 input output
docker run --rm --user 1000:1003 \
-v /etc/localtime:/etc/localtime:ro \
-v /home/chris/input:/incoming:ro \
-v /home/chris/output:/outgoing:rw \
fnndsc/pl-simpledsapp:2.0.0 simpledsapp \
--dummyFloat 3.5 \
/incoming /outgoing
Real Run
$ chrispile run -- fnndsc/pl-simpledsapp:2.0.0 --dummyFloat 3.5 input output
_ _ _
(_) | | | |
___ _ _ __ ___ _ __ | | ___ __| |___ __ _ _ __ _ __
/ __| | '_ ` _ \| '_ \| |/ _ \/ _` / __|/ _` | '_ \| '_ \
\__ \ | | | | | | |_) | | __/ (_| \__ \ (_| | |_) | |_) |
|___/_|_| |_| |_| .__/|_|\___|\__,_|___/\__,_| .__/| .__/
| | | | | |
|_| |_| |_|
Version: 2.0.0
Sleeping for 0
Creating new file... /outgoing/b
Creating new file... /outgoing/a
Creating new file... /outgoing/c
Check Outputs
$ ls -lh output
total 0
-rw-r--r-- 1 chris grantlab 0 Feb 13 22:21 a
-rw-r--r-- 1 chris grantlab 0 Feb 13 22:21 b
-rw-r--r-- 1 chris grantlab 0 Feb 13 22:21 c
$ rm -rv output
removed 'output/b'
removed 'output/a'
removed 'output/c'
removed directory 'output'
Run With Live Code
Mount the source code directory into the installed library's location within the container for a convenient developer experience.
The container will run changes you've made to the code without having to rebuild the docker image.
chrispile run --reload-from ~/Github/pl-simpledsapp/simpledsapp \
-- fnndsc/pl-simpledsapp:2.0.0 --dummyFloat 3.2 input output
Install Plugin
docker pull fnndsc/pl-brainmgz:2.0.3
chrispile install fnndsc/pl-brainmgz:2.0.3
docker pull fnndsc/pl-lungct:latest
chrispile install fnndsc/pl-lungct:latest
Now you can simply run
mkidr out
lungct out
Uninstall Plugin
$ chrispile list
lungct
simpledsapp
med2img.py
$ chrispile uninstall lungct
Planned Features
- Github Actions build matrix to test docker and podman separately
- store repeated
$(chrispile api ...)calls as variables in bash script -
chrispile createas an alias for cookiecutter-chrisapp -
chrispile run --clobberdeletes the/outgoingdirectory before start -
chrispile installfrom https://chrisstore.co and pulls for you -
chrispile listalso shows container image tags -
chrispile uninstall --rmalso runsdocker rmi
Metadata
Release files for chrispile 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| chrispile-1.2.4.tar.gz | 16.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chrispile-1.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.7 kB
Release files / chrispile-1.2.4.tar.gz
| Download URL | chrispile-1.2.4.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ead419ade92ce26206dd664392c872d0e0356f7eea4d574fefbcd85feb88379
|
|
BLAKE2b-256 checksum How to use checksums |
2ee38972c2b5d0034688355c4969f330dd18f45895a6b230807ab01a52026099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / chrispile-1.2.4-py3-none-any.whl
| Download URL | chrispile-1.2.4-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83f62146f8fff8eb0bfa28824db7155d2b60267b6efcea03f27c925404c019fa
|
|
BLAKE2b-256 checksum How to use checksums |
119dd9902a17e16e2baa232cc0c3fae7c4809f3120de5b6a4cae1f929466c7e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Security for chrispile 1.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.