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

Reading and Writing Data on a Persistent Volume

The two preceding examples staged their data with ingress and cleared it away when the ephemeral volume was destroyed. A persistent volume can remove the need for data ingress and egress altogether: the data a workflow needs may already be there when Fuzzball mounts it, and anything a job writes survives the workflow. In the following example, we will mount a persistent volume in the job named new-file. The volume already has the GitHub repo Hello-World saved on it. The job copies the README file to a new file and appends text.

This example assumes that an administrator has already configured a storage provisioner with a persistent volume available to your group.

version: v4
volumes:
  per_vol_1:
    use: my-provisioner
    name: my-persistent-volume
jobs:
  new-file:
    image:
      uri: docker://alpine
    mounts:
      /data: per_vol_1
    cwd: /data/Hello-World-master
    script: |
      #!/bin/sh
      cp README README.new && echo "(goodbye dear basement)" >>README.new
    resource:
      cpu:
        cores: 2
        affinity: NUMA
      memory:
        size: 2GB
Preview workflow in web UI

The example above uses the V4 syntax, where use names the provisioner and name names the volume on it. The previous (V1) syntax is still supported for backward compatibility. In V1, the equivalent would have been:

volumes:
  per_vol_1:
    reference: volume://user/<storage-class>/<volume-name>

Fuzzball rewrites that to use: <storage-class> and name: <volume-name> when the workflow is submitted, and warns if no provisioner of that name exists. The third path segment is what makes it persistent – a two-segment volume://user/<storage-class> reference upgrades to an ephemeral volume on that provisioner.

See Storage Volumes and Workflows for the full V4 volume syntax.

After the workflow completes successfully, you will find a new file on the persistent volume at /Hello-World-master/README.new with the following contents:

Hello World!
(goodbye dear basement)