Skip to content

Commit eacdca8

Browse files
authored
Sdk core related updates (#191)
Fixes #187
1 parent 87b28a7 commit eacdca8

29 files changed

+773
-364
lines changed

temporalio/bridge/Cargo.lock

Lines changed: 10 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/bridge/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ crate-type = ["cdylib"]
99

1010
[dependencies]
1111
log = "0.4"
12+
once_cell = "1.16.0"
1213
parking_lot = "0.12"
1314
prost = "0.11"
1415
prost-types = "0.11"
@@ -21,10 +22,11 @@ temporal-sdk-core-protos = { version = "0.1.0", path = "./sdk-core/sdk-core-prot
2122
tokio = "1.15"
2223
tokio-stream = "0.1"
2324
tonic = "0.8"
25+
tracing = "0.1"
2426
url = "2.2"
2527

2628
[profile.release]
2729
opt-level = 3
2830
debug = false
2931
lto = true
30-
incremental = false
32+
incremental = false

temporalio/bridge/client.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import google.protobuf.message
1313

14+
import temporalio.bridge.runtime
1415
import temporalio.bridge.temporal_sdk_bridge
1516
from temporalio.bridge.temporal_sdk_bridge import RPCError
1617

@@ -68,16 +69,30 @@ class Client:
6869
"""RPC client using SDK Core."""
6970

7071
@staticmethod
71-
async def connect(config: ClientConfig) -> Client:
72+
async def connect(
73+
runtime: temporalio.bridge.runtime.Runtime, config: ClientConfig
74+
) -> Client:
7275
"""Establish connection with server."""
7376
return Client(
74-
await temporalio.bridge.temporal_sdk_bridge.connect_client(config)
77+
runtime,
78+
await temporalio.bridge.temporal_sdk_bridge.connect_client(
79+
runtime._ref, config
80+
),
7581
)
7682

77-
def __init__(self, ref: temporalio.bridge.temporal_sdk_bridge.ClientRef):
83+
def __init__(
84+
self,
85+
runtime: temporalio.bridge.runtime.Runtime,
86+
ref: temporalio.bridge.temporal_sdk_bridge.ClientRef,
87+
):
7888
"""Initialize client with underlying SDK Core reference."""
89+
self._runtime = runtime
7990
self._ref = ref
8091

92+
def update_metadata(self, metadata: Mapping[str, str]) -> None:
93+
"""Update underlying metadata on Core client."""
94+
self._ref.update_metadata(metadata)
95+
8196
async def call(
8297
self,
8398
*,

temporalio/bridge/proto/workflow_commands/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
CompleteWorkflowExecution,
88
ContinueAsNewWorkflowExecution,
99
FailWorkflowExecution,
10+
ModifyWorkflowProperties,
1011
QueryResult,
1112
QuerySuccess,
1213
RequestCancelActivity,
@@ -31,6 +32,7 @@
3132
"CompleteWorkflowExecution",
3233
"ContinueAsNewWorkflowExecution",
3334
"FailWorkflowExecution",
35+
"ModifyWorkflowProperties",
3436
"QueryResult",
3537
"QuerySuccess",
3638
"RequestCancelActivity",

temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.py

Lines changed: 64 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporalio/bridge/proto/workflow_commands/workflow_commands_pb2.pyi

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class WorkflowCommand(google.protobuf.message.Message):
9090
SCHEDULE_LOCAL_ACTIVITY_FIELD_NUMBER: builtins.int
9191
REQUEST_CANCEL_LOCAL_ACTIVITY_FIELD_NUMBER: builtins.int
9292
UPSERT_WORKFLOW_SEARCH_ATTRIBUTES_FIELD_NUMBER: builtins.int
93+
MODIFY_WORKFLOW_PROPERTIES_FIELD_NUMBER: builtins.int
9394
@property
9495
def start_timer(self) -> global___StartTimer: ...
9596
@property
@@ -138,6 +139,8 @@ class WorkflowCommand(google.protobuf.message.Message):
138139
def upsert_workflow_search_attributes(
139140
self,
140141
) -> global___UpsertWorkflowSearchAttributes: ...
142+
@property
143+
def modify_workflow_properties(self) -> global___ModifyWorkflowProperties: ...
141144
def __init__(
142145
self,
143146
*,
@@ -165,6 +168,7 @@ class WorkflowCommand(google.protobuf.message.Message):
165168
request_cancel_local_activity: global___RequestCancelLocalActivity | None = ...,
166169
upsert_workflow_search_attributes: global___UpsertWorkflowSearchAttributes
167170
| None = ...,
171+
modify_workflow_properties: global___ModifyWorkflowProperties | None = ...,
168172
) -> None: ...
169173
def HasField(
170174
self,
@@ -183,6 +187,8 @@ class WorkflowCommand(google.protobuf.message.Message):
183187
b"continue_as_new_workflow_execution",
184188
"fail_workflow_execution",
185189
b"fail_workflow_execution",
190+
"modify_workflow_properties",
191+
b"modify_workflow_properties",
186192
"request_cancel_activity",
187193
b"request_cancel_activity",
188194
"request_cancel_external_workflow_execution",
@@ -226,6 +232,8 @@ class WorkflowCommand(google.protobuf.message.Message):
226232
b"continue_as_new_workflow_execution",
227233
"fail_workflow_execution",
228234
b"fail_workflow_execution",
235+
"modify_workflow_properties",
236+
b"modify_workflow_properties",
229237
"request_cancel_activity",
230238
b"request_cancel_activity",
231239
"request_cancel_external_workflow_execution",
@@ -273,6 +281,7 @@ class WorkflowCommand(google.protobuf.message.Message):
273281
"schedule_local_activity",
274282
"request_cancel_local_activity",
275283
"upsert_workflow_search_attributes",
284+
"modify_workflow_properties",
276285
] | None: ...
277286

278287
global___WorkflowCommand = WorkflowCommand
@@ -352,7 +361,6 @@ class ScheduleActivity(google.protobuf.message.Message):
352361
SEQ_FIELD_NUMBER: builtins.int
353362
ACTIVITY_ID_FIELD_NUMBER: builtins.int
354363
ACTIVITY_TYPE_FIELD_NUMBER: builtins.int
355-
NAMESPACE_FIELD_NUMBER: builtins.int
356364
TASK_QUEUE_FIELD_NUMBER: builtins.int
357365
HEADERS_FIELD_NUMBER: builtins.int
358366
ARGUMENTS_FIELD_NUMBER: builtins.int
@@ -367,7 +375,6 @@ class ScheduleActivity(google.protobuf.message.Message):
367375
"""/ Lang's incremental sequence number, used as the operation identifier"""
368376
activity_id: builtins.str
369377
activity_type: builtins.str
370-
namespace: builtins.str
371378
task_queue: builtins.str
372379
"""The name of the task queue to place this activity request in"""
373380
@property
@@ -422,7 +429,6 @@ class ScheduleActivity(google.protobuf.message.Message):
422429
seq: builtins.int = ...,
423430
activity_id: builtins.str = ...,
424431
activity_type: builtins.str = ...,
425-
namespace: builtins.str = ...,
426432
task_queue: builtins.str = ...,
427433
headers: collections.abc.Mapping[
428434
builtins.str, temporalio.api.common.v1.message_pb2.Payload
@@ -472,8 +478,6 @@ class ScheduleActivity(google.protobuf.message.Message):
472478
b"headers",
473479
"heartbeat_timeout",
474480
b"heartbeat_timeout",
475-
"namespace",
476-
b"namespace",
477481
"retry_policy",
478482
b"retry_policy",
479483
"schedule_to_close_timeout",
@@ -1531,3 +1535,27 @@ class UpsertWorkflowSearchAttributes(google.protobuf.message.Message):
15311535
) -> None: ...
15321536

15331537
global___UpsertWorkflowSearchAttributes = UpsertWorkflowSearchAttributes
1538+
1539+
class ModifyWorkflowProperties(google.protobuf.message.Message):
1540+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
1541+
1542+
UPSERTED_MEMO_FIELD_NUMBER: builtins.int
1543+
@property
1544+
def upserted_memo(self) -> temporalio.api.common.v1.message_pb2.Memo:
1545+
"""If set, update the workflow memo with the provided values. The values will be merged with
1546+
the existing memo. If the user wants to delete values, a default/empty Payload should be
1547+
used as the value for the key being deleted.
1548+
"""
1549+
def __init__(
1550+
self,
1551+
*,
1552+
upserted_memo: temporalio.api.common.v1.message_pb2.Memo | None = ...,
1553+
) -> None: ...
1554+
def HasField(
1555+
self, field_name: typing_extensions.Literal["upserted_memo", b"upserted_memo"]
1556+
) -> builtins.bool: ...
1557+
def ClearField(
1558+
self, field_name: typing_extensions.Literal["upserted_memo", b"upserted_memo"]
1559+
) -> None: ...
1560+
1561+
global___ModifyWorkflowProperties = ModifyWorkflowProperties

0 commit comments

Comments
 (0)