Template library to generate an o²S²PARC compatible computational service that installs and executes command-line tools. For more general use-cases, with standardized definitions of inputs/outputs, please take a look at cookiecutter-osparc-service.
- GNU Make
- Python3
- Python3-venv (recommended to work in a virtual environment)
cookiecutter
Docker
(if you wish to build and test the service locally)
To install the cookiecutter:
sudo apt-get update
sudo apt-get install -y make python3-venv
python3 -m venv .venv
source .venv/bin/activate
pip install cookiecutter jinja2_time
Generate a new Service based on the cookiecutter template layout:
python3 -m venv .venv
source .venv/bin/activate
cookiecutter git+ssh://[email protected]/ITISFoundation/cookiecutter-osparc-cli-service
This will create a simple project, based on cookiecutter.json, will build the images (this can take some time) and run a command in the container:
make tests
This project is licensed under the terms of the MIT License
The service code is in the folder {{cookiecutter.project_slug}}. Users find instructions on how to create the service in the README
In most use-cases, users only need to install the desired tool in the Dockerfile
The input and outputs of the service are already defined (users are not required to modify them). The first input is a string for executing the required command and the second input is one file or more files (in a zip). The input file(s) are optional.
The script service.cli/execute.sh takes care of all the logic:
- retrieves inputs and copies them to the working directory
- executes the command
- retrieves the outputs: all the new files generated by the execution are copied and zipped in the output folder. If no output file is generated, the execution will terminate with an error.
The cookiecutter has been tested to create Services with the following tools:
- The bash
touch
command (also used in the tests) - Spinal Cord Toolbox, e.g. command:
sct_deepseg_sc -i t1w.nii.gz -c t2
, we also have a GUI-based service on o²S²PARC - k-wave, e.g. command:
kspaceFirstOrder-OMP -i input.h5 -o output.h5
, we also have a computational service on o²S²PARC