Concurrency and Modules
Client and Service Project
One Python execution can cross from an entry module into a service module and back. Replay keeps both source files in the same traced run so the data-flow view follows the actual call and return.
module call flow
The entry module builds the request values. The service module computes the quote and returns a dictionary. Replay shows the source panel change when the call enters the helper file, then returns to the entry file for output.
Entry Module
order_client.py
Replay: real traced execution (multi-file project)
from price_service import quote
quantity = 2
unit_price = 15
invoice = quote(unit_price, quantity)
print("subtotal=" + str(invoice["subtotal"]))
print("total=" + str(invoice["total"]))
from price_service import quote
quantity = 1
unit_price = 15
invoice = quote(unit_price, quantity)
print("subtotal=" + str(invoice["subtotal"]))
print("total=" + str(invoice["total"]))
from price_service import quote
quantity = 3
unit_price = 15
invoice = quote(unit_price, quantity)
print("subtotal=" + str(invoice["subtotal"]))
print("total=" + str(invoice["total"]))
quantity ← 2, unit_price ← 15
4quantity→ 2 = 2 #@quantity=1, 35unit_price→ 15 = 156invoice = quote(unit_price15, quantity2)7print("subtotal=" + str(invoice["subtotal"]))subtotal ← 30, shipping ← 0, total ← 30
1from price_service import quote234quantity = 2 #@quantity=1, 35unit_price = 156invoice = quote(unit_price, quantity)values this step30subtotal0shipping30total15unit_price2quantityinvoice ← {'subtotal': 30, 'shipping': 0, 'total': 30}
5unit_price = 156invoice→ {'subtotal': 30, 'shipping': 0, 'total': 30} = quote(unit_price15, quantity2)7print("subtotal=" + str(invoice["subtotal"]30))8print("total=" + str(invoice["total"]30))outputsubtotal=30 total=30