Ross,
Does this mean your workflow engine is also a background task?
Something like
my_queue = []
def handle_it(it):
blah...
while True:
my_queue.extend(db.q_table....
while my_queue:
mytask = my_queue.pop()
handle_it(mytask)
On Friday, May 25, 2012 9:31:33 AM UTC-4, Ross Peoples wrote:
>
> Andrew,
>
> If I'm understanding you properly, the only major difference between the
> business process workflow (the one I am writing) and the data integration
> workflow you mention is that one requires human interaction, while the
> other is handled by automated systems. Is that fairly accurate? If so, then
> I could see my workflow engine being used for both types of workflows. I
> have well-defined the human interaction of workflows, but never touched on
> the automated aspect, though it was a consideration during the design of
> the engine.
>
> Let me give an example of what I understand an automated workflow to be.
> Say we are running an e-commerce site and we want to create an automated
> workflow for the ordering process. This is how the process should go:
>
> 1. Customer orders something
> 2. Payment is processed
> 3. Order confirmation email sent to customer
> 4. Order is shipped
> 5. Shipping confirmation email sent to customer
>
> You could certainly just hardcode the "workflow" of each step, but then
> there's not a lot of flexibility. For example, maybe you want to insert an
> extra step later (i.e. quality control before shipping). You could use the
> workflow engine I'm creating to handle this scenario. Let me explain how:
>
> You would have several parts to your e-commerce site:
>
> - Main web interface
> - Payment processing thread
> - Email thread for order confirmations
> - Email thread for shipment confirmations
>
> I use the term "thread", but this would be any process or web2py scheduler
> instance that runs in the background waiting for something to do. You would
> have a process waiting for payments to process and processes waiting for
> emails to send. This could potentially be the workflow you would use for
> the ordering and shipping process:
>
> # auth_group 50 = Automated payment processor group
> # auth_group 51 = Automated order confirmation email group
> # auth_group 52 = Shipping group of people that package the order
> # auth_group 53 = Automated shipment confirmation email group
>
> workflow_engine.create_template('Process order',
> Step('Process the payment', dict(group=50)),
> Step('Send order confirmation email', dict(group=51)),
> Step('Package and ship order', dict(group=52)),
> Step('Send shipment confirmation email', dict(group=53))
> )
>
> The trick here being that you can assign workflows to groups. So if you
> create a group for each background process, then those processes can
> continually check to see if there are any workflows waiting on them. Once
> they finish their job, they call:
>
> workflow_engine.step_complete(workflow_id, as_group=50) # payment
> processor is finished
>
> Because it's designed to be as general as possible, you can have the best
> of both worlds which this example demonstrates: mixing both human and
> automated workflows into a single workflow.
>
> Does this address you question?
>
> Thanks
>