Skip to content

itransformationstrategy

Tranformation Strategy Interface

ITransformationStrategy dataclass

Bases: Protocol

Transformation Strategy Interface.

Source code in oteapi/interfaces/itransformationstrategy.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@dataclass  # type: ignore[misc]
class ITransformationStrategy(Protocol):
    """Transformation Strategy Interface."""

    transformation_config: "TransformationConfig"

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

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            An update model of key/value-pairs to be stored in the
            session-specific context from services.
            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) -> "SessionUpdate":
        """Execute the strategy.

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            An update model of key/value-pairs to be stored in the
            session-specific context from services.

        """

    def initialize(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
        """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:
            An update model of key/value-pairs to be stored in the
            session-specific context from services.

        """

get(session=None)

Execute the strategy.

Parameters:

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

A session-specific dictionary context.

None

Returns:

Type Description
SessionUpdate

An update model of key/value-pairs to be stored in the

SessionUpdate

session-specific context from services.

Source code in oteapi/interfaces/itransformationstrategy.py
42
43
44
45
46
47
48
49
50
51
52
def get(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
    """Execute the strategy.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        An update model of key/value-pairs to be stored in the
        session-specific context from services.

    """

initialize(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
SessionUpdate

An update model of key/value-pairs to be stored in the

SessionUpdate

session-specific context from services.

Source code in oteapi/interfaces/itransformationstrategy.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def initialize(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
    """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:
        An update model of key/value-pairs to be stored in the
        session-specific context from services.

    """

run(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
SessionUpdate

An update model of key/value-pairs to be stored in the

SessionUpdate

session-specific context from services.

SessionUpdate

As a minimum, the dictionary will contain the job ID.

Source code in oteapi/interfaces/itransformationstrategy.py
17
18
19
20
21
22
23
24
25
26
27
28
def run(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
    """Run a transformation job.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        An update model of key/value-pairs to be stored in the
        session-specific context from services.
        As a minimum, the dictionary will contain the job ID.

    """

status(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

TransformationStatus

metadata.

Source code in oteapi/interfaces/itransformationstrategy.py
30
31
32
33
34
35
36
37
38
39
40
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.

    """