queenbee.io.common module¶
common objects between different IO files.
- class queenbee.io.common.FromOutput(*, type: ConstrainedStrValue = 'FromOutput', annotations: Dict[str, Any] = None, name: str, description: str = None, **extra_data: Any)[source]¶
Bases:
GenericOutput
Base class for output classes that source
from
an object.See DAG output classes for more examples.
- from_: Any¶
- type: ConstrainedStrValue¶
- class queenbee.io.common.GenericInput(*, type: ConstrainedStrValue = 'GenericInput', annotations: Dict[str, Any] = None, name: str, description: str = None)[source]¶
Bases:
BaseModel
Base class for all input types.
- description: str¶
- property is_artifact¶
- property is_parameter¶
- name: str¶
- property referenced_values: Dict[str, List[str]]¶
Get all referenced values specified by var name.
- Returns:
- Dict[str, List[str]] – A dictionary where each key corresponds to a class
attribute indexing a list of referenced values.
- type: ConstrainedStrValue¶
- class queenbee.io.common.GenericOutput(*, type: ConstrainedStrValue = 'GenericOutput', annotations: Dict[str, Any] = None, name: str, description: str = None)[source]¶
Bases:
BaseModel
Base class for all output types.
The baseclass uses a name to source the output.
- description: str¶
- property is_artifact¶
- property is_parameter¶
- name: str¶
- type: ConstrainedStrValue¶
- class queenbee.io.common.IOAliasHandler(*, type: ConstrainedStrValue = 'IOAliasHandler', annotations: Dict[str, Any] = None, language: str, module: str, function: str, index: int = 0)[source]¶
Bases:
BaseModel
Input and output alias handler object.
- function: str¶
- index: int¶
- language: str¶
- module: str¶
- type: ConstrainedStrValue¶
- class queenbee.io.common.IOBase(*, type: ConstrainedStrValue = 'IOBase', annotations: Dict[str, Any] = None, inputs: List[Any] = None, outputs: List[Any] = None)[source]¶
Bases:
BaseModel
A reusable model for classes with Input and Output (IO) objects.
IOBase is the baseclass for Function, DAG and Workflow.
- artifact_input_by_name(name: str)[source]¶
Retrieve an artifact from the inputs by name
- Parameters:
for (name {str} -- The name to search) –
- Returns:
IOItem – An IO Item with the input name
- property artifact_inputs: List¶
Get input artifacts. Artifacts are file, folder and path inputs.
- Returns:
A list – A list of input artifacts.
- artifact_output_by_name(name: str)[source]¶
Retrieve an artifact from the outputs by name
- Parameters:
for (name {str} -- The name to search) –
- Returns:
IOItem – An IO Item with the input name
- property artifact_outputs: List¶
Get output artifacts. Artifacts are file, folder and path inputs.
- Returns:
A list – A list of output artifacts.
- property artifacts: Dict¶
Get input and output artifacts. Artifacts are file, folder and path inputs.
- Returns:
- Dict – A dictionary with two keys for inputs and outputs. Each key includes
a list of artifacts.
- inputs: List[Any]¶
- outputs: List[Any]¶
- parameter_input_by_name(name: str)[source]¶
Retrieve an parameter from the inputs by name
- Parameters:
for (name {str} -- The name to search) –
- Returns:
IOItem – An IO Item with the input name
- property parameter_inputs: List¶
Get input parameters. Parameters are non file, folder and path inputs.
- Returns:
A list – A list of input parameters.
- parameter_output_by_name(name: str)[source]¶
Retrieve an parameter from the outputs by name
- Parameters:
for (name {str} -- The name to search) –
- Returns:
IOItem – An IO Item with the input name
- property parameter_outputs: List¶
Get output parameters. Parameters are non file, folder and path inputs.
- Returns:
A list – A list of output parameters.
- classmethod parameter_unique_names(v)[source]¶
Pydantic validator to check that IO item names are unique within their list
- Parameters:
items (v {list} -- A list of) –
- Raises:
ValueError – Duplicate names have been found
- Returns:
list – The accepted list of items
- property parameters: Dict¶
Get input and output parameters.
- Returns:
- Dict – A dictionary with two keys for inputs and outputs. Each key includes
a list of parameters.
- classmethod sort_list(v)[source]¶
Pydantic validator to sort IO items by name
- Parameters:
items (v {list} -- A list of) –
- Returns:
list – The accepted list of items
- type: ConstrainedStrValue¶
- class queenbee.io.common.ItemType(value)[source]¶
Bases:
str
,Enum
Type enum for items in a list.
Items can not be files or folder. For a list of files you should copy them to a folder and use FolderInput input instead of using ArrayInput.
- Array = 'Array'¶
- Boolean = 'Boolean'¶
- Generic = 'Generic'¶
- Integer = 'Integer'¶
- JSONObject = 'JSONObject'¶
- Number = 'Number'¶
- String = 'String'¶
- class queenbee.io.common.PathOutput(*, type: ConstrainedStrValue = 'PathOutput', annotations: Dict[str, Any] = None, name: str, description: str = None, path: str, required: bool = True)[source]¶
Bases:
GenericOutput
Base class for output classes that source tha output from a path.
An example of using PathOutput is TaskFile and TaskFolder outputs.
- property is_optional¶
- path: str¶
- property referenced_values: Dict[str, List[str]]¶
Get referenced variables if any.
- Returns:
- Dict[str, List[str]] – A dictionary where keys are attributes and values
are lists contain referenced value string.
- required: bool¶
- type: ConstrainedStrValue¶
- queenbee.io.common.find_dup_items(values: List) List [source]¶
Find duplicate items in a list
- Parameters:
items (values {List} -- A list of) –
- Returns:
List – A list of duplicated items
- queenbee.io.common.find_io_by_name(input_list: list, name: str)[source]¶
Retrieve an item from a list by its name attribute
- Parameters:
Items (input_list {list} -- A list of IO) –
for (name {str} -- The name to filter) –
- Raises:
ValueError – No item with this name was found
- Returns:
IOItem – An IO Item with the input name