azure-functions-durable 1.2.9__py3-none-any.whl → 1.2.10__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.
Files changed (101) hide show
  1. azure/durable_functions/__init__.py +81 -81
  2. azure/durable_functions/constants.py +9 -9
  3. azure/durable_functions/decorators/__init__.py +3 -3
  4. azure/durable_functions/decorators/durable_app.py +249 -249
  5. azure/durable_functions/decorators/metadata.py +109 -109
  6. azure/durable_functions/entity.py +125 -125
  7. azure/durable_functions/models/DurableEntityContext.py +201 -201
  8. azure/durable_functions/models/DurableHttpRequest.py +58 -58
  9. azure/durable_functions/models/DurableOrchestrationBindings.py +66 -66
  10. azure/durable_functions/models/DurableOrchestrationClient.py +781 -781
  11. azure/durable_functions/models/DurableOrchestrationContext.py +722 -707
  12. azure/durable_functions/models/DurableOrchestrationStatus.py +156 -156
  13. azure/durable_functions/models/EntityStateResponse.py +23 -23
  14. azure/durable_functions/models/FunctionContext.py +7 -7
  15. azure/durable_functions/models/OrchestrationRuntimeStatus.py +32 -32
  16. azure/durable_functions/models/OrchestratorState.py +117 -116
  17. azure/durable_functions/models/PurgeHistoryResult.py +33 -33
  18. azure/durable_functions/models/ReplaySchema.py +8 -8
  19. azure/durable_functions/models/RetryOptions.py +69 -69
  20. azure/durable_functions/models/RpcManagementOptions.py +86 -86
  21. azure/durable_functions/models/Task.py +426 -426
  22. azure/durable_functions/models/TaskOrchestrationExecutor.py +346 -336
  23. azure/durable_functions/models/TokenSource.py +56 -56
  24. azure/durable_functions/models/__init__.py +24 -24
  25. azure/durable_functions/models/actions/Action.py +23 -23
  26. azure/durable_functions/models/actions/ActionType.py +18 -18
  27. azure/durable_functions/models/actions/CallActivityAction.py +41 -41
  28. azure/durable_functions/models/actions/CallActivityWithRetryAction.py +45 -45
  29. azure/durable_functions/models/actions/CallEntityAction.py +46 -46
  30. azure/durable_functions/models/actions/CallHttpAction.py +35 -35
  31. azure/durable_functions/models/actions/CallSubOrchestratorAction.py +40 -40
  32. azure/durable_functions/models/actions/CallSubOrchestratorWithRetryAction.py +44 -44
  33. azure/durable_functions/models/actions/CompoundAction.py +35 -35
  34. azure/durable_functions/models/actions/ContinueAsNewAction.py +36 -36
  35. azure/durable_functions/models/actions/CreateTimerAction.py +48 -48
  36. azure/durable_functions/models/actions/NoOpAction.py +35 -35
  37. azure/durable_functions/models/actions/SignalEntityAction.py +47 -47
  38. azure/durable_functions/models/actions/WaitForExternalEventAction.py +63 -63
  39. azure/durable_functions/models/actions/WhenAllAction.py +14 -14
  40. azure/durable_functions/models/actions/WhenAnyAction.py +14 -14
  41. azure/durable_functions/models/actions/__init__.py +24 -24
  42. azure/durable_functions/models/entities/EntityState.py +74 -74
  43. azure/durable_functions/models/entities/OperationResult.py +76 -76
  44. azure/durable_functions/models/entities/RequestMessage.py +53 -53
  45. azure/durable_functions/models/entities/ResponseMessage.py +48 -48
  46. azure/durable_functions/models/entities/Signal.py +62 -62
  47. azure/durable_functions/models/entities/__init__.py +17 -17
  48. azure/durable_functions/models/history/HistoryEvent.py +92 -92
  49. azure/durable_functions/models/history/HistoryEventType.py +27 -27
  50. azure/durable_functions/models/history/__init__.py +8 -8
  51. azure/durable_functions/models/utils/__init__.py +7 -7
  52. azure/durable_functions/models/utils/entity_utils.py +103 -91
  53. azure/durable_functions/models/utils/http_utils.py +69 -69
  54. azure/durable_functions/models/utils/json_utils.py +56 -56
  55. azure/durable_functions/orchestrator.py +71 -71
  56. {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.2.10.dist-info}/LICENSE +21 -21
  57. {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.2.10.dist-info}/METADATA +58 -58
  58. azure_functions_durable-1.2.10.dist-info/RECORD +100 -0
  59. tests/models/test_DecoratorMetadata.py +135 -135
  60. tests/models/test_Decorators.py +107 -107
  61. tests/models/test_DurableOrchestrationBindings.py +68 -68
  62. tests/models/test_DurableOrchestrationClient.py +730 -730
  63. tests/models/test_DurableOrchestrationContext.py +102 -102
  64. tests/models/test_DurableOrchestrationStatus.py +59 -59
  65. tests/models/test_OrchestrationState.py +28 -28
  66. tests/models/test_RpcManagementOptions.py +79 -79
  67. tests/models/test_TokenSource.py +10 -10
  68. tests/orchestrator/models/OrchestrationInstance.py +18 -18
  69. tests/orchestrator/orchestrator_test_utils.py +130 -130
  70. tests/orchestrator/schemas/OrchetrationStateSchema.py +66 -66
  71. tests/orchestrator/test_call_http.py +235 -176
  72. tests/orchestrator/test_continue_as_new.py +67 -67
  73. tests/orchestrator/test_create_timer.py +126 -126
  74. tests/orchestrator/test_entity.py +395 -395
  75. tests/orchestrator/test_external_event.py +53 -53
  76. tests/orchestrator/test_fan_out_fan_in.py +175 -175
  77. tests/orchestrator/test_is_replaying_flag.py +101 -101
  78. tests/orchestrator/test_retries.py +308 -308
  79. tests/orchestrator/test_sequential_orchestrator.py +841 -841
  80. tests/orchestrator/test_sequential_orchestrator_custom_status.py +119 -119
  81. tests/orchestrator/test_sequential_orchestrator_with_retry.py +465 -465
  82. tests/orchestrator/test_serialization.py +30 -30
  83. tests/orchestrator/test_sub_orchestrator.py +95 -95
  84. tests/orchestrator/test_sub_orchestrator_with_retry.py +129 -129
  85. tests/orchestrator/test_task_any.py +60 -60
  86. tests/tasks/tasks_test_utils.py +17 -17
  87. tests/tasks/test_new_uuid.py +34 -34
  88. tests/test_utils/ContextBuilder.py +174 -174
  89. tests/test_utils/EntityContextBuilder.py +56 -56
  90. tests/test_utils/constants.py +1 -1
  91. tests/test_utils/json_utils.py +30 -30
  92. tests/test_utils/testClasses.py +56 -56
  93. tests/utils/__init__.py +1 -0
  94. tests/utils/test_entity_utils.py +24 -0
  95. azure_functions_durable-1.2.9.data/data/_manifest/bsi.json +0 -1
  96. azure_functions_durable-1.2.9.data/data/_manifest/manifest.cat +0 -0
  97. azure_functions_durable-1.2.9.data/data/_manifest/manifest.spdx.json +0 -11985
  98. azure_functions_durable-1.2.9.data/data/_manifest/manifest.spdx.json.sha256 +0 -1
  99. azure_functions_durable-1.2.9.dist-info/RECORD +0 -102
  100. {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.2.10.dist-info}/WHEEL +0 -0
  101. {azure_functions_durable-1.2.9.dist-info → azure_functions_durable-1.2.10.dist-info}/top_level.txt +0 -0
