Skip to content

itransformationstrategy

Tranformation Strategy Interface

ITransformationStrategy (Protocol) dataclass

Transformation Strategy Interface.

Source code in oteapi/interfaces/itransformationstrategy.py
@dataclass  # type: ignore[misc]
@runtime_checkable
class ITransformationStrategy(Protocol):
    """Transformation Strategy Interface."""

    transformation_config: "TransformationConfig"

    def run(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
        """Run a transformation job.

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            Dictionary of key/value-pairs to be stored in the sessions-specific
            dictionary context.
            As a minimum, the dictionary will contain the job ID.

        """

    def status(self, task_id: str) -> "TransformationStatus":
        """Get job status.

        Parameters:
            task_id: The transformation job ID.

        Returns:
            An overview of the transformation job's status, including relevant
            metadata.

        """

    def get(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
        """Execute the strategy.

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            Dictionary of key/value-pairs to be stored in the sessions-specific
            dictionary context.

        """

    def initialize(
        self, session: "Optional[Dict[str, Any]]" = None
    ) -> "Dict[str, Any]":
        """Initialize data class.

        This method will be called through the `/initialize` endpoint of the OTE-API
        Services.

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            Dictionary of key/value-pairs to be stored in the sessions-specific
            dictionary context.

        """

get(self, session=None)

Execute the strategy.

Parameters:

Name Type Description Default
session Optional[Dict[str, Any]]

A session-specific dictionary context.

None

Returns:

Type Description
Dict[str, Any]

Dictionary of key/value-pairs to be stored in the sessions-specific dictionary context.

Source code in oteapi/interfaces/itransformationstrategy.py
def get(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
    """Execute the strategy.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        Dictionary of key/value-pairs to be stored in the sessions-specific
        dictionary context.

    """

initialize(self, session=None)

Initialize data class.

This method will be called through the /initialize endpoint of the OTE-API Services.

Parameters:

Name Type Description Default
session Optional[Dict[str, Any]]

A session-specific dictionary context.

None

Returns:

Type Description
Dict[str, Any]

Dictionary of key/value-pairs to be stored in the sessions-specific dictionary context.

Source code in oteapi/interfaces/itransformationstrategy.py
def initialize(
    self, session: "Optional[Dict[str, Any]]" = None
) -> "Dict[str, Any]":
    """Initialize data class.

    This method will be called through the `/initialize` endpoint of the OTE-API
    Services.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        Dictionary of key/value-pairs to be stored in the sessions-specific
        dictionary context.

    """

run(self, session=None)

Run a transformation job.

Parameters:

Name Type Description Default
session Optional[Dict[str, Any]]

A session-specific dictionary context.

None

Returns:

Type Description
Dict[str, Any]

Dictionary of key/value-pairs to be stored in the sessions-specific dictionary context. As a minimum, the dictionary will contain the job ID.

Source code in oteapi/interfaces/itransformationstrategy.py
def run(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
    """Run a transformation job.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        Dictionary of key/value-pairs to be stored in the sessions-specific
        dictionary context.
        As a minimum, the dictionary will contain the job ID.

    """

status(self, task_id)

Get job status.

Parameters:

Name Type Description Default
task_id str

The transformation job ID.

required

Returns:

Type Description
TransformationStatus

An overview of the transformation job's status, including relevant metadata.

Source code in oteapi/interfaces/itransformationstrategy.py
def status(self, task_id: str) -> "TransformationStatus":
    """Get job status.

    Parameters:
        task_id: The transformation job ID.

    Returns:
        An overview of the transformation job's status, including relevant
        metadata.

    """
Back to top