Skip to content

Commit 56319fd

Browse files
committed
Fix linting issues
1 parent 41e0704 commit 56319fd

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
This repo contains a Python SDK for use with the [Azure Durable Task Scheduler](https://github.com/Azure/Durable-Task-Scheduler). With this SDK, you can define, schedule, and manage durable orchestrations using ordinary Python code.
88

9-
⚠️ This SDK is currently under active development and is evolving rapidly. While it's not yet ready for production use, we are excited about its potential and look forward to your feedback as we continue to improve it. ⚠️
10-
119
> Note that this SDK is **not** currently compatible with [Azure Durable Functions](https://learn.microsoft.com/azure/azure-functions/durable/durable-functions-overview). If you are looking for a Python SDK for Azure Durable Functions, please see [this repo](https://github.com/Azure/azure-functions-durable-python).
1210
1311
# References

examples/human_interaction.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ def prompt_for_approval():
119119
# Configure and start the worker - use secure_channel=False for emulator
120120
secure_channel = endpoint != "http://localhost:8080"
121121
with DurableTaskSchedulerWorker(host_address=endpoint, secure_channel=secure_channel,
122-
taskhub=taskhub_name, token_credential=credential) as w:
122+
taskhub=taskhub_name, token_credential=credential) as w:
123123
w.add_orchestrator(purchase_order_workflow)
124124
w.add_activity(send_approval_request)
125125
w.add_activity(place_order)
126126
w.start()
127127

128128
# Construct the client and run the orchestrations
129129
c = DurableTaskSchedulerClient(host_address=endpoint, secure_channel=secure_channel,
130-
taskhub=taskhub_name, token_credential=credential)
130+
taskhub=taskhub_name, token_credential=credential)
131131

132132
# Start a purchase order workflow using the user input
133133
order = Order(args.cost, "MyProduct", 1)
134134
instance_id = c.schedule_new_orchestration(purchase_order_workflow, input=order)
135-
135+
136136
def prompt_for_approval():
137137
input("Press [ENTER] to approve the order...\n")
138138
approval_event = namedtuple("Approval", ["approver"])(args.approver)

examples/sub-orchestrations-with-fan-out-fan-in/worker.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
from durabletask import task
66
from durabletask.azuremanaged.worker import DurableTaskSchedulerWorker
77

8+
89
def get_orders(ctx, _) -> list[str]:
910
"""Activity function that returns a list of work items"""
1011
# return a random number of work items
1112
count = random.randint(2, 10)
1213
print(f'generating {count} orders...')
1314
return [f'order {i}' for i in range(count)]
1415

16+
1517
def check_and_update_inventory(ctx, order: str) -> str:
1618
"""Activity function that checks inventory for a given order"""
1719
print(f'checking inventory for order: {order}')
@@ -22,6 +24,7 @@ def check_and_update_inventory(ctx, order: str) -> str:
2224
# return a random boolean indicating if the item is in stock
2325
return random.choices([True, False], weights=[9, 1])
2426

27+
2528
def charge_payment(ctx, order: str) -> bool:
2629
"""Activity function that charges payment for a given order"""
2730
print(f'charging payment for order: {order}')
@@ -32,6 +35,7 @@ def charge_payment(ctx, order: str) -> bool:
3235
# return a random boolean indicating if the payment was successful
3336
return random.choices([True, False], weights=[9, 1])
3437

38+
3539
def ship_order(ctx, order: str) -> bool:
3640
"""Activity function that ships a given order"""
3741
print(f'shipping order: {order}')
@@ -42,6 +46,7 @@ def ship_order(ctx, order: str) -> bool:
4246
# return a random boolean indicating if the shipping was successful
4347
return random.choices([True, False], weights=[9, 1])
4448

49+
4550
def notify_customer(ctx, order: str) -> bool:
4651
"""Activity function that notifies the customer about the order status"""
4752
print(f'notifying customer about order: {order}')
@@ -52,11 +57,12 @@ def notify_customer(ctx, order: str) -> bool:
5257
# return a random boolean indicating if the notification was successful
5358
return random.choices([True, False], weights=[9, 1])
5459

60+
5561
def process_order(ctx, order: str) -> dict:
5662
"""Sub-orchestration function that processes a given order by performing all steps"""
5763
print(f'processing order: {order}')
5864

59-
# Check inventory
65+
# Check inventory
6066
inventory_checked = yield ctx.call_activity('check_and_update_inventory', input=order)
6167

6268
if not inventory_checked:
@@ -83,6 +89,7 @@ def process_order(ctx, order: str) -> dict:
8389
# Return success status
8490
return {'order': order, 'status': 'completed'}
8591

92+
8693
def orchestrator(ctx, _):
8794
"""Orchestrator function that calls the 'get_orders' and 'process_order'
8895
sub-orchestration functions in parallel, waits for them all to complete, and prints
@@ -103,6 +110,7 @@ def orchestrator(ctx, _):
103110
'details': results,
104111
}
105112

113+
106114
# Use environment variables if provided, otherwise use default emulator values
107115
taskhub_name = os.getenv("TASKHUB", "default")
108116
endpoint = os.getenv("ENDPOINT", "http://localhost:8080")
@@ -116,7 +124,7 @@ def orchestrator(ctx, _):
116124
# Configure and start the worker
117125
with DurableTaskSchedulerWorker(host_address=endpoint, secure_channel=True,
118126
taskhub=taskhub_name, token_credential=credential) as w:
119-
127+
120128
w.add_orchestrator(orchestrator)
121129
w.add_orchestrator(process_order)
122130
w.add_activity(get_orders)

0 commit comments

Comments
 (0)