Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
21 changes: 13 additions & 8 deletions scripts/gen_bridge_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def generate_rust_service_call(service_descriptor: ServiceDescriptor) -> str:
call: RpcCall,
) -> PyResult<Bound<'p, PyAny>> {
self.runtime.assert_same_process("use client")?;
use temporalio_client::${descriptor_name};
let mut retry_client = self.retry_client.clone();
use temporalio_client::grpc::${descriptor_name};
let mut connection = self.connection.clone();
self.runtime.future_into_py(py, async move {
let bytes = match call.rpc.as_str() {
$match_arms
Expand Down Expand Up @@ -203,26 +203,31 @@ def generate_rust_service_call(service_descriptor: ServiceDescriptor) -> str:
if not method.client_streaming and not method.server_streaming
]

service_method = pascal_to_snake(sanitized_service_name)
match_arms = [
generate_rust_match_arm(sanitized_service_name, method)
generate_rust_match_arm(sanitized_service_name, service_method, method)
for method in sorted(methods, key=lambda m: m.name)
]

return call_template.substitute(
service_name=pascal_to_snake(sanitized_service_name),
service_name=service_method,
descriptor_name=sanitized_service_name,
match_arms="\n".join(match_arms),
)


def generate_rust_match_arm(trait_name: str, method: MethodDescriptor) -> str:
def generate_rust_match_arm(
trait_name: str, service_method: str, method: MethodDescriptor
) -> str:
match_template = Template("""\
"$method_name" => {
rpc_call!(retry_client, call, $trait_name, $method_name)
"$method_name" => {
rpc_call!(connection, call, $trait_name, $service_method, $method_name)
}""")

return match_template.substitute(
method_name=pascal_to_snake(method.name), trait_name=trait_name
method_name=pascal_to_snake(method.name),
trait_name=trait_name,
service_method=service_method,
)


Expand Down
5 changes: 2 additions & 3 deletions temporalio/api/enums/v1/workflow_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions temporalio/api/enums/v1/workflow_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,6 @@ class _SuggestContinueAsNewReasonEnumTypeWrapper(
_SuggestContinueAsNewReason.ValueType
) # 3
"""Workflow's count of completed plus in-flight updates is too large."""
SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED: (
_SuggestContinueAsNewReason.ValueType
) # 4
"""Workflow's Target Worker Deployment Version is different from its
Current Version and the workflow is versioned.
"""

class SuggestContinueAsNewReason(
_SuggestContinueAsNewReason, metaclass=_SuggestContinueAsNewReasonEnumTypeWrapper
Expand All @@ -582,10 +576,4 @@ SUGGEST_CONTINUE_AS_NEW_REASON_TOO_MANY_UPDATES: (
SuggestContinueAsNewReason.ValueType
) # 3
"""Workflow's count of completed plus in-flight updates is too large."""
SUGGEST_CONTINUE_AS_NEW_REASON_TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED: (
SuggestContinueAsNewReason.ValueType
) # 4
"""Workflow's Target Worker Deployment Version is different from its
Current Version and the workflow is versioned.
"""
global___SuggestContinueAsNewReason = SuggestContinueAsNewReason
228 changes: 114 additions & 114 deletions temporalio/api/history/v1/message_pb2.py

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions temporalio/api/history/v1/message_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ class WorkflowTaskStartedEventAttributes(google.protobuf.message.Message):
REQUEST_ID_FIELD_NUMBER: builtins.int
SUGGEST_CONTINUE_AS_NEW_FIELD_NUMBER: builtins.int
SUGGEST_CONTINUE_AS_NEW_REASONS_FIELD_NUMBER: builtins.int
TARGET_WORKER_DEPLOYMENT_VERSION_CHANGED_FIELD_NUMBER: builtins.int
HISTORY_SIZE_BYTES_FIELD_NUMBER: builtins.int
WORKER_VERSION_FIELD_NUMBER: builtins.int
BUILD_ID_REDIRECT_COUNTER_FIELD_NUMBER: builtins.int
Expand All @@ -831,6 +832,11 @@ class WorkflowTaskStartedEventAttributes(google.protobuf.message.Message):
"""The reason(s) that suggest_continue_as_new is true, if it is.
Unset if suggest_continue_as_new is false.
"""
target_worker_deployment_version_changed: builtins.bool
"""True if Workflow's Target Worker Deployment Version is different from its Pinned Version and
the workflow is Pinned.
Experimental.
"""
history_size_bytes: builtins.int
"""Total history size in bytes, which the workflow might use to decide when to
continue-as-new regardless of the suggestion. Note that history event count is
Expand All @@ -857,6 +863,7 @@ class WorkflowTaskStartedEventAttributes(google.protobuf.message.Message):
temporalio.api.enums.v1.workflow_pb2.SuggestContinueAsNewReason.ValueType
]
| None = ...,
target_worker_deployment_version_changed: builtins.bool = ...,
history_size_bytes: builtins.int = ...,
worker_version: temporalio.api.common.v1.message_pb2.WorkerVersionStamp
| None = ...,
Expand All @@ -882,6 +889,8 @@ class WorkflowTaskStartedEventAttributes(google.protobuf.message.Message):
b"suggest_continue_as_new",
"suggest_continue_as_new_reasons",
b"suggest_continue_as_new_reasons",
"target_worker_deployment_version_changed",
b"target_worker_deployment_version_changed",
"worker_version",
b"worker_version",
],
Expand Down
Loading
Loading