diff --git a/dapr/aio/clients/grpc/client.py b/dapr/aio/clients/grpc/client.py index e4d4e9023..7bcf4a136 100644 --- a/dapr/aio/clients/grpc/client.py +++ b/dapr/aio/clients/grpc/client.py @@ -1409,6 +1409,7 @@ async def start_workflow( send_raw_bytes: bool = False, ) -> StartWorkflowResponse: """Starts a workflow. + Deprecated: use dapr-ext-workflow instead Args: workflow_component (str): the name of the workflow component @@ -1430,7 +1431,7 @@ async def start_workflow( """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1470,6 +1471,7 @@ async def start_workflow( async def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflowResponse: """Gets information on a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1482,7 +1484,7 @@ async def get_workflow(self, instance_id: str, workflow_component: str) -> GetWo """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1511,6 +1513,7 @@ async def get_workflow(self, instance_id: str, workflow_component: str) -> GetWo async def terminate_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Terminates a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, e.g. @@ -1523,7 +1526,7 @@ async def terminate_workflow(self, instance_id: str, workflow_component: str) -> """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1548,6 +1551,7 @@ async def raise_workflow_event( send_raw_bytes: bool = False, ) -> DaprResponse: """Raises an event on a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1568,7 +1572,7 @@ async def raise_workflow_event( """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1611,6 +1615,7 @@ async def raise_workflow_event( async def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Pause a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1624,7 +1629,7 @@ async def pause_workflow(self, instance_id: str, workflow_component: str) -> Dap """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1643,6 +1648,7 @@ async def pause_workflow(self, instance_id: str, workflow_component: str) -> Dap async def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Resumes a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1655,7 +1661,7 @@ async def resume_workflow(self, instance_id: str, workflow_component: str) -> Da """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1674,6 +1680,7 @@ async def resume_workflow(self, instance_id: str, workflow_component: str) -> Da async def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Purges a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1686,7 +1693,7 @@ async def purge_workflow(self, instance_id: str, workflow_component: str) -> Dap """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) diff --git a/dapr/clients/grpc/client.py b/dapr/clients/grpc/client.py index 4aa75b551..f7c7b8504 100644 --- a/dapr/clients/grpc/client.py +++ b/dapr/clients/grpc/client.py @@ -1413,6 +1413,7 @@ def start_workflow( send_raw_bytes: bool = False, ) -> StartWorkflowResponse: """Starts a workflow. + Deprecated: use dapr-ext-workflow instead Args: workflow_component (str): the name of the workflow component @@ -1434,7 +1435,7 @@ def start_workflow( """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1470,6 +1471,7 @@ def start_workflow( def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflowResponse: """Gets information on a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1482,7 +1484,7 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1511,6 +1513,7 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow def terminate_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Terminates a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, e.g. @@ -1524,7 +1527,7 @@ def terminate_workflow(self, instance_id: str, workflow_component: str) -> DaprR """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1549,6 +1552,7 @@ def raise_workflow_event( send_raw_bytes: bool = False, ) -> DaprResponse: """Raises an event on a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1568,7 +1572,7 @@ def raise_workflow_event( """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1613,6 +1617,7 @@ def raise_workflow_event( def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Pause a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1626,7 +1631,7 @@ def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1645,6 +1650,7 @@ def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Resumes a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1657,7 +1663,7 @@ def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResp """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) @@ -1676,6 +1682,7 @@ def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResp def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse: """Purges a workflow. + Deprecated: use dapr-ext-workflow instead Args: instance_id (str): the ID of the workflow instance, @@ -1688,7 +1695,7 @@ def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo """ # Warnings and input validation warn( - 'The Workflow API is a Beta version and is subject to change.', + 'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.', UserWarning, stacklevel=2, ) diff --git a/examples/demo_workflow/README.md b/examples/demo_workflow/README.md index 12b84ae2c..c83aa70fe 100644 --- a/examples/demo_workflow/README.md +++ b/examples/demo_workflow/README.md @@ -2,10 +2,10 @@ This document describes how to register a workflow and activities inside it and start running it. It demonstrates the following APIs: -- **start_workflow**: Start an instance of a workflow -- **get_workflow**: Get information on a single workflow +- **schedule_new_workflow**: Start an instance of a workflow +- **get_workflow_state**: Get information on a single workflow - **terminate_workflow**: Terminate or stop a particular instance of a workflow -- **raise_event**: Raise an event on a workflow +- **raise_workflow_event**: Raise an event on a workflow - **pause_workflow**: Pauses or suspends a workflow instance that can later be resumed - **resume_workflow**: Resumes a paused workflow instance - **purge_workflow**: Removes all metadata related to a specific workflow instance from the state store diff --git a/examples/demo_workflow/app.py b/examples/demo_workflow/app.py index 739655627..8f67fdbdc 100644 --- a/examples/demo_workflow/app.py +++ b/examples/demo_workflow/app.py @@ -106,6 +106,9 @@ def act_for_child_wf(ctx: WorkflowActivityContext, inp): def main(): + # DEPRECATION NOTICE! + # The workflow methods in the DaprClient are deprecated, instead use the client provided in dapr-ext-workflow + # You can use the examples in https://github.com/dapr/python-sdk/tree/main/examples/workflow with DaprClient() as d: workflow_runtime = WorkflowRuntime() workflow_runtime.register_workflow(hello_world_wf) diff --git a/examples/demo_workflow/demo_workflow/requirements.txt b/examples/demo_workflow/demo_workflow/requirements.txt index 61f7f5c82..c19dc97f0 100644 --- a/examples/demo_workflow/demo_workflow/requirements.txt +++ b/examples/demo_workflow/demo_workflow/requirements.txt @@ -1 +1 @@ -dapr-ext-workflow-dev>=0.0.1rc1.dev +dapr-ext-workflow-dev>=0.0.1rc1.dev \ No newline at end of file diff --git a/ext/dapr-ext-workflow/tests/test_workflow_client.py b/ext/dapr-ext-workflow/tests/test_workflow_client.py index 4a7f93b95..d4767a746 100644 --- a/ext/dapr-ext-workflow/tests/test_workflow_client.py +++ b/ext/dapr-ext-workflow/tests/test_workflow_client.py @@ -119,3 +119,5 @@ def test_client_functions(self): actual_resume_result = wfClient.resume_workflow(instance_id=mockInstanceId) assert actual_resume_result == mock_resume_result + + # TODO add purge support diff --git a/tests/clients/test_dapr_grpc_client.py b/tests/clients/test_dapr_grpc_client.py index ad90d8cc4..f0644ec7f 100644 --- a/tests/clients/test_dapr_grpc_client.py +++ b/tests/clients/test_dapr_grpc_client.py @@ -881,7 +881,7 @@ def test_unlock_input_validation(self): # Tests for workflow # - def test_workflow(self): + def test_workflow_deprecated(self): dapr = DaprGrpcClient(f'{self.scheme}localhost:{self.grpc_port}') # Sane parameters workflow_name = 'test_workflow'