Skip to content

Commit

Permalink
Mark workflows API functions as deprecated (#749)
Browse files Browse the repository at this point in the history
* workflows, remove deprecated functions

Signed-off-by: Fabian Martinez <[email protected]>

* revert changes to example

Signed-off-by: Fabian Martinez <[email protected]>

* update warning messages

Signed-off-by: Fabian Martinez <[email protected]>

* Typos

Signed-off-by: Elena Kolevska <[email protected]>

* fixes linter

Signed-off-by: Elena Kolevska <[email protected]>

* Apply suggestions from code review

Signed-off-by: Elena Kolevska <[email protected]>

* Apply suggestions from code review

Signed-off-by: Elena Kolevska <[email protected]>

---------

Signed-off-by: Fabian Martinez <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Co-authored-by: Elena Kolevska <[email protected]>
Co-authored-by: Elena Kolevska <[email protected]>
  • Loading branch information
3 people authored Jan 2, 2025
1 parent edd2edb commit 25666bf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 16 deletions.
21 changes: 14 additions & 7 deletions dapr/aio/clients/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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.
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand Down
21 changes: 14 additions & 7 deletions dapr/clients/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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.
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand All @@ -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,
Expand All @@ -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,
)
Expand Down
3 changes: 3 additions & 0 deletions examples/demo_workflow/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/demo_workflow/demo_workflow/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dapr-ext-workflow-dev>=0.0.1rc1.dev
dapr-ext-workflow-dev>=0.0.1rc1.dev
2 changes: 1 addition & 1 deletion tests/clients/test_dapr_grpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 25666bf

Please sign in to comment.