flowserv.model.parameter.files module

Declarations for file parameter values. A file parameter extends the base parameter class with a target path for the file when creating the workflow storage volume.

class flowserv.model.parameter.files.File(name: str, index: Optional[int] = 0, target: Optional[str] = None, label: Optional[str] = None, help: Optional[str] = None, default: Optional[bool] = None, required: Optional[bool] = False, group: Optional[str] = None)

Bases: flowserv.model.parameter.base.Parameter

File parameter type. Extends the base parameter with a target path for the file.

cast(value: Union[flowserv.volume.base.IOHandle, Tuple[flowserv.volume.base.IOHandle, str]])

Get an instance of the InputFile class for a given argument value. The input value can either be a string (filename) or a dictionary.

Parameters

value (tuple of flowserv.volume.base.IOHandle, str) – Handle for a file object andoptional user-provided target path. If the target path is None the defined target path is used or the defined default value. If neither is given an error is raised.

Return type

flowserv.model.parameter.files.InputFile

Raises
static from_dict(doc: Dict, validate: bool = True) flowserv.model.parameter.files.File

Get file parameter instance from a dictionary serialization.

Parameters
  • doc (dict) – Dictionary serialization for file parameter declaration.

  • validate (bool, default=True) – Validate the serialized object if True.

Return type

flowserv.model.parameter.files.File

Raises

flowserv.error.InvalidParameterError

to_dict() Dict

Get dictionary serialization for the parameter declaration. Adds target path to the base serialization.

Return type

dict

class flowserv.model.parameter.files.IOValue(target: str)

Bases: object

The IO value represents the value for a template parameter of type ‘file’. Implementations will either represent single input files or directories. The copy method is used to store the input object in the target storage volume for workflow runs.

abstract copy(target: flowserv.volume.base.StorageVolume) List[str]

Copy the input(s) to the given target storage volume.

Returns the list of copied files.

Return type

list of string

class flowserv.model.parameter.files.InputDirectory(store: flowserv.volume.base.StorageVolume, target: str, source: Optional[str] = None)

Bases: flowserv.model.parameter.files.IOValue

Implementation of the IOValue class for template parameter values that represents a directory on a storage volume. The copy method will copy the complete folder to the tartget volume for a workflow run.

copy(target: flowserv.volume.base.StorageVolume) List[str]

Copy the file object to the target volume.

Return type

list of string

class flowserv.model.parameter.files.InputFile(source: flowserv.volume.base.IOHandle, target: str)

Bases: flowserv.model.parameter.files.IOValue

Implementation of the IOValue class for template parameter values that are a single file. Maintains the IOHandle for an input file that can be copied to the tartget volume for a workflow run.

copy(target: flowserv.volume.base.StorageVolume) List[str]

Copy the file object to the target volume.

Return type

list of string