cadence-python-client 0.1.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.
Files changed (95) hide show
  1. cadence/__init__.py +18 -0
  2. cadence/_internal/__init__.py +8 -0
  3. cadence/_internal/activity/__init__.py +5 -0
  4. cadence/_internal/activity/_activity_executor.py +113 -0
  5. cadence/_internal/activity/_context.py +58 -0
  6. cadence/_internal/rpc/__init__.py +0 -0
  7. cadence/_internal/rpc/error.py +148 -0
  8. cadence/_internal/rpc/retry.py +104 -0
  9. cadence/_internal/rpc/yarpc.py +42 -0
  10. cadence/_internal/workflow/__init__.py +0 -0
  11. cadence/_internal/workflow/context.py +121 -0
  12. cadence/_internal/workflow/decision_events_iterator.py +161 -0
  13. cadence/_internal/workflow/decisions_helper.py +312 -0
  14. cadence/_internal/workflow/deterministic_event_loop.py +498 -0
  15. cadence/_internal/workflow/history_event_iterator.py +58 -0
  16. cadence/_internal/workflow/statemachine/__init__.py +0 -0
  17. cadence/_internal/workflow/statemachine/activity_state_machine.py +106 -0
  18. cadence/_internal/workflow/statemachine/decision_manager.py +157 -0
  19. cadence/_internal/workflow/statemachine/decision_state_machine.py +87 -0
  20. cadence/_internal/workflow/statemachine/event_dispatcher.py +76 -0
  21. cadence/_internal/workflow/statemachine/timer_state_machine.py +73 -0
  22. cadence/_internal/workflow/workflow_engine.py +245 -0
  23. cadence/_internal/workflow/workflow_intance.py +44 -0
  24. cadence/activity.py +255 -0
  25. cadence/api/v1/__init__.py +92 -0
  26. cadence/api/v1/common_pb2.py +90 -0
  27. cadence/api/v1/common_pb2.pyi +200 -0
  28. cadence/api/v1/common_pb2_grpc.py +24 -0
  29. cadence/api/v1/decision_pb2.py +67 -0
  30. cadence/api/v1/decision_pb2.pyi +225 -0
  31. cadence/api/v1/decision_pb2_grpc.py +24 -0
  32. cadence/api/v1/domain_pb2.py +68 -0
  33. cadence/api/v1/domain_pb2.pyi +145 -0
  34. cadence/api/v1/domain_pb2_grpc.py +24 -0
  35. cadence/api/v1/error_pb2.py +59 -0
  36. cadence/api/v1/error_pb2.pyi +82 -0
  37. cadence/api/v1/error_pb2_grpc.py +24 -0
  38. cadence/api/v1/history_pb2.py +134 -0
  39. cadence/api/v1/history_pb2.pyi +780 -0
  40. cadence/api/v1/history_pb2_grpc.py +24 -0
  41. cadence/api/v1/query_pb2.py +49 -0
  42. cadence/api/v1/query_pb2.pyi +59 -0
  43. cadence/api/v1/query_pb2_grpc.py +24 -0
  44. cadence/api/v1/service_domain_pb2.py +76 -0
  45. cadence/api/v1/service_domain_pb2.pyi +164 -0
  46. cadence/api/v1/service_domain_pb2_grpc.py +327 -0
  47. cadence/api/v1/service_meta_pb2.py +41 -0
  48. cadence/api/v1/service_meta_pb2.pyi +17 -0
  49. cadence/api/v1/service_meta_pb2_grpc.py +97 -0
  50. cadence/api/v1/service_visibility_pb2.py +71 -0
  51. cadence/api/v1/service_visibility_pb2.pyi +149 -0
  52. cadence/api/v1/service_visibility_pb2_grpc.py +362 -0
  53. cadence/api/v1/service_worker_pb2.py +116 -0
  54. cadence/api/v1/service_worker_pb2.pyi +350 -0
  55. cadence/api/v1/service_worker_pb2_grpc.py +743 -0
  56. cadence/api/v1/service_workflow_pb2.py +126 -0
  57. cadence/api/v1/service_workflow_pb2.pyi +395 -0
  58. cadence/api/v1/service_workflow_pb2_grpc.py +861 -0
  59. cadence/api/v1/tasklist_pb2.py +78 -0
  60. cadence/api/v1/tasklist_pb2.pyi +147 -0
  61. cadence/api/v1/tasklist_pb2_grpc.py +24 -0
  62. cadence/api/v1/visibility_pb2.py +47 -0
  63. cadence/api/v1/visibility_pb2.pyi +53 -0
  64. cadence/api/v1/visibility_pb2_grpc.py +24 -0
  65. cadence/api/v1/workflow_pb2.py +89 -0
  66. cadence/api/v1/workflow_pb2.pyi +365 -0
  67. cadence/api/v1/workflow_pb2_grpc.py +24 -0
  68. cadence/client.py +382 -0
  69. cadence/data_converter.py +78 -0
  70. cadence/error.py +111 -0
  71. cadence/metrics/__init__.py +12 -0
  72. cadence/metrics/constants.py +136 -0
  73. cadence/metrics/metrics.py +56 -0
  74. cadence/metrics/prometheus.py +165 -0
  75. cadence/sample/__init__.py +1 -0
  76. cadence/sample/client_example.py +15 -0
  77. cadence/sample/grpc_usage_example.py +230 -0
  78. cadence/sample/simple_usage_example.py +155 -0
  79. cadence/signal.py +174 -0
  80. cadence/worker/__init__.py +13 -0
  81. cadence/worker/_activity.py +60 -0
  82. cadence/worker/_base_task_handler.py +71 -0
  83. cadence/worker/_decision.py +62 -0
  84. cadence/worker/_decision_task_handler.py +285 -0
  85. cadence/worker/_poller.py +64 -0
  86. cadence/worker/_registry.py +245 -0
  87. cadence/worker/_types.py +26 -0
  88. cadence/worker/_worker.py +56 -0
  89. cadence/workflow.py +271 -0
  90. cadence_python_client-0.1.0.dist-info/METADATA +180 -0
  91. cadence_python_client-0.1.0.dist-info/RECORD +95 -0
  92. cadence_python_client-0.1.0.dist-info/WHEEL +5 -0
  93. cadence_python_client-0.1.0.dist-info/licenses/LICENSE +201 -0
  94. cadence_python_client-0.1.0.dist-info/licenses/NOTICE +19 -0
  95. cadence_python_client-0.1.0.dist-info/top_level.txt +1 -0
