Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

DynamicInputs

Dynamic input specification that allows tasks to have a variable number of input ports.

This class enables tasks to accept a dynamic number of input resources that can be added or removed at runtime. All input resources are aggregated into a single ResourceList that is passed to the task under the name specified by SPEC_NAME ('source').

Dynamic inputs are useful for tasks that need to process an arbitrary number of similar resources, such as merging multiple files or combining multiple datasets.

Attributes: SPEC_NAME: The name of the input parameter passed to the task ('source'). This is the key under which the aggregated ResourceList will be available. additionnal_port_spec: Optional specification that defines the type and constraints for dynamically created input ports. If None, defaults to accepting any Resource type.

Example: ```python # Define dynamic inputs that accept Table resources inputs = DynamicInputs( additionnal_port_spec=InputSpec(Table, human_name="Input table") )

# In the task's run method:
def run(self, params: ConfigParams, inputs: InputsDTO) -> OutputsDTO:
    # Access all inputs as a ResourceList
    sources: ResourceList = inputs['source']
    # Process each table
    for table in sources:
        # Process table...
```
Attributes
additionnal_port_spec: gws_core.io.io_spec.InputSpec | None
Functions
__init__
default_specs : dict[str, gws_core.io.io_spec.InputSpec] | None
default specs used when creating the inputs
additionnal_port_spec : gws_core.io.io_spec.InputSpec | None
force the type of newly created port
check_and_build_inputs

Check and convert input to TaskInputs

inputs : dict
Return type : TaskInputs
get_additional_info
Return type : dict
get_default_spec
Return type : InputSpec
get_first_spec
Return type : gws_core.io.io_spec.IOSpec | None
get_spec
name : str
Return type : IOSpec
get_specs
Return type : dict
get_type
Return type : Literal
has_spec
name : str
Return type : bool
set_additional_info
additional_info : dict | None
to_dto
Return type : IOSpecsDTO
from_dto @classmethod
io_specs : dict
additional_info : dict | None
Return type : DynamicInputs
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.