DynamicOutputs
Dynamic output specification that allows tasks to have a variable number of output ports.
This class enables tasks to produce a variable number of output resources that can be defined at runtime. The task should return an iterable of resources under the name specified by SPEC_NAME ('target'), which will be automatically distributed to the individual output ports based on their order.
Dynamic outputs are useful for tasks that produce an unpredictable number of results, such as splitting a file into multiple parts or generating multiple datasets from a single analysis.
Attributes: SPEC_NAME: The name of the output parameter the task should return ('target'). The task must return an iterable of resources under this key. additionnal_port_spec: Optional specification that defines the type and constraints for dynamically created output ports. If None, defaults to accepting any Resource subclass.
Example: ```python # Define dynamic outputs that produce Table resources outputs = DynamicOutputs( additionnal_port_spec=OutputSpec(Table, human_name="Output table") )
# In the task's run method:
def run(self, params: ConfigParams, inputs: InputsDTO) -> OutputsDTO:
# Create multiple output tables
tables = [table1, table2, table3]
# Return as an iterable under 'target'
return {'target': tables}
```
Notes: - The number of resources in the returned iterable must not exceed the number of configured output ports. - Resources are assigned to ports based on their order in the iterable and the order of the port keys. - If fewer resources are returned than there are ports, remaining ports will be empty.
additionnal_port_spec: gws_core.io.io_spec.OutputSpec | Nonedict[str, gws_core.io.io_spec.OutputSpec] | Nonegws_core.io.io_spec.OutputSpec | NoneMethod that check if the task outputs
dictOutputsCheckResultdictOutputSpecgws_core.io.io_spec.IOSpec | NonestrIOSpecdictLiteralstrbooldict | NoneIOSpecsDTOdictdict | NoneDynamicOutputs