cadence/activity.py ADDED
@@ -0,0 +1,255 @@
1
+ import inspect
2
+ from abc import ABC, abstractmethod
3
+ from contextlib import contextmanager
4
+ from contextvars import ContextVar
5
+ from dataclasses import dataclass
6
+ from datetime import timedelta, datetime
7
+ from enum import Enum
8
+ from functools import update_wrapper
9
+ from inspect import signature, Parameter
10
+ from typing import (
11
+ Iterator,
12
+ TypedDict,
13
+ Unpack,
14
+ Callable,
15
+ Type,
16
+ ParamSpec,
17
+ TypeVar,
18
+ Generic,
19
+ get_type_hints,
20
+ Any,
21
+ overload,
22
+ Tuple,
23
+ Sequence,
24
+ )
25
+
26
+ from cadence import Client
27
+ from cadence.workflow import WorkflowContext, ActivityOptions, execute_activity
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class ActivityInfo:
32
+ task_token: bytes
33
+ workflow_type: str
34
+ workflow_domain: str
35
+ workflow_id: str
36
+ workflow_run_id: str
37
+ activity_id: str
38
+ activity_type: str
39
+ task_list: str
40
+ heartbeat_timeout: timedelta
41
+ scheduled_timestamp: datetime
42
+ started_timestamp: datetime
43
+ start_to_close_timeout: timedelta
44
+ attempt: int
45
+
46
+
47
+ def client() -> Client:
48
+ return ActivityContext.get().client()
49
+
50
+
51
+ def in_activity() -> bool:
52
+ return ActivityContext.is_set()
53
+
54
+
55
+ def info() -> ActivityInfo:
56
+ return ActivityContext.get().info()
57
+
58
+
59
+ class ActivityContext(ABC):
60
+ _var: ContextVar["ActivityContext"] = ContextVar("activity")
61
+
62
+ @abstractmethod
63
+ def info(self) -> ActivityInfo: ...
64
+
65
+ @abstractmethod
66
+ def client(self) -> Client: ...
67
+
68
+ @contextmanager
69
+ def _activate(self) -> Iterator[None]:
70
+ token = ActivityContext._var.set(self)
71
+ yield None
72
+ ActivityContext._var.reset(token)
73
+
74
+ @staticmethod
75
+ def is_set() -> bool:
76
+ return ActivityContext._var.get(None) is not None
77
+
78
+ @staticmethod
79
+ def get() -> "ActivityContext":
80
+ return ActivityContext._var.get()
81
+
82
+
83
+ @dataclass(frozen=True)
84
+ class ActivityParameter:
85
+ name: str
86
+ type_hint: Type | None
87
+ has_default: bool
88
+ default_value: Any
89
+
90
+
91
+ class ExecutionStrategy(Enum):
92
+ ASYNC = "async"
93
+ THREAD_POOL = "thread_pool"
94
+
95
+
96
+ class ActivityDefinitionOptions(TypedDict, total=False):
97
+ name: str
98
+
99
+
100
+ P = ParamSpec("P")
101
+ T = TypeVar("T")
102
+
103
+
104
+ class ActivityDefinition(Generic[P, T]):
105
+ def __init__(
106
+ self,
107
+ wrapped: Callable[P, T],
108
+ name: str,
109
+ strategy: ExecutionStrategy,
110
+ params: list[ActivityParameter],
111
+ result_type: Type[T],
112
+ ):
113
+ self._wrapped = wrapped
114
+ self._name = name
115
+ self._strategy = strategy
116
+ self._params = params
117
+ self._result_type = result_type
118
+ self._execution_options = ActivityOptions()
119
+ update_wrapper(self, wrapped)
120
+
121
+ def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T:
122
+ if WorkflowContext.is_set():
123
+ # If the original function is async then this is fine
124
+ # If it's not async then this is invalid typing, but still allowed
125
+ # Users can use execute as a guaranteed type safe option if the function is sync
126
+ return self.execute(*args, **kwargs) # type: ignore
127
+ return self._wrapped(*args, **kwargs)
128
+
129
+ def with_options(
130
+ self, **kwargs: Unpack[ActivityOptions]
131
+ ) -> "ActivityDefinition[P, T]":
132
+ res = ActivityDefinition(
133
+ self._wrapped, self._name, self.strategy, self.params, self.result_type
134
+ )
135
+ new_opts = self._execution_options.copy()
136
+ new_opts.update(kwargs)
137
+ res._execution_options = new_opts
138
+ return res
139
+
140
+ async def execute(self, *args: P.args, **kwargs: P.kwargs) -> T:
141
+ return await execute_activity(
142
+ self.name,
143
+ self.result_type,
144
+ *_to_parameters(self.params, args, kwargs),
145
+ **self._execution_options,
146
+ )
147
+
148
+ @property
149
+ def name(self) -> str:
150
+ return self._name
151
+
152
+ @property
153
+ def strategy(self) -> ExecutionStrategy:
154
+ return self._strategy
155
+
156
+ @property
157
+ def params(self) -> list[ActivityParameter]:
158
+ return self._params
159
+
160
+ @property
161
+ def result_type(self) -> Type[T]:
162
+ return self._result_type
163
+
164
+ @staticmethod
165
+ def wrap(
166
+ fn: Callable[P, T], opts: ActivityDefinitionOptions
167
+ ) -> "ActivityDefinition[P, T]":
168
+ name = fn.__qualname__
169
+ if "name" in opts and opts["name"]:
170
+ name = opts["name"]
171
+
172
+ strategy = ExecutionStrategy.THREAD_POOL
173
+ if inspect.iscoroutinefunction(fn) or inspect.iscoroutinefunction(fn.__call__): # type: ignore
174
+ strategy = ExecutionStrategy.ASYNC
175
+
176
+ params, result_type = _get_signature(fn)
177
+ return ActivityDefinition(fn, name, strategy, params, result_type)
178
+
179
+
180
+ ActivityDecorator = Callable[[Callable[P, T]], ActivityDefinition[P, T]]
181
+
182
+
183
+ @overload
184
+ def defn(fn: Callable[P, T]) -> ActivityDefinition[P, T]: ...
185
+
186
+
187
+ @overload
188
+ def defn(**kwargs: Unpack[ActivityDefinitionOptions]) -> ActivityDecorator: ...
189
+
190
+
191
+ def defn(
192
+ fn: Callable[P, T] | None = None, **kwargs: Unpack[ActivityDefinitionOptions]
193
+ ) -> ActivityDecorator | ActivityDefinition[P, T]:
194
+ options = ActivityDefinitionOptions(**kwargs)
195
+
196
+ def decorator(inner_fn: Callable[P, T]) -> ActivityDefinition[P, T]:
197
+ return ActivityDefinition.wrap(inner_fn, options)
198
+
199
+ if fn is not None:
200
+ return decorator(fn)
201
+
202
+ return decorator
203
+
204
+
205
+ def _get_signature(fn: Callable[P, T]) -> Tuple[list[ActivityParameter], Type[T]]:
206
+ sig = signature(fn)
207
+ args = sig.parameters
208
+ hints = get_type_hints(fn)
209
+ params = []
210
+ for name, param in args.items():
211
+ # "unbound functions" aren't a thing in the Python spec. We don't have a way to determine whether the function
212
+ # is part of a class or is standalone.
213
+ # Filter out the self parameter and hope they followed the convention.
214
+ if param.name == "self":
215
+ continue
216
+ default = None
217
+ has_default = False
218
+ if param.default != Parameter.empty:
219
+ default = param.default
220
+ has_default = param.default is not None
221
+ if param.kind in (Parameter.POSITIONAL_ONLY, Parameter.POSITIONAL_OR_KEYWORD):
222
+ type_hint = hints.get(name, None)
223
+ params.append(ActivityParameter(name, type_hint, has_default, default))
224
+ else:
225
+ raise ValueError(
226
+ f"Parameters must be positional. {name} is {param.kind}, and not valid"
227
+ )
228
+
229
+ # Treat unspecified return type
230
+ return_type = hints.get("return", dict)
231
+
232
+ return params, return_type
233
+
234
+
235
+ def _to_parameters(
236
+ params: list[ActivityParameter], args: Sequence[Any], kwargs: dict[str, Any]
237
+ ) -> list[Any]:
238
+ result: list[Any] = []
239
+ for value, param_spec in zip(args, params):
240
+ result.append(value)
241
+
242
+ i = len(result)
243
+ while i < len(params):
244
+ param = params[i]
245
+ if param.name not in kwargs and not param.has_default:
246
+ raise ValueError(f"Missing parameter: {param.name}")
247
+
248
+ value = kwargs.pop(param.name, param.default_value)
249
+ result.append(value)
250
+ i = i + 1
251
+
252
+ if len(kwargs) > 0:
253
+ raise ValueError(f"Unexpected keyword arguments: {kwargs}")
254
+
255
+ return result
@@ -0,0 +1,92 @@
1
+ # Auto-generated __init__.py file
2
+ # Import all generated protobuf modules
3
+ from . import common_pb2
4
+ from . import common_pb2_grpc
5
+ from . import decision_pb2
6
+ from . import decision_pb2_grpc
7
+ from . import domain_pb2
8
+ from . import domain_pb2_grpc
9
+ from . import error_pb2
10
+ from . import error_pb2_grpc
11
+ from . import history_pb2
12
+ from . import history_pb2_grpc
13
+ from . import query_pb2
14
+ from . import query_pb2_grpc
15
+ from . import service_domain_pb2
16
+ from . import service_domain_pb2_grpc
17
+ from . import service_meta_pb2
18
+ from . import service_meta_pb2_grpc
19
+ from . import service_visibility_pb2
20
+ from . import service_visibility_pb2_grpc
21
+ from . import service_worker_pb2
22
+ from . import service_worker_pb2_grpc
23
+ from . import service_workflow_pb2
24
+ from . import service_workflow_pb2_grpc
25
+ from . import tasklist_pb2
26
+ from . import tasklist_pb2_grpc
27
+ from . import visibility_pb2
28
+ from . import visibility_pb2_grpc
29
+ from . import workflow_pb2
30
+ from . import workflow_pb2_grpc
31
+
32
+ # Create cleaner aliases for easier imports
33
+ common = common_pb2
34
+ common_grpc = common_pb2_grpc
35
+ decision = decision_pb2
36
+ decision_grpc = decision_pb2_grpc
37
+ domain = domain_pb2
38
+ domain_grpc = domain_pb2_grpc
39
+ error = error_pb2
40
+ error_grpc = error_pb2_grpc
41
+ history = history_pb2
42
+ history_grpc = history_pb2_grpc
43
+ query = query_pb2
44
+ query_grpc = query_pb2_grpc
45
+ service_domain = service_domain_pb2
46
+ service_domain_grpc = service_domain_pb2_grpc
47
+ service_meta = service_meta_pb2
48
+ service_meta_grpc = service_meta_pb2_grpc
49
+ service_visibility = service_visibility_pb2
50
+ service_visibility_grpc = service_visibility_pb2_grpc
51
+ service_worker = service_worker_pb2
52
+ service_worker_grpc = service_worker_pb2_grpc
53
+ service_workflow = service_workflow_pb2
54
+ service_workflow_grpc = service_workflow_pb2_grpc
55
+ tasklist = tasklist_pb2
56
+ tasklist_grpc = tasklist_pb2_grpc
57
+ visibility = visibility_pb2
58
+ visibility_grpc = visibility_pb2_grpc
59
+ workflow = workflow_pb2
60
+ workflow_grpc = workflow_pb2_grpc
61
+
62
+ # Only expose clean module names (no _pb2)
63
+ __all__ = [
64
+ 'common',
65
+ 'common_grpc',
66
+ 'decision',
67
+ 'decision_grpc',
68
+ 'domain',
69
+ 'domain_grpc',
70
+ 'error',
71
+ 'error_grpc',
72
+ 'history',
73
+ 'history_grpc',
74
+ 'query',
75
+ 'query_grpc',
76
+ 'service_domain',
77
+ 'service_domain_grpc',
78
+ 'service_meta',
79
+ 'service_meta_grpc',
80
+ 'service_visibility',
81
+ 'service_visibility_grpc',
82
+ 'service_worker',
83
+ 'service_worker_grpc',
84
+ 'service_workflow',
85
+ 'service_workflow_grpc',
86
+ 'tasklist',
87
+ 'tasklist_grpc',
88
+ 'visibility',
89
+ 'visibility_grpc',
90
+ 'workflow',
91
+ 'workflow_grpc',
92
+ ]
@@ -0,0 +1,90 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: cadence/api/v1/common.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 5,
15
+ 29,
16
+ 0,
17
+ '',
18
+ 'cadence/api/v1/common.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x63\x61\x64\x65nce/api/v1/common.proto\x12\x13uber.cadence.api.v1\x1a\x1egoogle/protobuf/duration.proto\"8\n\x11WorkflowExecution\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x0e\n\x06run_id\x18\x02 \x01(\t\"\x1c\n\x0cWorkflowType\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x1c\n\x0c\x41\x63tivityType\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x17\n\x07Payload\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"*\n\x07\x46\x61ilure\x12\x0e\n\x06reason\x18\x01 \x01(\t\x12\x0f\n\x07\x64\x65tails\x18\x02 \x01(\x0c\"\x8a\x01\n\x04Memo\x12\x35\n\x06\x66ields\x18\x01 \x03(\x0b\x32%.uber.cadence.api.v1.Memo.FieldsEntry\x1aK\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.uber.cadence.api.v1.Payload:\x02\x38\x01\"\x8e\x01\n\x06Header\x12\x37\n\x06\x66ields\x18\x01 \x03(\x0b\x32\'.uber.cadence.api.v1.Header.FieldsEntry\x1aK\n\x0b\x46ieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.uber.cadence.api.v1.Payload:\x02\x38\x01\"\xb8\x01\n\x10SearchAttributes\x12P\n\x0eindexed_fields\x18\x01 \x03(\x0b\x32\x38.uber.cadence.api.v1.SearchAttributes.IndexedFieldsEntry\x1aR\n\x12IndexedFieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12+\n\x05value\x18\x02 \x01(\x0b\x32\x1c.uber.cadence.api.v1.Payload:\x02\x38\x01\"R\n\x08\x44\x61taBlob\x12\x38\n\rencoding_type\x18\x01 \x01(\x0e\x32!.uber.cadence.api.v1.EncodingType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\":\n\x11WorkerVersionInfo\x12\x0c\n\x04impl\x18\x01 \x01(\t\x12\x17\n\x0f\x66\x65\x61ture_version\x18\x02 \x01(\t\";\n\x17SupportedClientVersions\x12\x0e\n\x06go_sdk\x18\x01 \x01(\t\x12\x10\n\x08java_sdk\x18\x02 \x01(\t\"\x8b\x02\n\x0bRetryPolicy\x12\x33\n\x10initial_interval\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x1b\n\x13\x62\x61\x63koff_coefficient\x18\x02 \x01(\x01\x12\x33\n\x10maximum_interval\x18\x03 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x18\n\x10maximum_attempts\x18\x04 \x01(\x05\x12#\n\x1bnon_retryable_error_reasons\x18\x05 \x03(\t\x12\x36\n\x13\x65xpiration_interval\x18\x06 \x01(\x0b\x32\x19.google.protobuf.Duration\"`\n\x17IsolationGroupPartition\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x37\n\x05state\x18\x02 \x01(\x0e\x32(.uber.cadence.api.v1.IsolationGroupState\"e\n\x1bIsolationGroupConfiguration\x12\x46\n\x10isolation_groups\x18\x01 \x03(\x0b\x32,.uber.cadence.api.v1.IsolationGroupPartition\"\x95\x01\n\x1a\x41syncWorkflowConfiguration\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x1d\n\x15predefined_queue_name\x18\x02 \x01(\t\x12\x12\n\nqueue_type\x18\x03 \x01(\t\x12\x33\n\x0cqueue_config\x18\x04 \x01(\x0b\x32\x1d.uber.cadence.api.v1.DataBlob\"\xc6\x02\n\x1c\x41\x63tiveClusterSelectionPolicy\x12\x45\n\x08strategy\x18\x01 \x01(\x0e\x32\x33.uber.cadence.api.v1.ActiveClusterSelectionStrategy\x12\x63\n#active_cluster_sticky_region_config\x18\x02 \x01(\x0b\x32\x34.uber.cadence.api.v1.ActiveClusterStickyRegionConfigH\x00\x12g\n%active_cluster_external_entity_config\x18\x03 \x01(\x0b\x32\x36.uber.cadence.api.v1.ActiveClusterExternalEntityConfigH\x00\x42\x11\n\x0fstrategy_config\"8\n\x1f\x41\x63tiveClusterStickyRegionConfig\x12\x15\n\rsticky_region\x18\x01 \x01(\t\"^\n!ActiveClusterExternalEntityConfig\x12\x1c\n\x14\x65xternal_entity_type\x18\x01 \x01(\t\x12\x1b\n\x13\x65xternal_entity_key\x18\x02 \x01(\t*w\n\x0c\x45ncodingType\x12\x19\n\x15\x45NCODING_TYPE_INVALID\x10\x00\x12\x1a\n\x16\x45NCODING_TYPE_THRIFTRW\x10\x01\x12\x16\n\x12\x45NCODING_TYPE_JSON\x10\x02\x12\x18\n\x14\x45NCODING_TYPE_PROTO3\x10\x03*~\n\x13IsolationGroupState\x12!\n\x1dISOLATION_GROUP_STATE_INVALID\x10\x00\x12!\n\x1dISOLATION_GROUP_STATE_HEALTHY\x10\x01\x12!\n\x1dISOLATION_GROUP_STATE_DRAINED\x10\x02*\xbb\x01\n\x1e\x41\x63tiveClusterSelectionStrategy\x12-\n)ACTIVE_CLUSTER_SELECTION_STRATEGY_INVALID\x10\x00\x12\x33\n/ACTIVE_CLUSTER_SELECTION_STRATEGY_REGION_STICKY\x10\x01\x12\x35\n1ACTIVE_CLUSTER_SELECTION_STRATEGY_EXTERNAL_ENTITY\x10\x02\x42[\n\x17\x63om.uber.cadence.api.v1B\x0b\x43ommonProtoP\x01Z1github.com/uber/cadence-idl/go/proto/api/v1;apiv1b\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cadence.api.v1.common_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'\n\027com.uber.cadence.api.v1B\013CommonProtoP\001Z1github.com/uber/cadence-idl/go/proto/api/v1;apiv1'
36
+ _globals['_MEMO_FIELDSENTRY']._loaded_options = None
37
+ _globals['_MEMO_FIELDSENTRY']._serialized_options = b'8\001'
38
+ _globals['_HEADER_FIELDSENTRY']._loaded_options = None
39
+ _globals['_HEADER_FIELDSENTRY']._serialized_options = b'8\001'
40
+ _globals['_SEARCHATTRIBUTES_INDEXEDFIELDSENTRY']._loaded_options = None
41
+ _globals['_SEARCHATTRIBUTES_INDEXEDFIELDSENTRY']._serialized_options = b'8\001'
42
+ _globals['_ENCODINGTYPE']._serialized_start=2055
43
+ _globals['_ENCODINGTYPE']._serialized_end=2174
44
+ _globals['_ISOLATIONGROUPSTATE']._serialized_start=2176
45
+ _globals['_ISOLATIONGROUPSTATE']._serialized_end=2302
46
+ _globals['_ACTIVECLUSTERSELECTIONSTRATEGY']._serialized_start=2305
47
+ _globals['_ACTIVECLUSTERSELECTIONSTRATEGY']._serialized_end=2492
48
+ _globals['_WORKFLOWEXECUTION']._serialized_start=84
49
+ _globals['_WORKFLOWEXECUTION']._serialized_end=140
50
+ _globals['_WORKFLOWTYPE']._serialized_start=142
51
+ _globals['_WORKFLOWTYPE']._serialized_end=170
52
+ _globals['_ACTIVITYTYPE']._serialized_start=172
53
+ _globals['_ACTIVITYTYPE']._serialized_end=200
54
+ _globals['_PAYLOAD']._serialized_start=202
55
+ _globals['_PAYLOAD']._serialized_end=225
56
+ _globals['_FAILURE']._serialized_start=227
57
+ _globals['_FAILURE']._serialized_end=269
58
+ _globals['_MEMO']._serialized_start=272
59
+ _globals['_MEMO']._serialized_end=410
60
+ _globals['_MEMO_FIELDSENTRY']._serialized_start=335
61
+ _globals['_MEMO_FIELDSENTRY']._serialized_end=410
62
+ _globals['_HEADER']._serialized_start=413
63
+ _globals['_HEADER']._serialized_end=555
64
+ _globals['_HEADER_FIELDSENTRY']._serialized_start=335
65
+ _globals['_HEADER_FIELDSENTRY']._serialized_end=410
66
+ _globals['_SEARCHATTRIBUTES']._serialized_start=558
67
+ _globals['_SEARCHATTRIBUTES']._serialized_end=742
68
+ _globals['_SEARCHATTRIBUTES_INDEXEDFIELDSENTRY']._serialized_start=660
69
+ _globals['_SEARCHATTRIBUTES_INDEXEDFIELDSENTRY']._serialized_end=742
70
+ _globals['_DATABLOB']._serialized_start=744
71
+ _globals['_DATABLOB']._serialized_end=826
72
+ _globals['_WORKERVERSIONINFO']._serialized_start=828
73
+ _globals['_WORKERVERSIONINFO']._serialized_end=886
74
+ _globals['_SUPPORTEDCLIENTVERSIONS']._serialized_start=888
75
+ _globals['_SUPPORTEDCLIENTVERSIONS']._serialized_end=947
76
+ _globals['_RETRYPOLICY']._serialized_start=950
77
+ _globals['_RETRYPOLICY']._serialized_end=1217
78
+ _globals['_ISOLATIONGROUPPARTITION']._serialized_start=1219
79
+ _globals['_ISOLATIONGROUPPARTITION']._serialized_end=1315
80
+ _globals['_ISOLATIONGROUPCONFIGURATION']._serialized_start=1317
81
+ _globals['_ISOLATIONGROUPCONFIGURATION']._serialized_end=1418
82
+ _globals['_ASYNCWORKFLOWCONFIGURATION']._serialized_start=1421
83
+ _globals['_ASYNCWORKFLOWCONFIGURATION']._serialized_end=1570
84
+ _globals['_ACTIVECLUSTERSELECTIONPOLICY']._serialized_start=1573
85
+ _globals['_ACTIVECLUSTERSELECTIONPOLICY']._serialized_end=1899
86
+ _globals['_ACTIVECLUSTERSTICKYREGIONCONFIG']._serialized_start=1901
87
+ _globals['_ACTIVECLUSTERSTICKYREGIONCONFIG']._serialized_end=1957
88
+ _globals['_ACTIVECLUSTEREXTERNALENTITYCONFIG']._serialized_start=1959
89
+ _globals['_ACTIVECLUSTEREXTERNALENTITYCONFIG']._serialized_end=2053
90
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,200 @@
1
+ from google.protobuf import duration_pb2 as _duration_pb2
2
+ from google.protobuf.internal import containers as _containers
3
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
4
+ from google.protobuf import descriptor as _descriptor
5
+ from google.protobuf import message as _message
6
+ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
7
+
8
+ DESCRIPTOR: _descriptor.FileDescriptor
9
+
10
+ class EncodingType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
11
+ __slots__ = ()
12
+ ENCODING_TYPE_INVALID: _ClassVar[EncodingType]
13
+ ENCODING_TYPE_THRIFTRW: _ClassVar[EncodingType]
14
+ ENCODING_TYPE_JSON: _ClassVar[EncodingType]
15
+ ENCODING_TYPE_PROTO3: _ClassVar[EncodingType]
16
+
17
+ class IsolationGroupState(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
18
+ __slots__ = ()
19
+ ISOLATION_GROUP_STATE_INVALID: _ClassVar[IsolationGroupState]
20
+ ISOLATION_GROUP_STATE_HEALTHY: _ClassVar[IsolationGroupState]
21
+ ISOLATION_GROUP_STATE_DRAINED: _ClassVar[IsolationGroupState]
22
+
23
+ class ActiveClusterSelectionStrategy(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
24
+ __slots__ = ()
25
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_INVALID: _ClassVar[ActiveClusterSelectionStrategy]
26
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_REGION_STICKY: _ClassVar[ActiveClusterSelectionStrategy]
27
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_EXTERNAL_ENTITY: _ClassVar[ActiveClusterSelectionStrategy]
28
+ ENCODING_TYPE_INVALID: EncodingType
29
+ ENCODING_TYPE_THRIFTRW: EncodingType
30
+ ENCODING_TYPE_JSON: EncodingType
31
+ ENCODING_TYPE_PROTO3: EncodingType
32
+ ISOLATION_GROUP_STATE_INVALID: IsolationGroupState
33
+ ISOLATION_GROUP_STATE_HEALTHY: IsolationGroupState
34
+ ISOLATION_GROUP_STATE_DRAINED: IsolationGroupState
35
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_INVALID: ActiveClusterSelectionStrategy
36
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_REGION_STICKY: ActiveClusterSelectionStrategy
37
+ ACTIVE_CLUSTER_SELECTION_STRATEGY_EXTERNAL_ENTITY: ActiveClusterSelectionStrategy
38
+
39
+ class WorkflowExecution(_message.Message):
40
+ __slots__ = ("workflow_id", "run_id")
41
+ WORKFLOW_ID_FIELD_NUMBER: _ClassVar[int]
42
+ RUN_ID_FIELD_NUMBER: _ClassVar[int]
43
+ workflow_id: str
44
+ run_id: str
45
+ def __init__(self, workflow_id: _Optional[str] = ..., run_id: _Optional[str] = ...) -> None: ...
46
+
47
+ class WorkflowType(_message.Message):
48
+ __slots__ = ("name",)
49
+ NAME_FIELD_NUMBER: _ClassVar[int]
50
+ name: str
51
+ def __init__(self, name: _Optional[str] = ...) -> None: ...
52
+
53
+ class ActivityType(_message.Message):
54
+ __slots__ = ("name",)
55
+ NAME_FIELD_NUMBER: _ClassVar[int]
56
+ name: str
57
+ def __init__(self, name: _Optional[str] = ...) -> None: ...
58
+
59
+ class Payload(_message.Message):
60
+ __slots__ = ("data",)
61
+ DATA_FIELD_NUMBER: _ClassVar[int]
62
+ data: bytes
63
+ def __init__(self, data: _Optional[bytes] = ...) -> None: ...
64
+
65
+ class Failure(_message.Message):
66
+ __slots__ = ("reason", "details")
67
+ REASON_FIELD_NUMBER: _ClassVar[int]
68
+ DETAILS_FIELD_NUMBER: _ClassVar[int]
69
+ reason: str
70
+ details: bytes
71
+ def __init__(self, reason: _Optional[str] = ..., details: _Optional[bytes] = ...) -> None: ...
72
+
73
+ class Memo(_message.Message):
74
+ __slots__ = ("fields",)
75
+ class FieldsEntry(_message.Message):
76
+ __slots__ = ("key", "value")
77
+ KEY_FIELD_NUMBER: _ClassVar[int]
78
+ VALUE_FIELD_NUMBER: _ClassVar[int]
79
+ key: str
80
+ value: Payload
81
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Payload, _Mapping]] = ...) -> None: ...
82
+ FIELDS_FIELD_NUMBER: _ClassVar[int]
83
+ fields: _containers.MessageMap[str, Payload]
84
+ def __init__(self, fields: _Optional[_Mapping[str, Payload]] = ...) -> None: ...
85
+
86
+ class Header(_message.Message):
87
+ __slots__ = ("fields",)
88
+ class FieldsEntry(_message.Message):
89
+ __slots__ = ("key", "value")
90
+ KEY_FIELD_NUMBER: _ClassVar[int]
91
+ VALUE_FIELD_NUMBER: _ClassVar[int]
92
+ key: str
93
+ value: Payload
94
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Payload, _Mapping]] = ...) -> None: ...
95
+ FIELDS_FIELD_NUMBER: _ClassVar[int]
96
+ fields: _containers.MessageMap[str, Payload]
97
+ def __init__(self, fields: _Optional[_Mapping[str, Payload]] = ...) -> None: ...
98
+
99
+ class SearchAttributes(_message.Message):
100
+ __slots__ = ("indexed_fields",)
101
+ class IndexedFieldsEntry(_message.Message):
102
+ __slots__ = ("key", "value")
103
+ KEY_FIELD_NUMBER: _ClassVar[int]
104
+ VALUE_FIELD_NUMBER: _ClassVar[int]
105
+ key: str
106
+ value: Payload
107
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[_Union[Payload, _Mapping]] = ...) -> None: ...
108
+ INDEXED_FIELDS_FIELD_NUMBER: _ClassVar[int]
109
+ indexed_fields: _containers.MessageMap[str, Payload]
110
+ def __init__(self, indexed_fields: _Optional[_Mapping[str, Payload]] = ...) -> None: ...
111
+
112
+ class DataBlob(_message.Message):
113
+ __slots__ = ("encoding_type", "data")
114
+ ENCODING_TYPE_FIELD_NUMBER: _ClassVar[int]
115
+ DATA_FIELD_NUMBER: _ClassVar[int]
116
+ encoding_type: EncodingType
117
+ data: bytes
118
+ def __init__(self, encoding_type: _Optional[_Union[EncodingType, str]] = ..., data: _Optional[bytes] = ...) -> None: ...
119
+
120
+ class WorkerVersionInfo(_message.Message):
121
+ __slots__ = ("impl", "feature_version")
122
+ IMPL_FIELD_NUMBER: _ClassVar[int]
123
+ FEATURE_VERSION_FIELD_NUMBER: _ClassVar[int]
124
+ impl: str
125
+ feature_version: str
126
+ def __init__(self, impl: _Optional[str] = ..., feature_version: _Optional[str] = ...) -> None: ...
127
+
128
+ class SupportedClientVersions(_message.Message):
129
+ __slots__ = ("go_sdk", "java_sdk")
130
+ GO_SDK_FIELD_NUMBER: _ClassVar[int]
131
+ JAVA_SDK_FIELD_NUMBER: _ClassVar[int]
132
+ go_sdk: str
133
+ java_sdk: str
134
+ def __init__(self, go_sdk: _Optional[str] = ..., java_sdk: _Optional[str] = ...) -> None: ...
135
+
136
+ class RetryPolicy(_message.Message):
137
+ __slots__ = ("initial_interval", "backoff_coefficient", "maximum_interval", "maximum_attempts", "non_retryable_error_reasons", "expiration_interval")
138
+ INITIAL_INTERVAL_FIELD_NUMBER: _ClassVar[int]
139
+ BACKOFF_COEFFICIENT_FIELD_NUMBER: _ClassVar[int]
140
+ MAXIMUM_INTERVAL_FIELD_NUMBER: _ClassVar[int]
141
+ MAXIMUM_ATTEMPTS_FIELD_NUMBER: _ClassVar[int]
142
+ NON_RETRYABLE_ERROR_REASONS_FIELD_NUMBER: _ClassVar[int]
143
+ EXPIRATION_INTERVAL_FIELD_NUMBER: _ClassVar[int]
144
+ initial_interval: _duration_pb2.Duration
145
+ backoff_coefficient: float
146
+ maximum_interval: _duration_pb2.Duration
147
+ maximum_attempts: int
148
+ non_retryable_error_reasons: _containers.RepeatedScalarFieldContainer[str]
149
+ expiration_interval: _duration_pb2.Duration
150
+ def __init__(self, initial_interval: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., backoff_coefficient: _Optional[float] = ..., maximum_interval: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ..., maximum_attempts: _Optional[int] = ..., non_retryable_error_reasons: _Optional[_Iterable[str]] = ..., expiration_interval: _Optional[_Union[_duration_pb2.Duration, _Mapping]] = ...) -> None: ...
151
+
152
+ class IsolationGroupPartition(_message.Message):
153
+ __slots__ = ("name", "state")
154
+ NAME_FIELD_NUMBER: _ClassVar[int]
155
+ STATE_FIELD_NUMBER: _ClassVar[int]
156
+ name: str
157
+ state: IsolationGroupState
158
+ def __init__(self, name: _Optional[str] = ..., state: _Optional[_Union[IsolationGroupState, str]] = ...) -> None: ...
159
+
160
+ class IsolationGroupConfiguration(_message.Message):
161
+ __slots__ = ("isolation_groups",)
162
+ ISOLATION_GROUPS_FIELD_NUMBER: _ClassVar[int]
163
+ isolation_groups: _containers.RepeatedCompositeFieldContainer[IsolationGroupPartition]
164
+ def __init__(self, isolation_groups: _Optional[_Iterable[_Union[IsolationGroupPartition, _Mapping]]] = ...) -> None: ...
165
+
166
+ class AsyncWorkflowConfiguration(_message.Message):
167
+ __slots__ = ("enabled", "predefined_queue_name", "queue_type", "queue_config")
168
+ ENABLED_FIELD_NUMBER: _ClassVar[int]
169
+ PREDEFINED_QUEUE_NAME_FIELD_NUMBER: _ClassVar[int]
170
+ QUEUE_TYPE_FIELD_NUMBER: _ClassVar[int]
171
+ QUEUE_CONFIG_FIELD_NUMBER: _ClassVar[int]
172
+ enabled: bool
173
+ predefined_queue_name: str
174
+ queue_type: str
175
+ queue_config: DataBlob
176
+ def __init__(self, enabled: bool = ..., predefined_queue_name: _Optional[str] = ..., queue_type: _Optional[str] = ..., queue_config: _Optional[_Union[DataBlob, _Mapping]] = ...) -> None: ...
177
+
178
+ class ActiveClusterSelectionPolicy(_message.Message):
179
+ __slots__ = ("strategy", "active_cluster_sticky_region_config", "active_cluster_external_entity_config")
180
+ STRATEGY_FIELD_NUMBER: _ClassVar[int]
181
+ ACTIVE_CLUSTER_STICKY_REGION_CONFIG_FIELD_NUMBER: _ClassVar[int]
182
+ ACTIVE_CLUSTER_EXTERNAL_ENTITY_CONFIG_FIELD_NUMBER: _ClassVar[int]
183
+ strategy: ActiveClusterSelectionStrategy
184
+ active_cluster_sticky_region_config: ActiveClusterStickyRegionConfig
185
+ active_cluster_external_entity_config: ActiveClusterExternalEntityConfig
186
+ def __init__(self, strategy: _Optional[_Union[ActiveClusterSelectionStrategy, str]] = ..., active_cluster_sticky_region_config: _Optional[_Union[ActiveClusterStickyRegionConfig, _Mapping]] = ..., active_cluster_external_entity_config: _Optional[_Union[ActiveClusterExternalEntityConfig, _Mapping]] = ...) -> None: ...
187
+
188
+ class ActiveClusterStickyRegionConfig(_message.Message):
189
+ __slots__ = ("sticky_region",)
190
+ STICKY_REGION_FIELD_NUMBER: _ClassVar[int]
191
+ sticky_region: str
192
+ def __init__(self, sticky_region: _Optional[str] = ...) -> None: ...
193
+
194
+ class ActiveClusterExternalEntityConfig(_message.Message):
195
+ __slots__ = ("external_entity_type", "external_entity_key")
196
+ EXTERNAL_ENTITY_TYPE_FIELD_NUMBER: _ClassVar[int]
197
+ EXTERNAL_ENTITY_KEY_FIELD_NUMBER: _ClassVar[int]
198
+ external_entity_type: str
199
+ external_entity_key: str
200
+ def __init__(self, external_entity_type: _Optional[str] = ..., external_entity_key: _Optional[str] = ...) -> None: ...
@@ -0,0 +1,24 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+
7
+ GRPC_GENERATED_VERSION = '1.71.2'
8
+ GRPC_VERSION = grpc.__version__
9
+ _version_not_supported = False
10
+
11
+ try:
12
+ from grpc._utilities import first_version_is_lower
13
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
14
+ except ImportError:
15
+ _version_not_supported = True
16
+
17
+ if _version_not_supported:
18
+ raise RuntimeError(
19
+ f'The grpc package installed is at version {GRPC_VERSION},'
20
+ + f' but the generated code in cadence/api/v1/common_pb2_grpc.py depends on'
21
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
22
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
23
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
24
+ )