in azure/durable_functions/models/DurableOrchestrationContext.py [0:0]
def call_sub_orchestrator(self,
name: Union[str, Callable], input_: Optional[Any] = None,
instance_id: Optional[str] = None) -> TaskBase:
"""Schedule sub-orchestration function named `name` for execution.
Parameters
----------
name: Union[str, Callable]
The name of the orchestrator function to call.
input_: Optional[Any]
The JSON-serializable input to pass to the orchestrator function.
instance_id: Optional[str]
A unique ID to use for the sub-orchestration instance.
Returns
-------
Task
A Durable Task that completes when the called sub-orchestrator completes or fails.
"""
if isinstance(name, Callable) and not isinstance(name, FunctionBuilder):
error_message = "The `call_activity` API received a `Callable` without an "\
"associated Azure Functions trigger-type. "\
"Please ensure you're using the Python programming model V2 "\
"and that your activity function is annotated with the `activity_trigger`"\
"decorator. Otherwise, provide in the name of the activity as a string."
raise ValueError(error_message)
if isinstance(name, FunctionBuilder):
name = self._get_function_name(name, OrchestrationTrigger)
action = CallSubOrchestratorAction(name, input_, instance_id)
task = self._generate_task(action)
return task