Skip to main content

A simple/dummy ChRIS DS app

Project description

https://badge.fury.io/py/simpledsapp.svg https://travis-ci.org/FNNDSC/simpledsapp.svg?branch=master https://img.shields.io/badge/python-3.5%2B-blue.svg

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.

Source Distribution

simpledsapp-1.0.3.tar.gz (5.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page