You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

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

What is YAML?

YAML is plain text format for representing data organized as lists of values or sets of key-value pairs (mappings or dictionaries). The values in these lists and in the key-value pairs of mappings 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) or graphical user interfaces.  And other programs can generate workflow specifications simply by producing 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 will use the hello.yaml workflow from the Kurator-Akka distribution to show 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 the 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

components:

  - id: GreetingSource
    type: ConstantSourceActor
    properties:
      parameters:
        value: Hello World!

  - id: GreetingPrinter
    type: PrinterActor
    properties:
      listensTo:
        - !ref GreetingSource
 
  - id: HelloWorldWorkflow
    type: Workflow
    properties:
      actors:
        - !ref GreetingSource
        - !ref GreetingPrinter
      parameters:
        greeting:
          actor: !ref GreetingSource
          parameter: value

Structure of a YAML workflow definition file

Inspecting the contents of hello.yaml you will note that Kurator-Akka expects each YAML workflow definition file to have a mapping (list of key-value pairs) as the top-level data structure (keys and values are separated by colons in YAML).  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 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 list (list items are preceded by a dash in YAML) of other YAML files to be included in the current workflow definition.  The value given to the components is the list of workflow components comprising the workflow.   We will focus on the workflow components for the remainder of this tutorial page.

 

  • No labels