Collection Parameters

Copyright (C) 2023 Cadence Design Systems, Inc. (Cadence)

class orionplatform.parameters.collections.CollectionInputParameter(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

CollectionInputParameter can be a single collection IDENTIFIER, or a dictionary. Collections refer to data in Orion, using Collections will require an authenticated OrionSession.

IDENTIFIER

or

{SOURCE: [{"id": IDENTIFIER, "shards": [IDENTIFIER]}]}

Parameters:

IDENTIFIER
    an integer

SOURCE
    "collections"

Example:

{
  "collections": [
    {
      "id": 9,
    },
    {
      "id": 10,
      "shards": [1, 5, 7]
    },
  ]
}
Returns

orionplatform.parameters.CollectionStream

CollectionStream can be used as an iterator to get the collections or shards specified by the parameter.

Accessing Collections

from floe.api import SourceCube
from orionplatform.ports import CollectionOutputPort
from orionplatform.parameters import CollectionInputParameter


class ExampleCube(SourceCube):

    success = CollectionOutputPort("success")

    collection_source = CollectionInputParameter("collection_source")

    def __iter__(self):
        for collection in self.args.collection_source:
            yield collection

Accessing Shards

from floe.api import SourceCube
from orionplatform.ports import ShardOutputPort
from orionplatform.parameters import CollectionInputParameter


class ExampleCube(SourceCube):

    success = ShardOutputPort("success")

    collection_source = CollectionInputParameter("collection_source")

    def __iter__(self):
        for shard in self.args.collection_source.shards():
            yield shard
class orionplatform.parameters.collections.CollectionOutputParameter(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 Collection created within a Cube

class orionplatform.parameters.collections.CollectionStream(obj, session=None, required=False, fieldlist: Optional[List[str]] = None)

Iterate over collections and shards described by CollectionInputParameter.

By default, CollectionStream iterates over the shards in the SHARD_READY state in a list of collections.

CollectionStream is tightly coupled to CollectionInputParameter and is not intended to be used separately.

collections()

Iterate over a list of collections

shards(state='ready')

Iterate over the shards in a list of collections. By default, only shards in the orionplatform.constants.SHARD_READY state are emitted. Valid orionplatform.constants.SHARD_STATES include: orionplatform.constants.SHARD_READY, orionplatform.constants.SHARD_ERROR, orionplatform.constants.SHARD_OPEN, orionplatform.constants.SHARD_TEMPORARY