Skip to main content

Volume

cc.volume

#

Creates or retrieves a persistent storage volume in Covalent Cloud. This function is used to manage volumes that provide persistent storage to workflow tasks, allowing them to read and write data across multiple workflow executions.

The volumes are user-specific and remain available indefinitely until explicitly deleted. They are especially useful for workflows that require access to large datasets or need to maintain state between different executions.

Parameters

name (str)-The name of the volume. This name is used to create a new volume or retrieve an existing one.

settings (Settings, optional) - Configuration settings for connecting to the Covalent Cloud. Defaults to None, which uses the default settings.

Returns

Volume : An object representing the created or retrieved volume.

Examples

import covalent_cloud as cc
import covalent as ct
from covalent_cloud import volume
# Creating a new volume
my_volume = cc.volume("/mydata") # This will create a new volume named "mydata" (if it does not already exist)
# Using the volume in a workflow
# Define the workflow (here it is a single task workflow)
@ct.lattice
@ct.electron
def my_workflow(x, y):
# All tasks here can access files in the path /volumes/mydata
pass
# Dispatch the workflow with the volume
run_id = cc.dispatch(my_workflow, volume=my_volume)(x=1, y=2)
# The workflow now has access to the "/mydata" volume for persistent storage.