Fuzzball Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Getting Your First Workflow

Your Fuzzball cluster hosts a list of prebuilt Fuzzfile templates in the Workflow Catalog. These template workflows allow you to automatically create the YAML files (Fuzzfiles) that define workflows and they are a great way to get up and running with Fuzzball quickly. Detailed information on developing Fuzzfiles and a complete syntax guide are presented elsewhere.

The workflow used to complete this tutorial runs for 5 minutes and prints one integer from 1 to 300 per second. In the real world, this workflow is completely useless. But it serves as a useful demonstration for this tutorial since it produces output that can be gathered via Fuzzball logging and runs for 5 minutes allowing time for user interaction. More useful “real world” examples can be obtained in the Workflow Examples section.

For now, simply select one of the tabs below to see instructions specific for your environment.

Please select either the web UI or CLI tab to see the appropriate instructions for your environment.

We can use the Workflow Catalog to get up and running quickly with a basic Fuzzball example. The Workflow Catalog has templates that create Fuzzfiles automatically from a workflow template and user-provided parameters. In this tutorial, we will use the Printer template to create a Fuzzfile and run a simple workflow.

In the Workflow Catalog use the search bar to locate the example named “Printer Example”.

Fuzzball Printer example in Workflow Catalog

You can see details about the workflow template by either clicking on the name of the workflow or by selecting “View details” from the kebab menu of the workflow template card. The detail page will show you a template used to create the printer workflow Fuzzfile, as well as the inputs that can be changed by the user. The values in the YAML template that are surrounded by double curly braces and preceded by a dot (e.g. {{.Container}}) are inputs that you can change before rendering the finished Fuzzfile.

Printer details

You can choose to render the workflow template with the parameters you select and open the resulting Fuzzfile in the Workflow Editor (“Render Fuzzfile and Edit”), or directly run it (“Render Fuzzfile and Run”). For the purposes of this tutorial, select “Render Fuzzfile and Run”. Either way, a dialog box like the following will open allowing you to edit the input parameters before creating the final Fuzzfile.

Printer template dialog box to edit inputs

The printer template allows you to change the container that is used to run the printer job, and the number of seconds that the job runs. Other templates may allow you to change the commands that are run, the resources that are used, etc.

For now, just select “Run” without changing any defaults. The message at the bottom indicates that the Fuzzfile has been automatically rendered (behind the scenes) and checked for valid syntax and you are presented with a dialog showing a summary of the rendered workflow and allowing you to name your workflow execution.

Printer start workflow from catalog

That’s it! At this point a valid Fuzzfile for the printer workflow has been saved behind the scenes and is ready to be submitted by clicking the “Start Workflow” button. We’ll look at submitting the workflow in the next section on Starting and Stopping Your New Workflow.

Building your Fuzzfile outside of the GUI is simply a matter of using a text editor. First, let’s create a new directory to experiment in:

$ mkdir ~/fb-work

$ cd !$

Now either copy and paste the contents of printer.fz described here into the appropriately named file using the text editor of your choice, or download the file and place it in the directory you just created.

version: v1
jobs:
  printer:
      #!/bin/sh
      uri: docker://docker.io/alpine:latest
    policy:
      timeout:
        execute: 6m0s
    script: |
      #!/bin/sh
      for i in $(seq 1 300); do echo $i; sleep 1; done
    resource:
      cpu:
        cores: 1
      memory:
        size: 1GB
The .fz file extension is not necessary. Fuzzfiles also commonly carry .yml or .yaml extensions since they are written in YAML.

Fuzzball will automatically check and validate your Fuzzfile for syntax errors when you submit the workflow, but you can do so manually with the following command:

$ fuzzball workflow validate ./printer.fz
"./printer.fz" has been validated.

A Fuzzfile with syntax errors will return an error similar to this:

$ fuzzball workflow validate ./printer.fz
yaml: unmarshal errors:
  line 2: field jerbs not found in type api.WorkflowDefinition

(Optional) explanation of example Fuzzfile

If you want detailed information about the sections in this Fuzzfile, expand the section below. Feel free to skip this section for now if you are just trying to learn how to submit your workflows with Fuzzball.

Whether you used the Workflow Catalog to automatically create your Fuzzfile behind the scenes, or you copied the example from the text, you should have ended up with a Fuzzfile that looked like the following. (If you used the Workflow Catalog to create this Fuzzfile automatically it will not be visible to you until you run the workflow in the next step.)

version: v1
jobs:
  printer:
    image:
      uri: docker://docker.io/alpine:latest
    policy:
      timeout:
        execute: 6m0s
    script: |
      #!/bin/sh
      for i in $(seq 1 300); do echo $i; sleep 1; done
    resource:
      cpu:
        cores: 1
      memory:
        size: 1GB

You might find it useful to start with this Fuzzfile and edit it to suit your needs. Therefore, a brief explanation is provided. We will explain each Fuzzfile section in turn.

The order of sections at the same level of indentation is arbitrary, but the indentation of a Fuzzfile (or any YAML file) will cause a syntax error if it is not correct.
version: v1
jobs:

The first line specifies that we are using version 1 Fuzzfile syntax, and the second line starts the “jobs” section where any jobs that compose the workflow will be specified.

  printer:
    image:
      uri: docker://docker.io/alpine:latest

This starts the section associated with the job called “printer” (which is the only job in this Fuzzfile), and states that the job should run in the latest alpine container obtained from Docker Hub. (See the documentation on container URLs for more info about specifying containers.)

    policy:
      timeout:
        execute: 6m0s

The policy section states that the job should timeout (be canceled) if it runs longer than the time allotted.

    script: |
      #!/bin/sh
      for i in $(seq 1 300); do echo $i; sleep 1; done

This section specifies the script that should run in the job (within the given container). In this example the script runs a loop with 300 iterations. Within each cycle of the loop, echo the current iteration, and wait (sleep) for one second. So this workflow just counts seconds from 1 to 300 (a total of five minutes).

    resource:
      cpu:
        cores: 1
      memory:
        size: 1GB

The final section specifies the computational resources that the job needs. In this case the job requires 1 core and 1GB memory.