Skip to content

Commit d704b50

Browse files
committed
In-workflow signal/query handler setting
1 parent e7741a1 commit d704b50

File tree

5 files changed

+385
-125
lines changed

5 files changed

+385
-125
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ asyncio_mode = "auto"
8888
log_cli = true
8989
log_cli_level = "INFO"
9090
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
91-
timeout = 120
91+
timeout = 300
9292
timeout_func_only = true
9393

9494
[tool.isort]

temporalio/worker/workflow.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
logger = logging.getLogger(__name__)
3333

3434
# Set to true to log all activations and completions
35-
LOG_PROTOS = False
35+
LOG_PROTOS = True
3636

3737
# Maximum amount of seconds a thread can run a workflow activation before a
3838
# deadlock is assumed
@@ -118,10 +118,9 @@ async def _handle_activation(
118118
) -> None:
119119
global LOG_PROTOS, DEADLOCK_TIMEOUT_SECONDS
120120

121-
# Build completion
122-
completion: Optional[
123-
temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion
124-
] = None
121+
# Build default success completion (e.g. remove-job-only activations)
122+
completion = temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion()
123+
completion.successful.SetInParent()
125124
try:
126125
# Decode the activation if there's a codec
127126
if self._data_converter.payload_codec:
@@ -165,10 +164,6 @@ async def _handle_activation(
165164
f"Failed handling activation on workflow with run ID {act.run_id}"
166165
)
167166
# Set completion failure
168-
if not completion:
169-
completion = (
170-
temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion()
171-
)
172167
completion.failed.failure.SetInParent()
173168
try:
174169
temporalio.exceptions.apply_exception_to_failure(
@@ -183,12 +178,6 @@ async def _handle_activation(
183178
completion.failed.failure.message = (
184179
f"Failed converting activation exception: {inner_err}"
185180
)
186-
# Make sure a completion always exists (technically will only be absent
187-
# on remove-job-only activations)
188-
if not completion:
189-
completion = (
190-
temporalio.bridge.proto.workflow_completion.WorkflowActivationCompletion()
191-
)
192181

193182
# Encode the completion if there's a codec
194183
if self._data_converter.payload_codec:

0 commit comments

Comments
 (0)