Skip to content

Commit 25666bf

Browse files
Mark workflows API functions as deprecated (#749)
* 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]>
1 parent edd2edb commit 25666bf

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

dapr/aio/clients/grpc/client.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,7 @@ async def start_workflow(
14091409
send_raw_bytes: bool = False,
14101410
) -> StartWorkflowResponse:
14111411
"""Starts a workflow.
1412+
Deprecated: use dapr-ext-workflow instead
14121413
14131414
Args:
14141415
workflow_component (str): the name of the workflow component
@@ -1430,7 +1431,7 @@ async def start_workflow(
14301431
"""
14311432
# Warnings and input validation
14321433
warn(
1433-
'The Workflow API is a Beta version and is subject to change.',
1434+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
14341435
UserWarning,
14351436
stacklevel=2,
14361437
)
@@ -1470,6 +1471,7 @@ async def start_workflow(
14701471

14711472
async def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflowResponse:
14721473
"""Gets information on a workflow.
1474+
Deprecated: use dapr-ext-workflow instead
14731475
14741476
Args:
14751477
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
14821484
"""
14831485
# Warnings and input validation
14841486
warn(
1485-
'The Workflow API is a Beta version and is subject to change.',
1487+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
14861488
UserWarning,
14871489
stacklevel=2,
14881490
)
@@ -1511,6 +1513,7 @@ async def get_workflow(self, instance_id: str, workflow_component: str) -> GetWo
15111513

15121514
async def terminate_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
15131515
"""Terminates a workflow.
1516+
Deprecated: use dapr-ext-workflow instead
15141517
15151518
Args:
15161519
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) ->
15231526
"""
15241527
# Warnings and input validation
15251528
warn(
1526-
'The Workflow API is a Beta version and is subject to change.',
1529+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
15271530
UserWarning,
15281531
stacklevel=2,
15291532
)
@@ -1548,6 +1551,7 @@ async def raise_workflow_event(
15481551
send_raw_bytes: bool = False,
15491552
) -> DaprResponse:
15501553
"""Raises an event on a workflow.
1554+
Deprecated: use dapr-ext-workflow instead
15511555
15521556
Args:
15531557
instance_id (str): the ID of the workflow instance,
@@ -1568,7 +1572,7 @@ async def raise_workflow_event(
15681572
"""
15691573
# Warnings and input validation
15701574
warn(
1571-
'The Workflow API is a Beta version and is subject to change.',
1575+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
15721576
UserWarning,
15731577
stacklevel=2,
15741578
)
@@ -1611,6 +1615,7 @@ async def raise_workflow_event(
16111615

16121616
async def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16131617
"""Pause a workflow.
1618+
Deprecated: use dapr-ext-workflow instead
16141619
16151620
Args:
16161621
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
16241629
"""
16251630
# Warnings and input validation
16261631
warn(
1627-
'The Workflow API is a Beta version and is subject to change.',
1632+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16281633
UserWarning,
16291634
stacklevel=2,
16301635
)
@@ -1643,6 +1648,7 @@ async def pause_workflow(self, instance_id: str, workflow_component: str) -> Dap
16431648

16441649
async def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16451650
"""Resumes a workflow.
1651+
Deprecated: use dapr-ext-workflow instead
16461652
16471653
Args:
16481654
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
16551661
"""
16561662
# Warnings and input validation
16571663
warn(
1658-
'The Workflow API is a Beta version and is subject to change.',
1664+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16591665
UserWarning,
16601666
stacklevel=2,
16611667
)
@@ -1674,6 +1680,7 @@ async def resume_workflow(self, instance_id: str, workflow_component: str) -> Da
16741680

16751681
async def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16761682
"""Purges a workflow.
1683+
Deprecated: use dapr-ext-workflow instead
16771684
16781685
Args:
16791686
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
16861693
"""
16871694
# Warnings and input validation
16881695
warn(
1689-
'The Workflow API is a Beta version and is subject to change.',
1696+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16901697
UserWarning,
16911698
stacklevel=2,
16921699
)

dapr/clients/grpc/client.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ def start_workflow(
14131413
send_raw_bytes: bool = False,
14141414
) -> StartWorkflowResponse:
14151415
"""Starts a workflow.
1416+
Deprecated: use dapr-ext-workflow instead
14161417
14171418
Args:
14181419
workflow_component (str): the name of the workflow component
@@ -1434,7 +1435,7 @@ def start_workflow(
14341435
"""
14351436
# Warnings and input validation
14361437
warn(
1437-
'The Workflow API is a Beta version and is subject to change.',
1438+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
14381439
UserWarning,
14391440
stacklevel=2,
14401441
)
@@ -1470,6 +1471,7 @@ def start_workflow(
14701471

14711472
def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflowResponse:
14721473
"""Gets information on a workflow.
1474+
Deprecated: use dapr-ext-workflow instead
14731475
14741476
Args:
14751477
instance_id (str): the ID of the workflow instance,
@@ -1482,7 +1484,7 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow
14821484
"""
14831485
# Warnings and input validation
14841486
warn(
1485-
'The Workflow API is a Beta version and is subject to change.',
1487+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
14861488
UserWarning,
14871489
stacklevel=2,
14881490
)
@@ -1511,6 +1513,7 @@ def get_workflow(self, instance_id: str, workflow_component: str) -> GetWorkflow
15111513

15121514
def terminate_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
15131515
"""Terminates a workflow.
1516+
Deprecated: use dapr-ext-workflow instead
15141517
15151518
Args:
15161519
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
15241527
"""
15251528
# Warnings and input validation
15261529
warn(
1527-
'The Workflow API is a Beta version and is subject to change.',
1530+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
15281531
UserWarning,
15291532
stacklevel=2,
15301533
)
@@ -1549,6 +1552,7 @@ def raise_workflow_event(
15491552
send_raw_bytes: bool = False,
15501553
) -> DaprResponse:
15511554
"""Raises an event on a workflow.
1555+
Deprecated: use dapr-ext-workflow instead
15521556
15531557
Args:
15541558
instance_id (str): the ID of the workflow instance,
@@ -1568,7 +1572,7 @@ def raise_workflow_event(
15681572
"""
15691573
# Warnings and input validation
15701574
warn(
1571-
'The Workflow API is a Beta version and is subject to change.',
1575+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
15721576
UserWarning,
15731577
stacklevel=2,
15741578
)
@@ -1613,6 +1617,7 @@ def raise_workflow_event(
16131617

16141618
def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16151619
"""Pause a workflow.
1620+
Deprecated: use dapr-ext-workflow instead
16161621
16171622
Args:
16181623
instance_id (str): the ID of the workflow instance,
@@ -1626,7 +1631,7 @@ def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo
16261631
"""
16271632
# Warnings and input validation
16281633
warn(
1629-
'The Workflow API is a Beta version and is subject to change.',
1634+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16301635
UserWarning,
16311636
stacklevel=2,
16321637
)
@@ -1645,6 +1650,7 @@ def pause_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo
16451650

16461651
def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16471652
"""Resumes a workflow.
1653+
Deprecated: use dapr-ext-workflow instead
16481654
16491655
Args:
16501656
instance_id (str): the ID of the workflow instance,
@@ -1657,7 +1663,7 @@ def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResp
16571663
"""
16581664
# Warnings and input validation
16591665
warn(
1660-
'The Workflow API is a Beta version and is subject to change.',
1666+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16611667
UserWarning,
16621668
stacklevel=2,
16631669
)
@@ -1676,6 +1682,7 @@ def resume_workflow(self, instance_id: str, workflow_component: str) -> DaprResp
16761682

16771683
def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprResponse:
16781684
"""Purges a workflow.
1685+
Deprecated: use dapr-ext-workflow instead
16791686
16801687
Args:
16811688
instance_id (str): the ID of the workflow instance,
@@ -1688,7 +1695,7 @@ def purge_workflow(self, instance_id: str, workflow_component: str) -> DaprRespo
16881695
"""
16891696
# Warnings and input validation
16901697
warn(
1691-
'The Workflow API is a Beta version and is subject to change.',
1698+
'This Workflow API (Beta) method is deprecated and will be removed in a future version. Use the dapr-ext-workflow package instead.',
16921699
UserWarning,
16931700
stacklevel=2,
16941701
)

examples/demo_workflow/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ def act_for_child_wf(ctx: WorkflowActivityContext, inp):
106106

107107

108108
def main():
109+
# DEPRECATION NOTICE!
110+
# The workflow methods in the DaprClient are deprecated, instead use the client provided in dapr-ext-workflow
111+
# You can use the examples in https://github.com/dapr/python-sdk/tree/main/examples/workflow
109112
with DaprClient() as d:
110113
workflow_runtime = WorkflowRuntime()
111114
workflow_runtime.register_workflow(hello_world_wf)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dapr-ext-workflow-dev>=0.0.1rc1.dev
1+
dapr-ext-workflow-dev>=0.0.1rc1.dev

tests/clients/test_dapr_grpc_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ def test_unlock_input_validation(self):
881881
# Tests for workflow
882882
#
883883

884-
def test_workflow(self):
884+
def test_workflow_deprecated(self):
885885
dapr = DaprGrpcClient(f'{self.scheme}localhost:{self.grpc_port}')
886886
# Sane parameters
887887
workflow_name = 'test_workflow'

0 commit comments

Comments
 (0)