azure-functions-durable 1.2.9__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/durable_functions/__init__.py +81 -81
- azure/durable_functions/constants.py +9 -9
- azure/durable_functions/decorators/__init__.py +3 -3
- azure/durable_functions/decorators/durable_app.py +260 -249
- azure/durable_functions/decorators/metadata.py +109 -109
- azure/durable_functions/entity.py +129 -125
- azure/durable_functions/models/DurableEntityContext.py +201 -201
- azure/durable_functions/models/DurableHttpRequest.py +58 -58
- azure/durable_functions/models/DurableOrchestrationBindings.py +66 -66
- azure/durable_functions/models/DurableOrchestrationClient.py +812 -781
- azure/durable_functions/models/DurableOrchestrationContext.py +761 -707
- azure/durable_functions/models/DurableOrchestrationStatus.py +156 -156
- azure/durable_functions/models/EntityStateResponse.py +23 -23
- azure/durable_functions/models/FunctionContext.py +7 -7
- azure/durable_functions/models/OrchestrationRuntimeStatus.py +32 -32
- azure/durable_functions/models/OrchestratorState.py +117 -116
- azure/durable_functions/models/PurgeHistoryResult.py +33 -33
- azure/durable_functions/models/ReplaySchema.py +9 -8
- azure/durable_functions/models/RetryOptions.py +69 -69
- azure/durable_functions/models/RpcManagementOptions.py +86 -86
- azure/durable_functions/models/Task.py +540 -426
- azure/durable_functions/models/TaskOrchestrationExecutor.py +352 -336
- azure/durable_functions/models/TokenSource.py +56 -56
- azure/durable_functions/models/__init__.py +26 -24
- azure/durable_functions/models/actions/Action.py +23 -23
- azure/durable_functions/models/actions/ActionType.py +18 -18
- azure/durable_functions/models/actions/CallActivityAction.py +41 -41
- azure/durable_functions/models/actions/CallActivityWithRetryAction.py +45 -45
- azure/durable_functions/models/actions/CallEntityAction.py +46 -46
- azure/durable_functions/models/actions/CallHttpAction.py +35 -35
- azure/durable_functions/models/actions/CallSubOrchestratorAction.py +40 -40
- azure/durable_functions/models/actions/CallSubOrchestratorWithRetryAction.py +44 -44
- azure/durable_functions/models/actions/CompoundAction.py +35 -35
- azure/durable_functions/models/actions/ContinueAsNewAction.py +36 -36
- azure/durable_functions/models/actions/CreateTimerAction.py +48 -48
- azure/durable_functions/models/actions/NoOpAction.py +35 -35
- azure/durable_functions/models/actions/SignalEntityAction.py +47 -47
- azure/durable_functions/models/actions/WaitForExternalEventAction.py +63 -63
- azure/durable_functions/models/actions/WhenAllAction.py +14 -14
- azure/durable_functions/models/actions/WhenAnyAction.py +14 -14
- azure/durable_functions/models/actions/__init__.py +24 -24
- azure/durable_functions/models/entities/EntityState.py +74 -74
- azure/durable_functions/models/entities/OperationResult.py +94 -76
- azure/durable_functions/models/entities/RequestMessage.py +53 -53
- azure/durable_functions/models/entities/ResponseMessage.py +48 -48
- azure/durable_functions/models/entities/Signal.py +62 -62
- azure/durable_functions/models/entities/__init__.py +17 -17
- azure/durable_functions/models/history/HistoryEvent.py +92 -92
- azure/durable_functions/models/history/HistoryEventType.py +27 -27
- azure/durable_functions/models/history/__init__.py +8 -8
- azure/durable_functions/models/utils/__init__.py +7 -7
- azure/durable_functions/models/utils/entity_utils.py +103 -91
- azure/durable_functions/models/utils/http_utils.py +80 -69
- azure/durable_functions/models/utils/json_utils.py +96 -56
- azure/durable_functions/orchestrator.py +73 -71
- azure/durable_functions/testing/OrchestratorGeneratorWrapper.py +42 -0
- azure/durable_functions/testing/__init__.py +6 -0
- {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.3.0.dist-info}/LICENSE +21 -21
- {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.3.0.dist-info}/METADATA +59 -58
- azure_functions_durable-1.3.0.dist-info/RECORD +103 -0
- {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.3.0.dist-info}/WHEEL +1 -1
- tests/models/test_DecoratorMetadata.py +135 -135
- tests/models/test_Decorators.py +107 -107
- tests/models/test_DurableOrchestrationBindings.py +68 -68
- tests/models/test_DurableOrchestrationClient.py +730 -730
- tests/models/test_DurableOrchestrationContext.py +102 -102
- tests/models/test_DurableOrchestrationStatus.py +59 -59
- tests/models/test_OrchestrationState.py +28 -28
- tests/models/test_RpcManagementOptions.py +79 -79
- tests/models/test_TokenSource.py +10 -10
- tests/orchestrator/models/OrchestrationInstance.py +18 -18
- tests/orchestrator/orchestrator_test_utils.py +130 -130
- tests/orchestrator/schemas/OrchetrationStateSchema.py +66 -66
- tests/orchestrator/test_call_http.py +235 -176
- tests/orchestrator/test_continue_as_new.py +67 -67
- tests/orchestrator/test_create_timer.py +126 -126
- tests/orchestrator/test_entity.py +397 -395
- tests/orchestrator/test_external_event.py +53 -53
- tests/orchestrator/test_fan_out_fan_in.py +175 -175
- tests/orchestrator/test_is_replaying_flag.py +101 -101
- tests/orchestrator/test_retries.py +308 -308
- tests/orchestrator/test_sequential_orchestrator.py +841 -841
- tests/orchestrator/test_sequential_orchestrator_custom_status.py +119 -119
- tests/orchestrator/test_sequential_orchestrator_with_retry.py +465 -465
- tests/orchestrator/test_serialization.py +30 -30
- tests/orchestrator/test_sub_orchestrator.py +95 -95
- tests/orchestrator/test_sub_orchestrator_with_retry.py +129 -129
- tests/orchestrator/test_task_any.py +60 -60
- tests/tasks/tasks_test_utils.py +17 -17
- tests/tasks/test_long_timers.py +70 -0
- tests/tasks/test_new_uuid.py +34 -34
- tests/test_utils/ContextBuilder.py +174 -174
- tests/test_utils/EntityContextBuilder.py +56 -56
- tests/test_utils/constants.py +1 -1
- tests/test_utils/json_utils.py +30 -30
- tests/test_utils/testClasses.py +56 -56
- tests/utils/__init__.py +1 -0
- tests/utils/test_entity_utils.py +24 -0
- azure_functions_durable-1.2.9.data/data/_manifest/bsi.json +0 -1
- azure_functions_durable-1.2.9.data/data/_manifest/manifest.cat +0 -0
- azure_functions_durable-1.2.9.data/data/_manifest/manifest.spdx.json +0 -11985
- azure_functions_durable-1.2.9.data/data/_manifest/manifest.spdx.json.sha256 +0 -1
- azure_functions_durable-1.2.9.dist-info/RECORD +0 -102
- {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,116 +1,117 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from typing import List, Any, Dict, Optional
|
|
3
|
-
|
|
4
|
-
from azure.durable_functions.models.ReplaySchema import ReplaySchema
|
|
5
|
-
|
|
6
|
-
from .utils.json_utils import add_attrib
|
|
7
|
-
from azure.durable_functions.models.actions.Action import Action
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
self.
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
import json
|
|
2
|
+
from typing import List, Any, Dict, Optional
|
|
3
|
+
|
|
4
|
+
from azure.durable_functions.models.ReplaySchema import ReplaySchema
|
|
5
|
+
|
|
6
|
+
from .utils.json_utils import add_attrib
|
|
7
|
+
from azure.durable_functions.models.actions.Action import Action
|
|
8
|
+
from azure.functions._durable_functions import _serialize_custom_object
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OrchestratorState:
|
|
12
|
+
"""Orchestration State.
|
|
13
|
+
|
|
14
|
+
Used to communicate the state of the orchestration back to the durable
|
|
15
|
+
extension
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self,
|
|
19
|
+
is_done: bool,
|
|
20
|
+
actions: List[List[Action]],
|
|
21
|
+
output: Any,
|
|
22
|
+
replay_schema: ReplaySchema,
|
|
23
|
+
error: str = None,
|
|
24
|
+
custom_status: Any = None):
|
|
25
|
+
self._is_done: bool = is_done
|
|
26
|
+
self._actions: List[List[Action]] = actions
|
|
27
|
+
self._output: Any = output
|
|
28
|
+
self._error: Optional[str] = error
|
|
29
|
+
self._custom_status: Any = custom_status
|
|
30
|
+
self._replay_schema: ReplaySchema = replay_schema
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def actions(self) -> List[List[Action]]:
|
|
34
|
+
"""Get the ordered list of async actions the orchestrator function should perform.
|
|
35
|
+
|
|
36
|
+
This list is append-only; it must contain all scheduled async actions up to the latest
|
|
37
|
+
requested work, even actions that have already been completed.
|
|
38
|
+
|
|
39
|
+
Actions are grouped by execution. Each subsequent orchestrator execution should add a
|
|
40
|
+
new array of action objects to the collection.
|
|
41
|
+
"""
|
|
42
|
+
return self._actions
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def is_done(self) -> bool:
|
|
46
|
+
"""Get indicator of whether this is the last execution of this orchestrator instance.
|
|
47
|
+
|
|
48
|
+
When this value is true, the Durable Functions extension will consider the orchestration
|
|
49
|
+
instance completed and will attempt to return the output value.
|
|
50
|
+
"""
|
|
51
|
+
return self._is_done
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def output(self):
|
|
55
|
+
"""Get the JSON-serializable value returned by the orchestrator instance completion.
|
|
56
|
+
|
|
57
|
+
Optional.
|
|
58
|
+
"""
|
|
59
|
+
return self._output
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def error(self) -> Optional[str]:
|
|
63
|
+
"""Get the error received when running the orchestration.
|
|
64
|
+
|
|
65
|
+
Optional.
|
|
66
|
+
"""
|
|
67
|
+
return self._error
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def custom_status(self):
|
|
71
|
+
"""Get the JSON-serializable value used by DurableOrchestrationContext.SetCustomStatus."""
|
|
72
|
+
return self._custom_status
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def schema_version(self):
|
|
76
|
+
"""Get the Replay Schema represented in this OrchestratorState payload."""
|
|
77
|
+
return self._replay_schema.value
|
|
78
|
+
|
|
79
|
+
def to_json(self) -> Dict[str, Any]:
|
|
80
|
+
"""Convert object into a json dictionary.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
Dict[str, Any]
|
|
85
|
+
The instance of the class converted into a json dictionary
|
|
86
|
+
"""
|
|
87
|
+
json_dict: Dict[str, Any] = {}
|
|
88
|
+
add_attrib(json_dict, self, '_is_done', 'isDone')
|
|
89
|
+
if self._replay_schema != ReplaySchema.V1:
|
|
90
|
+
add_attrib(json_dict, self, 'schema_version', 'schemaVersion')
|
|
91
|
+
self._add_actions(json_dict)
|
|
92
|
+
if not (self._output is None):
|
|
93
|
+
json_dict['output'] = self._output
|
|
94
|
+
if self._error:
|
|
95
|
+
json_dict['error'] = self._error
|
|
96
|
+
if self._custom_status:
|
|
97
|
+
json_dict['customStatus'] = self._custom_status
|
|
98
|
+
return json_dict
|
|
99
|
+
|
|
100
|
+
def _add_actions(self, json_dict):
|
|
101
|
+
json_dict['actions'] = []
|
|
102
|
+
for action_list in self._actions:
|
|
103
|
+
action_result_list = []
|
|
104
|
+
for action_obj in action_list:
|
|
105
|
+
action_result_list.append(action_obj.to_json())
|
|
106
|
+
json_dict['actions'].append(action_result_list)
|
|
107
|
+
|
|
108
|
+
def to_json_string(self) -> str:
|
|
109
|
+
"""Convert object into a json string.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
str
|
|
114
|
+
The instance of the object in json string format
|
|
115
|
+
"""
|
|
116
|
+
json_dict = self.to_json()
|
|
117
|
+
return json.dumps(json_dict, default=_serialize_custom_object)
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
from typing import Dict, Any
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class PurgeHistoryResult:
|
|
5
|
-
"""Information provided when the request to purge history has been made."""
|
|
6
|
-
|
|
7
|
-
# parameter names are as defined by JSON schema and do not conform to PEP8 naming conventions
|
|
8
|
-
def __init__(self, instancesDeleted: int, **kwargs):
|
|
9
|
-
self._instances_deleted: int = instancesDeleted
|
|
10
|
-
if kwargs is not None:
|
|
11
|
-
for key, value in kwargs.items():
|
|
12
|
-
self.__setattr__(key, value)
|
|
13
|
-
|
|
14
|
-
@classmethod
|
|
15
|
-
def from_json(cls, json_obj: Dict[Any, Any]):
|
|
16
|
-
"""Convert the value passed into a new instance of the class.
|
|
17
|
-
|
|
18
|
-
Parameters
|
|
19
|
-
----------
|
|
20
|
-
json_obj: Dict[Any, Any]
|
|
21
|
-
JSON object to be converted into an instance of the class
|
|
22
|
-
|
|
23
|
-
Returns
|
|
24
|
-
-------
|
|
25
|
-
PurgeHistoryResult
|
|
26
|
-
New instance of the durable orchestration status class
|
|
27
|
-
"""
|
|
28
|
-
return cls(**json_obj)
|
|
29
|
-
|
|
30
|
-
@property
|
|
31
|
-
def instances_deleted(self):
|
|
32
|
-
"""Get the number of deleted instances."""
|
|
33
|
-
return self._instances_deleted
|
|
1
|
+
from typing import Dict, Any
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class PurgeHistoryResult:
|
|
5
|
+
"""Information provided when the request to purge history has been made."""
|
|
6
|
+
|
|
7
|
+
# parameter names are as defined by JSON schema and do not conform to PEP8 naming conventions
|
|
8
|
+
def __init__(self, instancesDeleted: int, **kwargs):
|
|
9
|
+
self._instances_deleted: int = instancesDeleted
|
|
10
|
+
if kwargs is not None:
|
|
11
|
+
for key, value in kwargs.items():
|
|
12
|
+
self.__setattr__(key, value)
|
|
13
|
+
|
|
14
|
+
@classmethod
|
|
15
|
+
def from_json(cls, json_obj: Dict[Any, Any]):
|
|
16
|
+
"""Convert the value passed into a new instance of the class.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
json_obj: Dict[Any, Any]
|
|
21
|
+
JSON object to be converted into an instance of the class
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
PurgeHistoryResult
|
|
26
|
+
New instance of the durable orchestration status class
|
|
27
|
+
"""
|
|
28
|
+
return cls(**json_obj)
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def instances_deleted(self):
|
|
32
|
+
"""Get the number of deleted instances."""
|
|
33
|
+
return self._instances_deleted
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ReplaySchema(Enum):
|
|
5
|
-
"""Enum representing the ReplaySchemas supported by this SDK version."""
|
|
6
|
-
|
|
7
|
-
V1 = 0
|
|
8
|
-
V2 = 1
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ReplaySchema(Enum):
|
|
5
|
+
"""Enum representing the ReplaySchemas supported by this SDK version."""
|
|
6
|
+
|
|
7
|
+
V1 = 0
|
|
8
|
+
V2 = 1
|
|
9
|
+
V3 = 2
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
from typing import Dict, Union
|
|
2
|
-
|
|
3
|
-
from .utils.json_utils import add_attrib
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class RetryOptions:
|
|
7
|
-
"""Retry Options.
|
|
8
|
-
|
|
9
|
-
Defines retry policies that can be passed as parameters to various
|
|
10
|
-
operations.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
def __init__(
|
|
14
|
-
self,
|
|
15
|
-
first_retry_interval_in_milliseconds: int,
|
|
16
|
-
max_number_of_attempts: int):
|
|
17
|
-
self._first_retry_interval_in_milliseconds: int = \
|
|
18
|
-
first_retry_interval_in_milliseconds
|
|
19
|
-
self._max_number_of_attempts: int = max_number_of_attempts
|
|
20
|
-
|
|
21
|
-
if self._first_retry_interval_in_milliseconds <= 0:
|
|
22
|
-
raise ValueError("first_retry_interval_in_milliseconds value"
|
|
23
|
-
"must be greater than 0.")
|
|
24
|
-
|
|
25
|
-
@property
|
|
26
|
-
def first_retry_interval_in_milliseconds(self) -> int:
|
|
27
|
-
"""Get the first retry interval (ms).
|
|
28
|
-
|
|
29
|
-
Must be greater than 0
|
|
30
|
-
|
|
31
|
-
Returns
|
|
32
|
-
-------
|
|
33
|
-
int
|
|
34
|
-
The value indicating the first retry interval
|
|
35
|
-
"""
|
|
36
|
-
return self._first_retry_interval_in_milliseconds
|
|
37
|
-
|
|
38
|
-
@property
|
|
39
|
-
def max_number_of_attempts(self) -> int:
|
|
40
|
-
"""Get Max Number of Attempts.
|
|
41
|
-
|
|
42
|
-
Returns
|
|
43
|
-
-------
|
|
44
|
-
int
|
|
45
|
-
Value indicating the max number of attempts to retry
|
|
46
|
-
"""
|
|
47
|
-
return self._max_number_of_attempts
|
|
48
|
-
|
|
49
|
-
def to_json(self) -> Dict[str, Union[str, int]]:
|
|
50
|
-
"""Convert object into a json dictionary.
|
|
51
|
-
|
|
52
|
-
Returns
|
|
53
|
-
-------
|
|
54
|
-
Dict[str, Any]
|
|
55
|
-
The instance of the class converted into a json dictionary
|
|
56
|
-
"""
|
|
57
|
-
json_dict: Dict[str, Union[str, int]] = {}
|
|
58
|
-
|
|
59
|
-
add_attrib(
|
|
60
|
-
json_dict,
|
|
61
|
-
self,
|
|
62
|
-
'first_retry_interval_in_milliseconds',
|
|
63
|
-
'firstRetryIntervalInMilliseconds')
|
|
64
|
-
add_attrib(
|
|
65
|
-
json_dict,
|
|
66
|
-
self,
|
|
67
|
-
'max_number_of_attempts',
|
|
68
|
-
'maxNumberOfAttempts')
|
|
69
|
-
return json_dict
|
|
1
|
+
from typing import Dict, Union
|
|
2
|
+
|
|
3
|
+
from .utils.json_utils import add_attrib
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RetryOptions:
|
|
7
|
+
"""Retry Options.
|
|
8
|
+
|
|
9
|
+
Defines retry policies that can be passed as parameters to various
|
|
10
|
+
operations.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
first_retry_interval_in_milliseconds: int,
|
|
16
|
+
max_number_of_attempts: int):
|
|
17
|
+
self._first_retry_interval_in_milliseconds: int = \
|
|
18
|
+
first_retry_interval_in_milliseconds
|
|
19
|
+
self._max_number_of_attempts: int = max_number_of_attempts
|
|
20
|
+
|
|
21
|
+
if self._first_retry_interval_in_milliseconds <= 0:
|
|
22
|
+
raise ValueError("first_retry_interval_in_milliseconds value"
|
|
23
|
+
"must be greater than 0.")
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def first_retry_interval_in_milliseconds(self) -> int:
|
|
27
|
+
"""Get the first retry interval (ms).
|
|
28
|
+
|
|
29
|
+
Must be greater than 0
|
|
30
|
+
|
|
31
|
+
Returns
|
|
32
|
+
-------
|
|
33
|
+
int
|
|
34
|
+
The value indicating the first retry interval
|
|
35
|
+
"""
|
|
36
|
+
return self._first_retry_interval_in_milliseconds
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def max_number_of_attempts(self) -> int:
|
|
40
|
+
"""Get Max Number of Attempts.
|
|
41
|
+
|
|
42
|
+
Returns
|
|
43
|
+
-------
|
|
44
|
+
int
|
|
45
|
+
Value indicating the max number of attempts to retry
|
|
46
|
+
"""
|
|
47
|
+
return self._max_number_of_attempts
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> Dict[str, Union[str, int]]:
|
|
50
|
+
"""Convert object into a json dictionary.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
Dict[str, Any]
|
|
55
|
+
The instance of the class converted into a json dictionary
|
|
56
|
+
"""
|
|
57
|
+
json_dict: Dict[str, Union[str, int]] = {}
|
|
58
|
+
|
|
59
|
+
add_attrib(
|
|
60
|
+
json_dict,
|
|
61
|
+
self,
|
|
62
|
+
'first_retry_interval_in_milliseconds',
|
|
63
|
+
'firstRetryIntervalInMilliseconds')
|
|
64
|
+
add_attrib(
|
|
65
|
+
json_dict,
|
|
66
|
+
self,
|
|
67
|
+
'max_number_of_attempts',
|
|
68
|
+
'maxNumberOfAttempts')
|
|
69
|
+
return json_dict
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
from typing import Any, List, Optional
|
|
3
|
-
|
|
4
|
-
from azure.durable_functions.constants import DATETIME_STRING_FORMAT
|
|
5
|
-
from azure.durable_functions.models.OrchestrationRuntimeStatus import OrchestrationRuntimeStatus
|
|
6
|
-
|
|
7
|
-
from .utils.entity_utils import EntityId
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class RpcManagementOptions:
|
|
11
|
-
"""Class used to collect the options for getting orchestration status."""
|
|
12
|
-
|
|
13
|
-
def __init__(self, instance_id: str = None, task_hub_name: str = None,
|
|
14
|
-
connection_name: str = None, show_history: bool = None,
|
|
15
|
-
show_history_output: bool = None, created_time_from: datetime = None,
|
|
16
|
-
created_time_to: datetime = None,
|
|
17
|
-
runtime_status: List[OrchestrationRuntimeStatus] = None, show_input: bool = None,
|
|
18
|
-
operation_name: str = None,
|
|
19
|
-
entity_Id: EntityId = None):
|
|
20
|
-
self._instance_id = instance_id
|
|
21
|
-
self._task_hub_name = task_hub_name
|
|
22
|
-
self._connection_name = connection_name
|
|
23
|
-
self._show_history = show_history
|
|
24
|
-
self._show_history_output = show_history_output
|
|
25
|
-
self._created_time_from = created_time_from
|
|
26
|
-
self._created_time_to = created_time_to
|
|
27
|
-
self._runtime_status = runtime_status
|
|
28
|
-
self._show_input = show_input
|
|
29
|
-
self.operation_name = operation_name
|
|
30
|
-
self.entity_Id = entity_Id
|
|
31
|
-
|
|
32
|
-
@staticmethod
|
|
33
|
-
def _add_arg(query: List[str], name: str, value: Any):
|
|
34
|
-
if value:
|
|
35
|
-
query.append(f'{name}={value}')
|
|
36
|
-
|
|
37
|
-
@staticmethod
|
|
38
|
-
def _add_date_arg(query: List[str], name: str, value: Optional[datetime]):
|
|
39
|
-
if value:
|
|
40
|
-
date_as_string = value.strftime(DATETIME_STRING_FORMAT)
|
|
41
|
-
RpcManagementOptions._add_arg(query, name, date_as_string)
|
|
42
|
-
|
|
43
|
-
def to_url(self, base_url: Optional[str]) -> str:
|
|
44
|
-
"""Get the url based on the options selected.
|
|
45
|
-
|
|
46
|
-
Parameters
|
|
47
|
-
----------
|
|
48
|
-
base_url: str
|
|
49
|
-
The base url to prepend to the url path
|
|
50
|
-
|
|
51
|
-
Raises
|
|
52
|
-
------
|
|
53
|
-
ValueError
|
|
54
|
-
When the `base_url` argument is None
|
|
55
|
-
|
|
56
|
-
Returns
|
|
57
|
-
-------
|
|
58
|
-
str
|
|
59
|
-
The Url used to get orchestration status information
|
|
60
|
-
"""
|
|
61
|
-
if base_url is None:
|
|
62
|
-
raise ValueError("orchestration bindings has not RPC base url")
|
|
63
|
-
|
|
64
|
-
if self.entity_Id:
|
|
65
|
-
url = f'{base_url}{EntityId.get_entity_id_url_path(self.entity_Id)}'
|
|
66
|
-
else:
|
|
67
|
-
url = f"{base_url}instances/{self._instance_id if self._instance_id else ''}"
|
|
68
|
-
|
|
69
|
-
query: List[str] = []
|
|
70
|
-
|
|
71
|
-
self._add_arg(query, 'taskHub', self._task_hub_name)
|
|
72
|
-
self._add_arg(query, 'connectionName', self._connection_name)
|
|
73
|
-
self._add_arg(query, 'showInput', self._show_input)
|
|
74
|
-
self._add_arg(query, 'showHistory', self._show_history)
|
|
75
|
-
self._add_arg(query, 'showHistoryOutput', self._show_history_output)
|
|
76
|
-
self._add_date_arg(query, 'createdTimeFrom', self._created_time_from)
|
|
77
|
-
self._add_date_arg(query, 'createdTimeTo', self._created_time_to)
|
|
78
|
-
self._add_arg(query, 'op', self.operation_name)
|
|
79
|
-
if self._runtime_status is not None and len(self._runtime_status) > 0:
|
|
80
|
-
runtime_status = ",".join(r.value for r in self._runtime_status)
|
|
81
|
-
self._add_arg(query, 'runtimeStatus', runtime_status)
|
|
82
|
-
|
|
83
|
-
if len(query) > 0:
|
|
84
|
-
url += "?" + "&".join(query)
|
|
85
|
-
|
|
86
|
-
return url
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Any, List, Optional
|
|
3
|
+
|
|
4
|
+
from azure.durable_functions.constants import DATETIME_STRING_FORMAT
|
|
5
|
+
from azure.durable_functions.models.OrchestrationRuntimeStatus import OrchestrationRuntimeStatus
|
|
6
|
+
|
|
7
|
+
from .utils.entity_utils import EntityId
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RpcManagementOptions:
|
|
11
|
+
"""Class used to collect the options for getting orchestration status."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, instance_id: str = None, task_hub_name: str = None,
|
|
14
|
+
connection_name: str = None, show_history: bool = None,
|
|
15
|
+
show_history_output: bool = None, created_time_from: datetime = None,
|
|
16
|
+
created_time_to: datetime = None,
|
|
17
|
+
runtime_status: List[OrchestrationRuntimeStatus] = None, show_input: bool = None,
|
|
18
|
+
operation_name: str = None,
|
|
19
|
+
entity_Id: EntityId = None):
|
|
20
|
+
self._instance_id = instance_id
|
|
21
|
+
self._task_hub_name = task_hub_name
|
|
22
|
+
self._connection_name = connection_name
|
|
23
|
+
self._show_history = show_history
|
|
24
|
+
self._show_history_output = show_history_output
|
|
25
|
+
self._created_time_from = created_time_from
|
|
26
|
+
self._created_time_to = created_time_to
|
|
27
|
+
self._runtime_status = runtime_status
|
|
28
|
+
self._show_input = show_input
|
|
29
|
+
self.operation_name = operation_name
|
|
30
|
+
self.entity_Id = entity_Id
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def _add_arg(query: List[str], name: str, value: Any):
|
|
34
|
+
if value:
|
|
35
|
+
query.append(f'{name}={value}')
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def _add_date_arg(query: List[str], name: str, value: Optional[datetime]):
|
|
39
|
+
if value:
|
|
40
|
+
date_as_string = value.strftime(DATETIME_STRING_FORMAT)
|
|
41
|
+
RpcManagementOptions._add_arg(query, name, date_as_string)
|
|
42
|
+
|
|
43
|
+
def to_url(self, base_url: Optional[str]) -> str:
|
|
44
|
+
"""Get the url based on the options selected.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
base_url: str
|
|
49
|
+
The base url to prepend to the url path
|
|
50
|
+
|
|
51
|
+
Raises
|
|
52
|
+
------
|
|
53
|
+
ValueError
|
|
54
|
+
When the `base_url` argument is None
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
str
|
|
59
|
+
The Url used to get orchestration status information
|
|
60
|
+
"""
|
|
61
|
+
if base_url is None:
|
|
62
|
+
raise ValueError("orchestration bindings has not RPC base url")
|
|
63
|
+
|
|
64
|
+
if self.entity_Id:
|
|
65
|
+
url = f'{base_url}{EntityId.get_entity_id_url_path(self.entity_Id)}'
|
|
66
|
+
else:
|
|
67
|
+
url = f"{base_url}instances/{self._instance_id if self._instance_id else ''}"
|
|
68
|
+
|
|
69
|
+
query: List[str] = []
|
|
70
|
+
|
|
71
|
+
self._add_arg(query, 'taskHub', self._task_hub_name)
|
|
72
|
+
self._add_arg(query, 'connectionName', self._connection_name)
|
|
73
|
+
self._add_arg(query, 'showInput', self._show_input)
|
|
74
|
+
self._add_arg(query, 'showHistory', self._show_history)
|
|
75
|
+
self._add_arg(query, 'showHistoryOutput', self._show_history_output)
|
|
76
|
+
self._add_date_arg(query, 'createdTimeFrom', self._created_time_from)
|
|
77
|
+
self._add_date_arg(query, 'createdTimeTo', self._created_time_to)
|
|
78
|
+
self._add_arg(query, 'op', self.operation_name)
|
|
79
|
+
if self._runtime_status is not None and len(self._runtime_status) > 0:
|
|
80
|
+
runtime_status = ",".join(r.value for r in self._runtime_status)
|
|
81
|
+
self._add_arg(query, 'runtimeStatus', runtime_status)
|
|
82
|
+
|
|
83
|
+
if len(query) > 0:
|
|
84
|
+
url += "?" + "&".join(query)
|
|
85
|
+
|
|
86
|
+
return url
|