Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
If you want to avoid 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 set setting the attribute
max_orders=1
. Seejobchain34
in from the below example file. Please start orderpart3
and then try to start orderpart4
whilepart3
is running. - Using semaphores
Achiving To achieve this you have to create a job for entering the critical section. This job sets a semaphore. If free Should the semaphore be available then the job sets the semaphore and enters the critical section (the job chain). If not, a wair 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 unsets frees the semaphore.
As a semaphore you can use a file (then setting is the semaphore maps to creating the file, checking is file existing and leaving is maps to verifying if the file exists and leaving the semaphore maps to deleting the file) or a an event or someting else.
Please note that it is important to execute the leave_critical_section
job To unset the semaphore also in case of an error the error node should not only be an endstate end state but a node with the leave_critical_section
job.
You will find an example in with the example file attached archive with jobchain3
and jobchain4
. This example creates files to set/unset the semaphore for the critical section.
Here is Use the download link for the semaphore example. Please note that the scripts are running with windows os.
semaphore.zipthe Windows OS.