Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, taskHubName: str, creationUrls: Dict[str, str],
self._task_hub_name: str = taskHubName
self._creation_urls: Dict[str, str] = creationUrls
self._management_urls: Dict[str, str] = managementUrls
# TODO: we can remove this once we drop support for 1.x, this is always provided in 2.x
self._rpc_base_url: Optional[str] = rpcBaseUrl
self._client_data = FunctionContext(**kwargs)

Expand Down
15 changes: 7 additions & 8 deletions azure/durable_functions/models/DurableOrchestrationClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from .OrchestrationRuntimeStatus import OrchestrationRuntimeStatus
from ..models.DurableOrchestrationBindings import DurableOrchestrationBindings
from .utils.http_utils import get_async_request, post_async_request, delete_async_request
from .utils.type_aliases import SerializableToJSON
from azure.functions._durable_functions import _serialize_custom_object


Expand Down Expand Up @@ -46,7 +45,7 @@ def __init__(self, context: str):
async def start_new(self,
orchestration_function_name: str,
instance_id: Optional[str] = None,
client_input: Optional[SerializableToJSON] = None) -> str:
client_input: Optional[Any] = None) -> str:
"""Start a new instance of the specified orchestrator function.

If an orchestration instance with the specified ID already exists, the
Expand All @@ -70,7 +69,7 @@ async def start_new(self,
request_url = self._get_start_new_url(
instance_id=instance_id, orchestration_function_name=orchestration_function_name)

response: List[SerializableToJSON] = await self._post_async_request(
response: List[Any] = await self._post_async_request(
request_url, self._get_json_input(client_input))

status_code: int = response[0]
Expand All @@ -84,7 +83,7 @@ async def start_new(self,
else:
# Catch all: simply surfacing the durable-extension exception
# we surface the stack trace too, since this may be a more involed exception
ex_message: SerializableToJSON = response[1]
ex_message: Any = response[1]
raise Exception(ex_message)

def create_check_status_response(
Expand Down Expand Up @@ -160,7 +159,7 @@ def get_client_response_links(
return payload

async def raise_event(
self, instance_id: str, event_name: str, event_data: SerializableToJSON = None,
self, instance_id: str, event_name: str, event_data: Any = None,
task_hub_name: str = None, connection_name: str = None) -> None:
"""Send an event notification message to a waiting orchestration instance.

Expand Down Expand Up @@ -188,7 +187,7 @@ async def raise_event(
Raises an exception if the status code is 404 or 400 when raising the event.
"""
if event_name == "":
raise ValueError("event_name must be a valid string.")
raise ValueError("event_name must be a non-empty string.")

request_url = self._get_raise_event_url(
instance_id, event_name, task_hub_name, connection_name)
Expand Down Expand Up @@ -272,7 +271,7 @@ async def get_status_all(self) -> List[DurableOrchestrationStatus]:
if error_message:
raise Exception(error_message)
else:
statuses: List[SerializableToJSON] = response[1]
statuses: List[Any] = response[1]
return [DurableOrchestrationStatus.from_json(o) for o in statuses]

async def get_status_by(self, created_time_from: datetime = None,
Expand Down Expand Up @@ -460,7 +459,7 @@ async def wait_for_completion_or_create_check_status_response(

@staticmethod
def _create_http_response(
status_code: int, body: Union[str, SerializableToJSON]) -> func.HttpResponse:
status_code: int, body: Union[str, Any]) -> func.HttpResponse:
body_as_json = body if isinstance(body, str) else json.dumps(body)
response_args = {
"status_code": status_code,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, name: Optional[str] = None, instanceId: Optional[str] = None,
if lastUpdatedTime is not None else None
self._input: Any = input
self._output: Any = output
self._runtime_status: Optional[str] = runtimeStatus
self._runtime_status: Optional[str] = runtimeStatus # TODO: GH issue 178
self._custom_status: Any = customStatus
self._history: Optional[List[Any]] = history
if kwargs is not None:
Expand Down
1 change: 0 additions & 1 deletion azure/durable_functions/models/RpcManagementOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def to_url(self, base_url: Optional[str]) -> str:
The Url used to get orchestration status information
"""
if base_url is None:
# TODO: In JS we manage a "legacy app frontend code path. Here too?"
raise ValueError("orchestration bindings has not RPC base url")

url = f"{base_url}instances/{self._instance_id if self._instance_id else ''}"
Expand Down
4 changes: 0 additions & 4 deletions azure/durable_functions/models/utils/type_aliases.py

This file was deleted.

7 changes: 6 additions & 1 deletion azure/durable_functions/tasks/new_uuid.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from uuid import uuid5, NAMESPACE_OID

from azure.durable_functions.constants import DATETIME_STRING_FORMAT
import typing

if typing.TYPE_CHECKING:
from azure.durable_functions.models.DurableOrchestrationContext \
import DurableOrchestrationContext

URL_NAMESPACE: str = "9e952958-5e33-4daf-827f-2fa12937b875"

Expand All @@ -10,7 +15,7 @@ def _create_deterministic_uuid(namespace_value: str, name: str) -> str:
return str(uuid5(namespace_uuid, name))


def new_uuid(context) -> str:
def new_uuid(context: 'DurableOrchestrationContext') -> str:
"""Create a new UUID that is safe for replay within an orchestration or operation.

The default implementation of this method creates a name-based UUID
Expand Down