Skip to content

Commit fde02c5

Browse files
committed
Update to match changes in functions SDK
1 parent 827d201 commit fde02c5

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

durabletask-azurefunctions/durabletask/azurefunctions/decorators/durable_app.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
from functools import wraps
55

6+
from durabletask import task
7+
68
from .metadata import OrchestrationTrigger, ActivityTrigger, EntityTrigger, \
79
DurableClient
810
from typing import Callable, Optional
@@ -54,7 +56,7 @@ def _configure_orchestrator_callable(self, wrap) -> Callable:
5456
The function to construct an Orchestrator class from the user-defined Function,
5557
wrapped by the next decorator in the sequence.
5658
"""
57-
def decorator(orchestrator_func):
59+
def decorator(orchestrator_func: task.Orchestrator):
5860
# Construct an orchestrator based on the end-user code
5961

6062
def handle(context) -> str:
@@ -82,7 +84,7 @@ def _configure_entity_callable(self, wrap) -> Callable:
8284
The function to construct an Entity class from the user-defined Function,
8385
wrapped by the next decorator in the sequence.
8486
"""
85-
def decorator(entity_func):
87+
def decorator(entity_func: task.Entity):
8688
# Construct an orchestrator based on the end-user code
8789

8890
# TODO: Because this handle method is the one actually exposed to the Functions SDK decorator,
@@ -177,7 +179,8 @@ def decorator():
177179

178180
return wrap
179181

180-
def entity_trigger(self, context_name: str,
182+
def entity_trigger(self,
183+
context_name: str,
181184
entity_name: Optional[str] = None):
182185
"""Register an Entity Function.
183186
@@ -228,7 +231,7 @@ def durable_client_input(self,
228231
@self._configure_function_builder
229232
def wrap(fb):
230233
def decorator():
231-
self._add_rich_client(fb, client_name, DurableFunctionsClient)
234+
# self._add_rich_client(fb, client_name, DurableFunctionsClient)
232235

233236
fb.add_binding(
234237
binding=DurableClient(name=client_name,

durabletask-azurefunctions/durabletask/azurefunctions/worker.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import base64
55
from threading import Event
66
from typing import Optional
7+
from durabletask import task
78
from durabletask.internal.orchestrator_service_pb2 import EntityBatchRequest, EntityBatchResult, OrchestratorRequest, OrchestratorResponse
89
from durabletask.worker import _Registry, ConcurrencyOptions
910
from durabletask.internal import shared
@@ -33,10 +34,10 @@ def __init__(self):
3334

3435
self._interceptors = None
3536

36-
def add_named_orchestrator(self, name: str, func):
37+
def add_named_orchestrator(self, name: str, func: task.Orchestrator):
3738
self._registry.add_named_orchestrator(name, func)
3839

39-
def _execute_orchestrator(self, func, context) -> str:
40+
def _execute_orchestrator(self, func: task.Orchestrator, context) -> str:
4041
context_body = getattr(context, "body", None)
4142
if context_body is None:
4243
context_body = context
@@ -67,9 +68,9 @@ def stub_complete(stub_response):
6768
if response is None:
6869
raise Exception("Orchestrator execution did not produce a response.")
6970
# The Python worker returns the input as type "json", so double-encoding is necessary
70-
return '"' + base64.b64encode(response.SerializeToString()).decode('utf-8') + '"'
71+
return base64.b64encode(response.SerializeToString()).decode('utf-8')
7172

72-
def _execute_entity_batch(self, func, context) -> str:
73+
def _execute_entity_batch(self, func: task.Entity, context) -> str:
7374
context_body = getattr(context, "body", None)
7475
if context_body is None:
7576
context_body = context
@@ -90,4 +91,4 @@ def stub_complete(stub_response: EntityBatchResult):
9091
if response is None:
9192
raise Exception("Entity execution did not produce a response.")
9293
# The Python worker returns the input as type "json", so double-encoding is necessary
93-
return '"' + base64.b64encode(response.SerializeToString()).decode('utf-8') + '"'
94+
return base64.b64encode(response.SerializeToString()).decode('utf-8')

durabletask-azurefunctions/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ readme = "README.md"
2929
dependencies = [
3030
"durabletask>=1.2.0dev0",
3131
"azure-identity>=1.19.0",
32-
"azure-functions>=1.11.0"
32+
"azure-functions>=1.25.0b3.dev1"
3333
]
3434

3535
[project.urls]

0 commit comments

Comments
 (0)