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

Printer

The instructions below will walk you through the process of launching a simple printer workflow using the Fuzzball workflow catalog. The workflow catalog will help you generate, validate, and submit a Fuzzfile representing the printer workflow. This workflow uses a public Alpine Linux container from Docker Hub to print one integer every second for a configurable number of seconds. This simple workflow will help familiarize you with Fuzzball’s real-time logging feature, and can also be used to experiment with Fuzzball’s in-job terminal.

You can run this workflow either through the web UI or the CLI.

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

Start the workflow from the Printer Example tile on the Catalog tab of the Workflows page, setting the number of seconds in the Configure panel or accepting the defaults, then click RUN. Getting Your First Workflow walks that catalog flow screen by screen if you have not used it before. Submitting takes you straight to the workflow’s status page.

Fuzzball printer workflow status page

Watching the logs as they arrive. Select the printer job – either by clicking its node on the canvas or by choosing Run Job: printer from the stage drop down below the canvas – then click the Logs tab in the panel on the right. Because the job prints one integer per second for its configured duration, the pane fills while you watch it, which is what makes this example a useful check that live log streaming is working.

Workflow status page showing logs from the printer example

Opening a terminal in the running job. With the same job selected, click the Terminal tab to open an interactive shell inside its container. The printer job runs for as long as the duration you configured, so set that long enough to leave yourself a window to look around in – the shell closes when the job ends. Note that the web UI offers only the interactive shell; to run a single command and collect its output, use the CLI’s workflow exec instead. Both are covered in Getting an Interactive Shell and Executing Commands.

These steps use the Fuzzball CLI.

First, you can create a values file values.yaml to populate the printer example workflow template using the command below. You can modify the parameters to your desired values or use the defaults below.

$ cat >values.yaml<<EOF
values:
  - name: "Container"
    display_name: "container for printer job (must contain the sleep command)"
    string_value: "docker://docker.io/alpine:latest"
  - name: "Seconds"
    display_name: "How many seconds do you want the printer job to run and count?"
    uint_value: 300
EOF

Next, you will need to find the workflow template. The command below lists workflow templates provided by CIQ. The ID shown is an example value: template IDs are specific to a cluster and to the catalog repository the template came from, so yours will differ. render and start also accept the template name, which is what the examples below use – provided no other catalog repository publishes a template of that name.

$ fuzzball workflow catalog list --provider CIQ --name '*Printer*'
ID                                   | NAME
c8cc813e-c29b-5461-bc43-2d53f62a3634 | Printer Example

You can generate a Fuzzfile using the workflow template and the values.yaml file you created in the first step using the command below.

$ fuzzball workflow catalog render --values values.yaml 'Printer Example' > printer.fz

You can start this workflow using the CLI by running the following command:

$ fuzzball workflow start printer.fz
1e5a3e07-3dd6-4462-b958-a4a396294d3a

The two steps – rendering a concrete workflow from a template and your parameter values, then submitting that workflow – can be combined into a single command:

$ fuzzball workflow catalog start --name "printer test" --values values.yaml 'Printer Example'
6665ab2e-ded0-46b0-bee2-6a11f8cb1785

You can monitor the workflow’s status by running the following command:

$ fuzzball workflow describe 1e5a3e07-3dd6-4462-b958-a4a396294d3a
Name:      printer.fz
Email:     user1@ciq.com
UserId:    e554e134-bd2d-455b-896e-bc24d8d9f81e
Status:    STAGE_STATUS_STARTED
Created:   2024-06-27 01:56:58PM
Started:   2024-06-27 01:56:58PM
Finished:  N/A
Error:



KIND     | STATUS   | NAME                                 | DURATION
Workflow | Started  | 1e5a3e07-3dd6-4462-b958-a4a396294d3a | 3m15s
Image    | Finished | docker://docker.io/alpine:latest      | 15s
Job      | Started  | printer                              | 2m45s

You can view the output logged by the workflow by running the following command:

$ fuzzball workflow log 1e5a3e07-3dd6-4462-b958-a4a396294d3a printer
1
2
3
4
...

Create a shell in the running container like so:

$ fuzzball workflow exec --tty 1e5a3e07-3dd6-4462-b958-a4a396294d3a printer -- /bin/sh
~ $ echo $HOSTNAME
printer
~ $ echo $FB_WORKFLOW_ID
1e5a3e07-3dd6-4462-b958-a4a396294d3a