In this video we talk about Cancellation Regions in YAWL. These cancellation regions are a flexible tool for handling all sorts of abnormal behaviour from user-triggered abortions of activities to timeouts. The flexibility in defining cancellation regions comes at a price: it is easy to make mistakes. We show you how to avoid these. The zip file attached here contains an initial and a final YAWL specification for following this tutorial on your own YAWL installation.
Hello! Welcome back to another your tutorial! Today we will talk about cancellation regions in YAWL. In many cases it is important to be able to cancel a set of tasks once you have started a complex workflow. In YAWL, cancellation regions are an extremely powerful tool. However, it's not so easy to use them correctly. Today, I will show you how to avoid mistakes while defining cancellation regions and we will give you an example and explain the mechanics of these cancellation regions. As usual, you can find supplementary material in the link below. And we will start right now. We will start off with a specification that you can find in the supplementary material. The file is called Tutorial12.yawl. And you also need to load up the YAWL org data export ybkp file first. If you don't know how to do that, look at one of the previous tutorials. This specification is already loaded in the YAWLeditor here and you may recognize it because that is the specification of tutorial 9. We have someone formulating a requirement and then, there is a process going on, where we decide to either develop software in a project or to procure software. Imagine that after formulating the requirement you find out that you don't need this software after all and you want to cancel the whole procedure - no matter where it is now. So if we look at all this part of the specification after formulate requirement, we may say that ok, until the purchase order is sent out or the project is actually started, we can still cancel the whole thing. And we want to give the possibility of canceling to the same user that has formulated the requirement. So how can we do that? Well, we will first create an AND split after "Formulate requirement". And this is a very frequent pattern here. So we select "Formulate requirement" and go on the left-hand side, look at the split type and select. And here, we will insert a task "Cancel requirement" and connect it here and then also connect it to the end. And this cancel requirement task will be offered to the same user that has formulated the requirement. So on the left-hand side, we go to resourcing, enable system offer, and we will choose the completer of task "Formulate requirement". In order to define our cancellation region, we need to click on this red circular symbol here. And then we get another symbol here that allows us to add elements to this cancellation region. We have to select everything: starting from this condition here, all of the tasks in here, and also the arcs between the tasks. The reason that we have to select the arcs is that YAWL comes from Petri Nets. And in Petri Nets, between two transitions, there's always a place. And you can imagine that each time we have two tasks or two transitions in a YAWL specification, that there is an implicit place in between them which is on the arc. And that is why we have to select all of the elements now in this cancellation region we want to define. So we select the condition here and click "add" and then we select the tasks.
And we select all the arcs between the tasks. And now, our cancellation region is complete. And we will also ... now we can stop this ... and now we don't see the cancellation region anymore. We can select tasks again and click it to see it again. And you can see now this red dot appearing here indicating that this is a cancellation task. And we will also define "Start project" and "Prepare purchase order" as cancellation tasks. So again, we will define the cancellation region. And this time, we will select "Cancel requirement" and the arc before that. See "Start project" now is a cancellation task. And we will do the same thing for "Prepare purchase order".
And we're done. We save this and we upload it to the YAWL engine. Now, we can start to execute the case and see how it behaves. So the first task is assigned to Lorenzo Monaco: "Formulate requirement". And now, we have three work items: "Cancel requirement", which is assigned to Lorenzo Monaco, the same user that just started the requirement, "Define software development project", and "Prepare software procurement". So all of them are now assigned to the same user. This is for demonstration purposes and let's see what happens, if we do "Cancel requirement".
"We accept and start it. And you can still see the other two are still there. So it started and, because we didn't define any behavior for it, we cannot view it but we can complete it. And you can see now: after the completion, all the other work items are gone. And if we look at the cases, we can see the case is finished. So this cancellation has worked. You can try yourself executing now the workflow in the rest and for example go to start project and look at which moment in time the "Cancel requirement" task is in turn cancelled. And this pattern here that we have two regions in the workflow that mutually cancel each other, is a very frequent pattern in workflows.
If you have any questions, please ask them in the comments and don't forget to subscribe to this channel, if you don't want to miss any new episodes. See you soon!