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 configured a storage provisioner with a persistent volume available to your group.
The example above uses the V4 syntax. The previous (V1) synstax is still supported for backwards compatibility. In V1, the equivalent syntax would have looked like the following:
volumes:
per_vol_1:
reference: volume://user/<storage-class>
See Storage Volumes and Workflows for the full V4 volume syntax.
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)