Next: , Previous: , Up: Top   [Contents][Index]

A Simple Workflow

To get a little taste of what the workflow language looks like, let’s start by writing a simple workflow.

Here is a simple workflow example:

process greet
  packages "hello"
  # { hello }

process sleep
  packages "coreutils"
  # {
    echo "Sleeping..."
    sleep 10

process eat (with something)
    string-append "eat-" something
  # {
    echo "Eating {{something}}"

process bye
  # { echo "Farewell, world!" }

workflow simple-wisp
    define eat-fruit
      eat "fruit"
    define eat-veges
      eat "vegetables"
      eat-fruit -> greet
      eat-veges -> greet
      sleep     -> eat-fruit eat-veges
      bye       -> sleep

This white-space sensitive syntax is called Wisp and if you’re familiar with Python or YAML you should feel right at home. To use this syntax simply save your workflow to a file ending on .w, .wisp, or .gwl.

The workflow language really is a domain specific language (DSL) embedded in Guile Scheme, so if you’re a Lisper you may prefer to write your workflows directly in Scheme while basking in its parenthetical glow:

(define-public greet
   (name "greet")
   (packages (list "hello"))
   (procedure '(system "hello"))))

(define-public sleep
   (name "sleep")
   (packages (list "coreutils"))
        (display "Sleeping...\n")
        (system "sleep 10")))))

(define-public (eat something)
   (name (string-append "eat-" something))
    `(format #t "Eating ~a\n" ,something))))

(define-public bye
   (name "bye")
    '(display "Farewell, world!\n"))))

 (name "simple")
  (let ((eat-fruit (eat "fruit"))
        (eat-veges (eat "vegetables")))
    (graph (eat-fruit -> greet)
           (eat-veges -> greet)
           (sleep     -> eat-fruit eat-veges)
           (bye       -> sleep)))))

Everything you can express in Scheme can also be expressed with the Wisp syntax, so the choice is down to personal preference.

Next: , Previous: , Up: Top   [Contents][Index]