File tree Expand file tree Collapse file tree 5 files changed +23
-9
lines changed
durabletask-azurefunctions/durabletask/azurefunctions Expand file tree Collapse file tree 5 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 1+ # Copyright (c) Microsoft Corporation.
2+ # Licensed under the MIT License.
Original file line number Diff line number Diff line change 11# Copyright (c) Microsoft Corporation. All rights reserved.
22# Licensed under the MIT License.
3+
34import base64
45from functools import wraps
56
@@ -76,7 +77,16 @@ def stub_complete(stub_response):
7677 nonlocal response
7778 response = stub_response
7879 stub .CompleteOrchestratorTask = stub_complete
79- execution_started_events = [e for e in [e1 for e1 in request .newEvents ] + [e2 for e2 in request .pastEvents ] if e .HasField ("executionStarted" )]
80+ execution_started_events = []
81+ for e in request .pastEvents :
82+ if e .HasField ("executionStarted" ):
83+ execution_started_events .append (e )
84+ for e in request .newEvents :
85+ if e .HasField ("executionStarted" ):
86+ execution_started_events .append (e )
87+ if len (execution_started_events ) == 0 :
88+ raise Exception ("No ExecutionStarted event found in orchestration request." )
89+
8090 function_name = execution_started_events [- 1 ].executionStarted .name
8191 worker .add_named_orchestrator (function_name , orchestrator_func )
8292 worker ._execute_orchestrator (request , stub , None )
Original file line number Diff line number Diff line change 1+ # Copyright (c) Microsoft Corporation.
2+ # Licensed under the MIT License.
13
24from durabletask .internal .ProtoTaskHubSidecarServiceStub import ProtoTaskHubSidecarServiceStub
35
46
57class AzureFunctionsNullStub (ProtoTaskHubSidecarServiceStub ):
6- """Missing associated documentation comment in .proto file ."""
8+ """A task hub sidecar stub class that implements all methods as no-ops ."""
79
810 def __init__ (self ):
911 """Constructor.
10-
11- Args:
12- channel: A grpc.Channel.
1312 """
1413 self .Hello = lambda * args , ** kwargs : None
1514 self .StartInstance = lambda * args , ** kwargs : None
Original file line number Diff line number Diff line change 99
1010# Worker class used for Durable Task Scheduler (DTS)
1111class DurableFunctionsWorker (TaskHubGrpcWorker ):
12- """TOOD : Docs
12+ """TODO : Docs
1313 """
1414
1515 def __init__ (self ):
@@ -27,6 +27,6 @@ def __init__(self):
2727 self ._interceptors = None
2828
2929 def add_named_orchestrator (self , name : str , func ):
30- """TOOD : Docs
30+ """TODO : Docs
3131 """
3232 self ._registry .add_named_orchestrator (name , func )
Original file line number Diff line number Diff line change 1- from typing import Any , Callable
1+ from typing import Callable
22
33
44class ProtoTaskHubSidecarServiceStub (object ):
5- """TODO: Docs"""
5+ """A stub class roughly matching the TaskHubSidecarServiceStub generated from the .proto file.
6+ Used by Azure Functions during orchestration and entity executions to inject custom behavior,
7+ as no real sidecar stub is available.
8+ """
69
710 def __init__ (self ):
811 """Constructor.
You can’t perform that action at this time.
0 commit comments