Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial introduces how Kurator-Akka workflows are specified in YAML files. 

What is YAML?

YAML is a plain text format for representing data organized as lists of values or sets and sets of key-value pairs (mappings or dictionaries). The values in these lists and in the key-value pairs can themselves be lists or mappings.  YAML is a superset of JSON (every JSON document is a valid YAML document) that uses white space (rather than braces and quotes) to organize data, and is thus easy to read. 

Kurator-Akka uses YAML to represent workflow definitions so that workflows can be specified and executed without using any software development tools (other than a text editor), and so that other programs can generate workflow specifications simply by producing a YAML file. Kurator-Akka uses yaml-spring-loader (written by Scott McPhillps McPhillips for the RestFlow system) to parse YAML files and to create (using Spring) the workflow components the files describe.

Note that grouping and nesting of data in YAML is achieved by aligning and indenting the text in the file.  Spaces are used for alignment and indenting.  Tabs are never used in a YAML file. 

See http://yaml.org/ for more information about YAML and a list of libraries in C/C++, Ruby, Python, Java, Perl, C#, and other languages for composing and parsing YAML. 

Example workflow

 We We will use the hello.yaml workflow from the Kurator-Akka distribution to show illustrate how workflows are specified in YAML.  You can extract this YAML file from the kurator-akka jar file using the unzip command (the -j option prevents any directories from being created during inflation):

$ unzip -j kurator-akka-0.2-executable.jar org/kurator/akka/samples/hello.yaml
Archive:  kurator-akka-0.2-executable.jar
  inflating: hello.yaml
$

The contents of hello.yaml are as follows:

imports:

  - classpath:/org/kurator/akka/actors.yaml

...

Structure of a YAML workflow definition file

Inspect the contents of hello.yaml above. Kurator-Akka expects each YAML workflow definition file to have a mapping (set of key-value pairs) as the top-level data structure. A colon in YAML indicates that the preceding string is a key, and that the following value or block of text is the value assigned to that key.  The valid keys of this top-level mapping are imports, types, and components, with the result that Kurator-Akka workflow definition files have up to three top-level sections: an imports section, a types section, and a components section.  The hello.yaml file does not have a types section.

The imports section (the block of text following the imports line) must be a  is for providing a list of other YAML files to be included in the current workflow definition.  List items are preceded by a dash.  The value given to the components is the The components section provides a list of the workflow components comprising the workflow.  We will focus on the workflow components for the remainder of this tutorial page.

...