Skip to content

Chris workflow

Jorge edited this page Aug 9, 2016 · 29 revisions

##Developing a Chris plugin app Chris plugin apps are Python packages that contain a module with the same name as the package. The module can be run from the command-line with a series of previously defined arguments to perform any predefined computing task. Internally plugin apps are added to the Chris Django project under the services package in the plugins django app. So given a Chris plugin app called simplefsapp it is possible to import it anywhere in the Django project:

from plugins.services.simplefsapp import simplefsapp

The Python module must define a single class that inherits from ChrisApp, the base class for all Chris plugin apps. Two methods are required to be overridden:

  • define_parameters(self)
  • run(self, options)

The first method can be overridden to define the arguments expected by the Chris plugin app. This can be done by calling the add_parameter method to individually define each single argument. add_parameter accepts the same arguments as the add_argument method of the ArgumentParser class defined in the Python's standard [argparse] (https://docs.python.org/3/library/argparse.html#module-argparse) module.

The second method can be overriden to define any computing task. The options argument is an object containing the arguments passed to the plugin app as attributes plus two additional attributes:

  • options.inputdir , directory containing the input data (only available for plugin apps of type 'ds')
  • options.outputdir , directory where the output data must be written
Clone this wiki locally