A First Basic Workflow
Let’s create a job that uses the lolcow image
from Docker Hub to run the fortune
command and produce
a random fortune/quote/joke. We’ll start by showing the steps to create the most basic
workflow possible and then we will build on that
workflow to create something more complex in later sections.
After logging in to Fuzzball and selecting your account, navigate to the “Workflow Editor” by clicking the menu item on the left and then select “Create New”.
Workflows are composed of 1 or more jobs. So we should start by adding a job to this workflow. Click the plus sign in the lower-right corner and drag and drop a new box into the central grid. A dialog box will open asking you to name the job.
After you do so, you will see a menu with several tabs open to the right.
You can start by adding a new command in the “Job” tab. Click the “Add” button.
The first 2 commands will cause the command line to be prepended with the string /bin/sh -c
. Do
not alter these. This allows you to pass an arbitrary string in the third box that will be executed
as a command by the default shell within the
container.
As we said above, we will create a job that generates text using the Fortune program. So add the
fortune
command like so:
Now you can click on the “Environment” tab to configure the environment that this job will run in.
The only thing that you absolutely need to provide is a URI to a container
image that supports your job. Here we will use the famous
lolcow image from Docker Hub because it includes the fortune
command. We will use the
SIF version of this image by specifying
that we want to download it using the ORAS protocol and specifying the sif
tag. (This tag is
specific to the lolcow image.)
Enter the following text to pull the correct container:
oras://godlovedc/lolcow:sif
Now you can click on the “Resources” tab to finish the configuration necessary to run a basic workflow.
The bare minimum configuration includes a specification for the number of cores and the amount of memory to use. 1 core and 1GB memory will be sufficient to execute the fortune command.
At this point you can save the settings and run the job with the triangular button at the bottom of the workflow grid. After optionally naming your job, you can proceed to the the workflow. When completed, you will see something like the following:
You can see the Fuzzfile at any time from the Workflow Editor by clicking the ellipsis menu in the lower right of the workflow grid and selecting “Edit YAML” or by pressing “e” on your keyboard. You can also view the Fuzzfile by clicking on the “Definition” tab in the “Workflows” dashboard. In the example here, the Fuzzfile that is generated by the Workflow Editor looks like this.
version: v1
jobs:
fortune:
image:
uri: oras://godlovedc/lolcow:sif
command:
- /bin/sh
- '-c'
- fortune
resource:
cpu:
cores: 1
memory:
size: 1GB
If you want to replicate this or any of the workflows in these examples, but you don’t want to manually recreate them using the Workflow Editor, you can always copy and paste this text into a file and open the file in the Workflow Editor. Or you can just press “e” to open the text editor window in the Workflow Editor and paste in this text!
The next section will expand on this basic Fuzzfile to create a workflow that runs multiple jobs (with dependencies) and adds a Storage Volume to share data between jobs.