Acquire lock/semaphores

Does UiPath have a way to handle the event that several robots attempt to do the same task at the same time, for instance move a file etc? Blue Prism has a funcionality called environment locking which garanties that only one robot can perform a certain process step at a time, does UiPath have anything similar?

Some background to explain what I need:

I have a process which begins by populating a queue. A queue item should be created when a file is present in a certain directory, and the file should then be moved to a different place to show that it is now queued.
After the queue population, the robot will go on to get elements from the queue and process them one by one.

The problem is, when I have several robots assigned to this process, some times they might find the same file in the source folder at the same time. I thought I had this covered by adding some exception handling saying that if a robot gets an error when trying to move a file to the queued cases folder, then if the file is no longer present in the source folder then the robot should assume that the file was already queued by another robot. However, two robots have now created the same queue item and worked the same case. I can only assume that this means that both robots experienced moving the same file from the source folder to the queued cases folder at the same time, although it is obviously only possible to have one file with that name in the folder after the operation. It also seems that the two robots were able to simultaneously move this one file to a folder for worked cases after the process was done, since none of them has been throwing an error saying that the file was already present in the directory where they tried to move it.

I know that there are workarounds for my problem, for instance I could create an asset defined per robot defining a delay before going to queue population, ensuring that not all three robots will begin populating the queue at the axact same time. However, I am thinking that there should probably be a more elegant way to solve this problem, i.e. by locking the activity?

1 Like

I don’t found any activity similar to Blue Prism’s Acquire lock, but you may use Activity Get Jobs to get informations about running processes on Orchestrator. If process is already running on another robot you can delay or stop the process on current robot.

Hi, I am also looking answer for the same question. if you get anything please share it.

Any solution for this request?