Dataset Parameters
Copyright (C) 2023 Cadence Design Systems, Inc. (Cadence)
- class orionplatform.parameters.datasets.DatasetInputParameter(name: str | None = None, title: str | None = None, default=None, null: bool = False, help_text: str = '', promoted: bool = False, promoted_name: str | None = None, required: bool = False, hidden: bool = False, value=None, static: bool = False, max_value=None, min_value=None, max_length=None, choices=None, level='basic', description: str = '', many: bool = False, order: int | None = None)
Bases:
floe.api.parameters.BaseParameterDatasetInputParameter can be a single dataset IDENTIFIER, or a dictionary.
IDENTIFIERor
{SOURCE: [{ID_TYPE: IDENTIFIER, "records": [IDENTIFIER]}]}
Parameters:
IDENTIFIER an integer, or a path for a local file SOURCE "datasets" ID_TYPE "id" if in Orion, or "path" if local
Example - multiple Orion datasets with and without records specified:
{ "datasets": [ { "id": 135, }, { "id": 136, "records": [123, 45, 645] } ], }
Example - multiple local datasets (specifying records in local datasets is not supported):
{ "datasets": [ { "path": "100.oedb", }, { "path": "1000.oedb", } ], }
Example - mix of local datasets and orion datasets:
{ "datasets": [ { "path": "100.oedb", }, { "id": 814, }, ] }
- Returns:
orionplatform.parameters.DatasetStream
DatasetStreamcan be used as an iterator to get the records specified by the parameter.Python Example
from floe.api import SourceCube from orionplatform.ports import RecordOutputPort from orionplatform.parameters import DatasetInputParameter class ExampleCube(SourceCube): success = RecordOutputPort("success") data_in = DatasetInputParameter("data_in") def __iter__(self): for dataset in self.args.data_in: self.log.info("Outputting records for dataset {}", dataset.identifier) for rec in dataset.records(): yield record
- class orionplatform.parameters.datasets.DatasetOutputParameter(name: str | None = None, title: str | None = None, default=None, null: bool = False, help_text: str = '', promoted: bool = False, promoted_name: str | None = None, required: bool = False, hidden: bool = False, value=None, static: bool = False, max_value=None, min_value=None, max_length=None, choices=None, level='basic', description: str = '', many: bool = False, order: int | None = None)
Bases:
floe.api.parameters.BaseParameterParameter used to specify the name of a Dataset created within a Cube
- class orionplatform.parameters.datasets.DatasetStream(obj, session=None, required=False, fieldlist: List[str] | None = None)
Provides an iterator of wrappers around Datasets that provide the following utility:
identifier (property): either the Orion Id or local path
is_local (property): true if is reading from local file
records (method): returns fully constructed OEMolRecords
records_as_bytes (method): returns bytes that represent Records
The Datasets iterated over are defined by
DatasetInputParameter.DatasetStream is tightly coupled to
DatasetInputParameterand is not intended to be used separately.