If you want to prevent that two oders are running at the same time in different job chains then you have two options:
- Merging the two job chains into one and setting the attribute
max_orders=1
. Seejobchain34
from the below example file. Please start orderpart3
and then try to start orderpart4
whilepart3
is running. - Using semaphores
To achieve this you have to create a job for entering the critical section. This job sets a semaphore. Should the semaphore be available then the job sets the semaphore and enters the critical section (the job chain). If not, a wait interval will be invoked. This job is the first job in the job chain.
Then you need a job for leaving the critical section. This job frees the semaphore.
As a semaphore you can use a file (setting the semaphore maps to creating the file, checking maps to verifying if the file exists and leaving the semaphore maps to deleting the file) or an event.
Please note that it is important to execute the leave_critical_section
job To unset the semaphore in case of an error the error node should not only be an end state but a node with the leave_critical_section
job.
You will find an example with the attached archive with jobchain3
and jobchain4
. This example creates files to set/unset the semaphore for the critical section.
Use the download link for the semaphore example. Please note that the scripts are running with the Windows OS.