-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from eccenca/feature/pluginSchemata-CMEM-4791
Allow workflow plugins to specify their input and output ports (CMEM-4791)
- Loading branch information
Showing
4 changed files
with
73 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Workflow operator input and output ports.""" | ||
|
||
from typing import Sequence | ||
from cmem_plugin_base.dataintegration.entity import EntitySchema | ||
|
||
|
||
class Port: | ||
"""Specifies the type of input or output ports.""" | ||
|
||
|
||
class FixedSchemaPort(Port): | ||
"""Input or output port that has a fixed schema.""" | ||
|
||
def __init__(self, schema: EntitySchema): | ||
self.schema = schema | ||
|
||
|
||
class FlexibleSchemaPort(Port): | ||
"""Port that does not have a fixed schema, but will adapt its schema to the | ||
connected port. | ||
Flexible input ports will adapt the schema to the connected output. | ||
Flexible output ports will adapt the schema to the connected input. | ||
It is not allowed to connect two flexible ports.""" | ||
|
||
|
||
class UnknownSchemaPort(Port): | ||
"""Port for which the schema is not known in advance. | ||
This includes output ports with a schema that depends on external factors | ||
(e.g., REST requests).""" | ||
|
||
|
||
class InputPorts: | ||
"""Specifies the input ports of a workflow operator.""" | ||
|
||
|
||
class FixedNumberOfInputs(InputPorts): | ||
"""Operator accepts a fixed number of inputs.""" | ||
|
||
def __init__(self, ports: Sequence[Port]): | ||
self.ports = ports | ||
|
||
|
||
class FlexibleNumberOfInputs(InputPorts): | ||
"""Operator accepts a flexible number of inputs. | ||
At the moment, each input is a flexible schema port.""" |