Skip to content

Commit 1791b65

Browse files
committed
Fix StringValue of json convert
1 parent 8213512 commit 1791b65

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

durabletask/client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def schedule_new_orchestration(self, orchestrator: Union[task.Orchestrator[TInpu
147147
req = pb.CreateInstanceRequest(
148148
name=name,
149149
instanceId=instance_id if instance_id else uuid.uuid4().hex,
150-
input=helpers.get_string_value(shared.to_json(input)),
150+
input=helpers.get_string_value(shared.to_json(input) if input is not None else None),
151151
scheduledStartTimestamp=helpers.new_timestamp(start_at) if start_at else None,
152152
version=helpers.get_string_value(version if version else self.default_version),
153153
orchestrationIdReusePolicy=reuse_id_policy,
@@ -269,7 +269,8 @@ def raise_orchestration_event(self, instance_id: str, event_name: str, *,
269269
req = pb.RaiseEventRequest(
270270
instanceId=instance_id,
271271
name=event_name,
272-
input=helpers.get_string_value(shared.to_json(data)))
272+
input=helpers.get_string_value(shared.to_json(data) if data is not None else None)
273+
)
273274

274275
self._logger.info(f"Raising event '{event_name}' for instance '{instance_id}'.")
275276
self._stub.RaiseEvent(req)
@@ -279,7 +280,7 @@ def terminate_orchestration(self, instance_id: str, *,
279280
recursive: bool = True):
280281
req = pb.TerminateRequest(
281282
instanceId=instance_id,
282-
output=helpers.get_string_value(shared.to_json(output)),
283+
output=helpers.get_string_value(shared.to_json(output) if output is not None else None),
283284
recursive=recursive)
284285

285286
self._logger.info(f"Terminating instance '{instance_id}'.")
@@ -329,7 +330,7 @@ def signal_entity(self,
329330
req = pb.SignalEntityRequest(
330331
instanceId=str(entity_instance_id),
331332
name=operation_name,
332-
input=helpers.get_string_value(shared.to_json(input)),
333+
input=helpers.get_string_value(shared.to_json(input) if input is not None else None),
333334
requestId=str(uuid.uuid4()),
334335
scheduledTime=None,
335336
parentTraceContext=None,

0 commit comments

Comments
 (0)