A simple/dummy ChRIS DS app
Project description
Abstract
simpledsapp is a simple DS plugin that copies directories file from an input to output. If called with an optional --ignoreInputDir the plugin will simply write a JSON formatted timestamp to the output directory.
Synopsis
python simpledsapp.py \
[-v <level>] [--verbosity <level>] \
[--prefix <filePrefixString>] \
[--sleepLength <sleepLength>] \
[--ignoreInputDir] \
[--version] \
[--man] \
[--meta] \
<inputDir>
<outputDir>
Run
This plugin can be run in two modes: natively as a python package or as a containerized docker image.
Using PyPI
To run from PyPI, simply do a
pip install simpledsapp
and run with
simpledsapp.py --man /tmp /tmp
to get inline help. To copy from one directory to another, simply do
simpledsapp.py /some/input/directory /destination/directory
Using docker run
To run using docker, be sure to assign an “input” directory to /incoming and an output directory to /outgoing. Make sure that the $(pwd)/out directory is world writable!
Now, prefix all calls with
docker run --rm -v $(pwd)/out:/outgoing \
fnndsc/pl-simpledsapp simpledsapp.py \
Thus, getting inline help is:
mkdir in out && chmod 777 out
docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-simpledsapp simpledsapp.py \
--man \
/incoming /outgoing
Examples
Copy from input to output with a prefix
Assign an “input” directory to /incoming and an output directory to /outgoing
mkdir in out && chmod 777 out
docker run -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-simpledsapp simpledsapp.py \
--prefix test- \
--sleepLength 0 \
/incoming /outgoing
The above will create a copy of each file in the container’s /incoming and prefix the file copied with the prefix text (in this case “test-“). The copies will be stored in the container’s /outgoing directory.
Simply write a timestamp to the output directory, ignoring the input completely
Assign an “input” directory to /incoming and an output directory to /outgoing
mkdir in out && chmod 777 out
docker run -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing \
fnndsc/pl-simpledsapp simpledsapp.py \
--ignoreInputDir \
/incoming /outgoing
This will simply create a file called timestamp.json in the output directory. This mode is useful to just create mock nodes in a Feed tree.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.