How one file use for two BOT and BOT run same time

Hello

Consider in orchestrator there are schedule two BOTs same time and this two BOTs use same file PDF/Excel. How can I handle this scenario.
Example: BOT A open the excel file and some changes process is going on but BOT B use same file that time how can I handle it. Because BOT A and BOT B run same time.

Thanks
Minal

Hello @minal.patil
Is Both Bots utilize the same sheet? and does it update the file data?

yes and save as file in given path

@minal.patil
If save the file in a different path, then Copy the file to a Local path and make changes and save it.

This is what Orchestrator queues are for. You write a dispatcher automation that loads the Excel file into a queue. Then your processes pull from that queue. The Get Transaction activity will get the next item from the queue and will not allow the jobs to step on each other.

@postwick is right, if what the bots are trying to enter is something like an worksheet of jobs which is it picking up and updating, then Queues will work perfectly. One robot will go and grab the excel file and load the transactions into queues, then it doesnt matter how many robots are running, they will never conflict by trying to get the same item.

If the file isnt like that though, then you may have to get more inventive, as mentioned you could copy the file so the robot only uses its own copy, or if its just a quick in and out job then maybe the robot could wait for the file to become available. Of you could access it through O365 cloud where multiple people can use and edit at the same time, or put the data somewhere else entirely like a database which can manage these sorts of conflicts much better. it will depend on your use case

scenario is if BOT A open excel or PDF file how can BOT B open same file it will get error because file is already open.

Why do you have two jobs trying to open the same file?

Because client use same file. This requirement for client side.

That answer doesn’t tell us anything. You have to explain your process to us or we cannot help you.

The short answer is two jobs CANNOT open the same file at the same time. You have to find a better way to design your process. What are you trying to do?

@minal.patil

You can add kind of a lock and wait for it…

So add the activities in a try catch and in a loop if the catch block catches exception saying the file is being used by someone then have a delay and retry thsi way only one bot will be working

Another way which is more proactive is to create a kind of locking mechanism and use the bot

Add an asset in your orchestrator and give intial values as NA. now when bot reaches the point where it needs to access file use get asset and check the value of asset…if its NA then use set asset and set the value to environment.username …now get the asset again and check if the value if asset is equal to environment.username…if yes then perform your excel actions if no have a delay and check gain in a while loop…

So this is kind of locking mechanism so that only one bot uses the common file at a time

Cheers

1 Like

Thank you, it is really helpful.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.