Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Martinez <[email protected]>
  • Loading branch information
famarting committed Oct 28, 2024
1 parent d7e30eb commit 27abe2b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
10 changes: 1 addition & 9 deletions durabletask/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,8 @@ def is_replaying(self) -> bool:
"""
pass

@property
@abstractmethod
def custom_status(self) -> str:
"""Get the custom status.
"""
pass

@custom_status.setter
@abstractmethod
def custom_status(self, custom_status: str) -> None:
def set_custom_status(self, custom_status: str) -> None:
"""Set the custom status.
"""
pass
Expand Down
9 changes: 2 additions & 7 deletions durabletask/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,7 @@ def is_replaying(self) -> bool:
def current_utc_datetime(self, value: datetime):
self._current_utc_datetime = value

@property
def custom_status(self) -> str:
return self._custom_status

@custom_status.setter
def custom_status(self, custom_status: str) -> None:
def set_custom_status(self, custom_status: str) -> None:
self._custom_status = custom_status

def create_timer(self, fire_at: Union[datetime, timedelta]) -> task.Task:
Expand Down Expand Up @@ -510,7 +505,7 @@ def execute(self, instance_id: str, old_events: Sequence[pb.HistoryEvent], new_e
actions = ctx.get_actions()
if self._logger.level <= logging.DEBUG:
self._logger.debug(f"{instance_id}: Returning {len(actions)} action(s): {_get_action_summary(actions)}")
return actions, ctx.custom_status
return actions, ctx._custom_status

def process_event(self, ctx: _RuntimeOrchestrationContext, event: pb.HistoryEvent) -> None:
if self._is_suspended and _is_suspendable(event):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_orchestration_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def throw_activity(ctx: task.ActivityContext, _):
def test_custom_status():

def empty_orchestrator(ctx: task.OrchestrationContext, _):
ctx.custom_status = "foobaz"
ctx.set_custom_status("foobaz")

# Start a worker, which will connect to the sidecar in a background thread
with worker.TaskHubGrpcWorker() as w:
Expand All @@ -463,4 +463,4 @@ def empty_orchestrator(ctx: task.OrchestrationContext, _):
assert state.runtime_status == client.OrchestrationStatus.COMPLETED
assert state.serialized_input is None
assert state.serialized_output is None
assert state.serialized_custom_status is "foobaz"
assert state.serialized_custom_status is "\"foobaz\""

0 comments on commit 27abe2b

Please sign in to comment.