32
32
logger = logging .getLogger (__name__ )
33
33
34
34
# Set to true to log all activations and completions
35
- LOG_PROTOS = False
35
+ LOG_PROTOS = True
36
36
37
37
# Maximum amount of seconds a thread can run a workflow activation before a
38
38
# deadlock is assumed
@@ -118,10 +118,9 @@ async def _handle_activation(
118
118
) -> None :
119
119
global LOG_PROTOS , DEADLOCK_TIMEOUT_SECONDS
120
120
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 ()
125
124
try :
126
125
# Decode the activation if there's a codec
127
126
if self ._data_converter .payload_codec :
@@ -165,10 +164,6 @@ async def _handle_activation(
165
164
f"Failed handling activation on workflow with run ID { act .run_id } "
166
165
)
167
166
# Set completion failure
168
- if not completion :
169
- completion = (
170
- temporalio .bridge .proto .workflow_completion .WorkflowActivationCompletion ()
171
- )
172
167
completion .failed .failure .SetInParent ()
173
168
try :
174
169
temporalio .exceptions .apply_exception_to_failure (
@@ -183,12 +178,6 @@ async def _handle_activation(
183
178
completion .failed .failure .message = (
184
179
f"Failed converting activation exception: { inner_err } "
185
180
)
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
- )
192
181
193
182
# Encode the completion if there's a codec
194
183
if self ._data_converter .payload_codec :
0 commit comments