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

Example 3. Reading and Writing Data on a Persistent Volume

Persistent Volumes can obviate the need for data ingress and egress. A persistent volume may already have the data needed to execute a workflow when it is mounted, and data can be written to the volume that will persist after the workflow has completed. In the following example, we mount a persistent volume to 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 created a storage volume called persistent. Since the storage volume has already been created and saved in the Fuzzball environment, we can simply reference it by scope (in this case user) and name as volume://user/persistent.

version: v1
volumes:
  per_vol_1:
    reference: volume://user/persistent
jobs:
  new-file:
    image:
      uri: docker://alpine
    mounts:
      per_vol_1:
        location: /data
    cwd: /data/Hello-World-master
    command:
      - /bin/sh
      - '-c'
      - cp README README.new && echo "(goodbye dear basement)" >>README.new
    resource:
      cpu:
        cores: 2
        affinity: NUMA
      memory:
        size: 2GB

After the workflow has completed successfully, there is a new file on our persistent volume located at /Hello-world-master/README.new with the following contents:

Hello World!
(goodbye dear basement)