@@ -1,120 +1,120 @@
1
- from azure.durable_functions.models.ReplaySchema import ReplaySchema
2
- from .orchestrator_test_utils \
3
- import assert_orchestration_state_equals, get_orchestration_state_result, assert_valid_schema
4
- from tests.test_utils.ContextBuilder import ContextBuilder
5
- from azure.durable_functions.models.OrchestratorState import OrchestratorState
6
- from azure.durable_functions.models.actions.CallActivityAction \
7
- import CallActivityAction
8
- from typing import Any
9
-
10
-
11
- def generator_function(context):
12
- task1 = yield context.call_activity("Hello", "Tokyo")
13
- context.set_custom_status("--- Tokyo ->")
14
- task2 = yield context.call_activity("Hello", "Seattle")
15
- context.set_custom_status("Seattle ->")
16
- task3 = yield context.call_activity("Hello", "London")
17
- context.set_custom_status("London ---")
18
-
19
-
20
- def generator_function_with_object_status(context):
21
- task1 = yield context.call_activity("Hello", "Tokyo")
22
- obj_status = {}
23
- obj_status["tokyo"] = "completed"
24
- context.set_custom_status(obj_status)
25
-
26
- def base_expected_state(output=None, replay_schema: ReplaySchema = ReplaySchema.V1) -> OrchestratorState:
27
- return OrchestratorState(is_done=False, actions=[], output=output, replay_schema=replay_schema.value)
28
-
29
- def add_custom_status(state:OrchestratorState, status:Any):
30
- state._custom_status = status
31
-
32
- def add_hello_action(state: OrchestratorState, input_: str):
33
- action = CallActivityAction(function_name='Hello', input_=input_)
34
- state.actions.append([action])
35
-
36
- def add_is_done(state:OrchestratorState, is_completed:bool):
37
- state._is_done = is_completed
38
-
39
- def add_hello_completed_events(
40
- context_builder: ContextBuilder, id_: int, result: str):
41
- context_builder.add_task_scheduled_event(name='Hello', id_=id_)
42
- context_builder.add_orchestrator_completed_event()
43
- context_builder.add_orchestrator_started_event()
44
- context_builder.add_task_completed_event(id_=id_, result=result)
45
-
46
-
47
- def test_initial_orchestration_state():
48
- context_builder = ContextBuilder('test_simple_function')
49
-
50
- result = get_orchestration_state_result(
51
- context_builder, generator_function)
52
-
53
- expected_state = base_expected_state()
54
- add_hello_action(expected_state,'Tokyo')
55
- expected = expected_state.to_json()
56
-
57
- assert_valid_schema(result)
58
- assert_orchestration_state_equals(expected, result)
59
-
60
-
61
- def test_custom_status_tokyo():
62
- context_builder = ContextBuilder('test_custom_status')
63
-
64
- # Complete the first event so that it sets the custom status
65
- add_hello_completed_events(context_builder, 0, "\"Hello Tokyo!\"")
66
-
67
- result = get_orchestration_state_result(
68
- context_builder, generator_function)
69
-
70
- expected_state = base_expected_state()
71
- add_hello_action(expected_state,'Tokyo')
72
- add_hello_action(expected_state,'Seattle')
73
- add_custom_status(expected_state,"--- Tokyo ->")
74
- expected = expected_state.to_json()
75
-
76
- assert_valid_schema(result)
77
- assert_orchestration_state_equals(expected, result)
78
-
79
-
80
- def test_custom_status_tokyo_seattle():
81
- context_builder = ContextBuilder('test_custom_status_seattle')
82
-
83
- # Complete the two event so that it sets the custom status accordingly
84
- add_hello_completed_events(context_builder, 0, "\"Hello Tokyo!\"")
85
- add_hello_completed_events(context_builder, 1, "\"Hello Seattle!\"")
86
-
87
- result = get_orchestration_state_result(
88
- context_builder, generator_function)
89
-
90
- expected_state = base_expected_state()
91
- add_hello_action(expected_state,'Tokyo')
92
- add_hello_action(expected_state,'Seattle')
93
- add_hello_action(expected_state,'London')
94
- add_custom_status(expected_state,"Seattle ->")
95
- expected = expected_state.to_json()
96
-
97
- assert_valid_schema(result)
98
- assert_orchestration_state_equals(expected, result)
99
-
100
- def test_custom_status_as_object():
101
- context_builder = ContextBuilder('test_custom_status_as_object')
102
-
103
- # Add first event as completed
104
- add_hello_completed_events(context_builder,0,"\"Hello Tokyo!\"")
105
-
106
- # pass generator_function_with_object_status as target test
107
- result = get_orchestration_state_result(
108
- context_builder, generator_function_with_object_status)
109
-
110
- # construct expected state
111
- expected_state = base_expected_state()
112
- add_hello_action(expected_state,'Tokyo')
113
- obj_status = {}
114
- obj_status['tokyo'] = 'completed'
115
- add_custom_status(expected_state,obj_status)
116
- add_is_done(expected_state,True)
117
- expected = expected_state.to_json()
118
-
119
- assert_valid_schema(result)
1
+ from azure.durable_functions.models.ReplaySchema import ReplaySchema
2
+ from .orchestrator_test_utils \
3
+ import assert_orchestration_state_equals, get_orchestration_state_result, assert_valid_schema
4
+ from tests.test_utils.ContextBuilder import ContextBuilder
5
+ from azure.durable_functions.models.OrchestratorState import OrchestratorState
6
+ from azure.durable_functions.models.actions.CallActivityAction \
7
+ import CallActivityAction
8
+ from typing import Any
9
+
10
+
11
+ def generator_function(context):
12
+ task1 = yield context.call_activity("Hello", "Tokyo")
13
+ context.set_custom_status("--- Tokyo ->")
14
+ task2 = yield context.call_activity("Hello", "Seattle")
15
+ context.set_custom_status("Seattle ->")
16
+ task3 = yield context.call_activity("Hello", "London")
17
+ context.set_custom_status("London ---")
18
+
19
+
20
+ def generator_function_with_object_status(context):
21
+ task1 = yield context.call_activity("Hello", "Tokyo")
22
+ obj_status = {}
23
+ obj_status["tokyo"] = "completed"
24
+ context.set_custom_status(obj_status)
25
+
26
+ def base_expected_state(output=None, replay_schema: ReplaySchema = ReplaySchema.V1) -> OrchestratorState:
27
+ return OrchestratorState(is_done=False, actions=[], output=output, replay_schema=replay_schema.value)
28
+
29
+ def add_custom_status(state:OrchestratorState, status:Any):
30
+ state._custom_status = status
31
+
32
+ def add_hello_action(state: OrchestratorState, input_: str):
33
+ action = CallActivityAction(function_name='Hello', input_=input_)
34
+ state.actions.append([action])
35
+
36
+ def add_is_done(state:OrchestratorState, is_completed:bool):
37
+ state._is_done = is_completed
38
+
39
+ def add_hello_completed_events(
40
+ context_builder: ContextBuilder, id_: int, result: str):
41
+ context_builder.add_task_scheduled_event(name='Hello', id_=id_)
42
+ context_builder.add_orchestrator_completed_event()
43
+ context_builder.add_orchestrator_started_event()
44
+ context_builder.add_task_completed_event(id_=id_, result=result)
45
+
46
+
47
+ def test_initial_orchestration_state():
48
+ context_builder = ContextBuilder('test_simple_function')
49
+
50
+ result = get_orchestration_state_result(
51
+ context_builder, generator_function)
52
+
53
+ expected_state = base_expected_state()
54
+ add_hello_action(expected_state,'Tokyo')
55
+ expected = expected_state.to_json()
56
+
57
+ assert_valid_schema(result)
58
+ assert_orchestration_state_equals(expected, result)
59
+
60
+
61
+ def test_custom_status_tokyo():
62
+ context_builder = ContextBuilder('test_custom_status')
63
+
64
+ # Complete the first event so that it sets the custom status
65
+ add_hello_completed_events(context_builder, 0, "\"Hello Tokyo!\"")
66
+
67
+ result = get_orchestration_state_result(
68
+ context_builder, generator_function)
69
+
70
+ expected_state = base_expected_state()
71
+ add_hello_action(expected_state,'Tokyo')
72
+ add_hello_action(expected_state,'Seattle')
73
+ add_custom_status(expected_state,"--- Tokyo ->")
74
+ expected = expected_state.to_json()
75
+
76
+ assert_valid_schema(result)
77
+ assert_orchestration_state_equals(expected, result)
78
+
79
+
80
+ def test_custom_status_tokyo_seattle():
81
+ context_builder = ContextBuilder('test_custom_status_seattle')
82
+
83
+ # Complete the two event so that it sets the custom status accordingly
84
+ add_hello_completed_events(context_builder, 0, "\"Hello Tokyo!\"")
85
+ add_hello_completed_events(context_builder, 1, "\"Hello Seattle!\"")
86
+
87
+ result = get_orchestration_state_result(
88
+ context_builder, generator_function)
89
+
90
+ expected_state = base_expected_state()
91
+ add_hello_action(expected_state,'Tokyo')
92
+ add_hello_action(expected_state,'Seattle')
93
+ add_hello_action(expected_state,'London')
94
+ add_custom_status(expected_state,"Seattle ->")
95
+ expected = expected_state.to_json()
96
+
97
+ assert_valid_schema(result)
98
+ assert_orchestration_state_equals(expected, result)
99
+
100
+ def test_custom_status_as_object():
101
+ context_builder = ContextBuilder('test_custom_status_as_object')
102
+
103
+ # Add first event as completed
104
+ add_hello_completed_events(context_builder,0,"\"Hello Tokyo!\"")
105
+
106
+ # pass generator_function_with_object_status as target test
107
+ result = get_orchestration_state_result(
108
+ context_builder, generator_function_with_object_status)
109
+
110
+ # construct expected state
111
+ expected_state = base_expected_state()
112
+ add_hello_action(expected_state,'Tokyo')
113
+ obj_status = {}
114
+ obj_status['tokyo'] = 'completed'
115
+ add_custom_status(expected_state,obj_status)
116
+ add_is_done(expected_state,True)
117
+ expected = expected_state.to_json()
118
+
119
+ assert_valid_schema(result)
120
120
  assert_orchestration_state_equals(expected, result)