flowserv.model.parameter.base module

Base class for workflow template parameters. Each parameter has a set of properties that are used to (i) identify the parameter, (ii) define a nested parameter structure, and (iii) render UI forms to collect parameter values.

flowserv.model.parameter.base.OPTIONAL = ['label', 'help', 'defaultValue', 'group']

Unique parameter type identifier.

class flowserv.model.parameter.base.Parameter(dtype: str, name: str, index: Optional[int] = 0, label: Optional[str] = None, help: Optional[str] = None, default: Optional[Any] = None, required: Optional[bool] = False, group: Optional[str] = None)

Bases: object

Base class for template parameters. The base class maintains the unique parameter name, the data type identifier, the human-readable label and the description for display purposes, the is required flag, an optional default value, the index position for input form rendering, and the identifier for the parameter group.

Implementing classes have to provide a static .from_dict() method that returns an instance of the class from a dictionary serialization. The dictionary serializations for each class are generated by the .to_dict() method.

abstract cast(value: Any) Any

Validate the given argument value for the parameter type. Returns the argument representation for the value that is used to replace references to the parameter in workflow templates.

Raises an InvalidArgumentError if the given value is not valid for the parameter type.

Parameters

value (any) – User-provided value for a template parameter.

Return type

sting, float, or int

Raises

flowserv.error.InvalidArgumentError

display_name() str

Human-readable display name for the parameter. The default display name is the defined label. If no label is defined the parameter name is returned.

Return type

str

abstract static from_dict(cls, doc: Dict, validate: Optional[bool] = True) flowserv.model.parameter.base.Parameter

Get instance of implementing class from dictionary serialization.

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

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

Return type

flowserv.model.parameter.base.Parameter

Raises

flowserv.error.InvalidParameterError

is_actor() bool

Test if the parameter is of type Actor.

Return type

bool

is_bool() bool

Test if the parameter is of type Bool.

Return type

bool

is_file() bool

Test if the parameter is of type File.

Return type

bool

is_float() bool

Test if the parameter is of type Float.

Return type

bool

is_int() bool

Test if the parameter is of type Int.

Return type

bool

is_list() bool

Test if the parameter is of type Array.

Return type

bool

is_numeric() bool

Test if the parameter is of type Numeric.

Parameters

para (flowserv.model.parameter.base.Parameter) – Template parameter definition.

Return type

bool

is_record() bool

Test if the parameter is of type Record.

Return type

bool

is_select() bool

Test if the parameter is of type Select.

Return type

bool

is_string() bool

Test if the parameter is of type String.

Return type

bool

prompt() str

Get default input prompt for the parameter declaration. The prompt contains an indication of the data type, the parameter name and the default value (if defined).

Return type

string

to_dict() Dict

Get dictionary serialization for the parameter declaration. Implementing classes can add elements to the base dictionary.

Return type

dict

class flowserv.model.parameter.base.ParameterGroup(name: str, title: str, index: int)

Bases: object

Parameter groups are identifiable sets of parameters. These sets are primarily intended for display purposes in the front-end. Therefore, each group has a display name and an index position that defines the sort order for groups.

classmethod from_dict(doc, validate=True)

Create object instance from dictionary serialization.

Parameters
  • doc (dict) – Dictionary serialization for parameter group handles

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

Return type

flowserv.model.parameter.base.ParameterGroup

Raises

ValueError

to_dict()

Get dictionary serialization for parameter group handle.

Return type

dict