I am currently evaluating Prefect (2.0) for an invoice generation workflow with tasks like
data aggregation
data validation
invoice calculation
(manual) review
PDF generation
invoice delivery
For certain kinds of invoices, we need to halt a flow, let a business people review the invoice calculation and approve/reject the invoice calculation.
In general, we would use AWS for deployment.
How would you model in this context the waiting a manual trigger within a flow/task?
Thanks so much for explaining your use case. There are many possibilities in how you could approach it but a good start would be to separate the process that can be run after pausing from the previous steps.
For invoices that require manual review
Flow 1
data aggregation
data validation
invoice calculation
send a notification to the person that should review this e.g. via Slack or email
Flow 2
if approved, manually trigger a parametrized flow:
PDF generation
invoice delivery
For invoices that DO NOT require manual review
A single flow doing everything
data aggregation
data validation
invoice calculation
automated review/validation
PDF generation
invoice delivery
Eliminating boilerplate code
Probably the problem you would then stumble upon would be eliminating code duplication - the business logic for individual steps can be packaged into some utility Python package - check this example for Prefet 1.0 but building a python package would work the same way for Prefect 2.0: