Skip to content

Commit

Permalink
update test, grpc version and lint
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com>
  • Loading branch information
famarting committed Dec 4, 2024
1 parent 5aa3600 commit faa2231
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
10 changes: 8 additions & 2 deletions ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def schedule_new_workflow(
reuse_id_policy=reuse_id_policy,
)
return self.__obj.schedule_new_orchestration(
workflow.__name__, input=input, instance_id=instance_id, start_at=start_at, reuse_id_policy=reuse_id_policy,
workflow.__name__,
input=input,
instance_id=instance_id,
start_at=start_at,
reuse_id_policy=reuse_id_policy,
)

def get_workflow_state(
Expand Down Expand Up @@ -214,7 +218,9 @@ def raise_workflow_event(
"""
return self.__obj.raise_orchestration_event(instance_id, event_name, data=data)

def terminate_workflow(self, instance_id: str, *, output: Optional[Any] = None, recursive: bool = True):
def terminate_workflow(
self, instance_id: str, *, output: Optional[Any] = None, recursive: bool = True
):
"""Terminates a running workflow instance and updates its runtime status to
WorkflowRuntimeStatus.Terminated This method internally enqueues a "terminate" message in
the task hub. When the task hub worker processes this message, it will update the runtime
Expand Down
3 changes: 1 addition & 2 deletions ext/dapr-ext-workflow/dapr/ext/workflow/workflow_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def is_replaying(self) -> bool:

@abstractmethod
def set_custom_status(self, custom_status: str) -> None:
"""Set the custom status.
"""
"""Set the custom status."""
pass

@abstractmethod
Expand Down
8 changes: 8 additions & 0 deletions ext/dapr-ext-workflow/tests/test_dapr_workflow_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
mock_create_timer = 'create_timer'
mock_call_activity = 'call_activity'
mock_call_sub_orchestrator = 'call_sub_orchestrator'
mock_custom_status = 'custom_status'


class FakeOrchestrationContext:
def __init__(self):
self.instance_id = mock_instance_id
self.custom_status = None

def create_timer(self, fire_at):
return mock_create_timer
Expand All @@ -40,6 +42,9 @@ def call_activity(self, activity, input):
def call_sub_orchestrator(self, orchestrator, input, instance_id):
return mock_call_sub_orchestrator

def set_custom_status(self, custom_status):
self.custom_status = custom_status


class DaprWorkflowContextTest(unittest.TestCase):
def mock_client_activity(ctx: WorkflowActivityContext, input):
Expand All @@ -65,3 +70,6 @@ def test_workflow_context_functions(self):

create_timer_result = dapr_wf_ctx.create_timer(mock_date_time)
assert create_timer_result == mock_create_timer

dapr_wf_ctx.set_custom_status(mock_custom_status)
assert fakeContext.custom_status == mock_custom_status
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ include_package_data = True
zip_safe = False
install_requires =
protobuf >= 4.22
grpcio >= 1.37.0
grpcio-status>=1.37.0
grpcio >= 1.67.0
grpcio-status>=1.67.0
aiohttp >= 3.9.0b0
python-dateutil >= 2.8.1
typing-extensions>=4.4.0
Expand Down
2 changes: 1 addition & 1 deletion tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
grpcio-tools>=1.57.0
grpcio-tools>=1.67.0

0 comments on commit faa2231

Please sign in to comment.