Dataset Parameters

class orionplatform.parameters.datasets.DatasetInputParameter(name: Optional[str] = None, title: Optional[str] = None, default=None, null: bool = False, help_text: str = '', promoted: bool = False, promoted_name: Optional[str] = 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: Optional[int] = None)

Bases: floe.api.parameters.BaseParameter

DatasetInputParameter can be a single dataset IDENTIFIER, or a dictionary.

IDENTIFIER

or

{SOURCE: [{ID_TYPE: IDENTIFIER, "records": [IDENTIFIER]}]}
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

DatasetStream can 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: Optional[str] = None, title: Optional[str] = None, default=None, null: bool = False, help_text: str = '', promoted: bool = False, promoted_name: Optional[str] = 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: Optional[int] = None)

Bases: floe.api.parameters.BaseParameter

Parameter used to specify the name of a Dataset created within a Cube

class orionplatform.parameters.datasets.DatasetStream(obj, session=None, required=False)

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 DatasetInputParameter and is not intended to be used separately.