Skip to content

OrchestrationContext.call_entity does not provide any way to specify type for expected output #90

@larohra

Description

@larohra

The call_entity method currently returns Task[Unknown] that can break type-safety. Ideally, the call_entity method should provide a way to specify the type of the expected output (similar to how call_activity does (using TOutput) -

@abstractmethod
    def call_activity(self, activity: Union[Activity[TInput, TOutput], str], *,
                      input: Optional[TInput] = None,
                      retry_policy: Optional[RetryPolicy] = None,
                      tags: Optional[dict[str, str]] = None) -> Task[TOutput]:
        """Schedule an activity for execution.

        Parameters
        ----------
        activity: Union[Activity[TInput, TOutput], str]
            A reference to the activity function to call.
        input: Optional[TInput]
            The JSON-serializable input (or None) to pass to the activity.
        retry_policy: Optional[RetryPolicy]
            The retry policy to use for this activity call.
        tags: Optional[dict[str, str]]
            Optional tags to associate with the activity invocation.

        Returns
        -------
        Task
            A Durable Task that completes when the called activity function completes or fails.
        """
        pass

    @abstractmethod
    def call_entity(self, entity: EntityInstanceId,
                    operation: str,
                    input: Optional[TInput] = None) -> Task:
        """Schedule entity function for execution.

        Parameters
        ----------
        entity: EntityInstanceId
            The ID of the entity instance to call.
        operation: str
            The name of the operation to invoke on the entity.
        input: Optional[TInput]
            The optional JSON-serializable input to pass to the entity function.

        Returns
        -------
        Task
            A Durable Task that completes when the called entity function completes or fails.
        """
        pass

Error -

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions