cancel
Showing results for 
Search instead for 
Did you mean: 

How resource machine come to know that same process is also running on another resource machine

JatinKalra
Level 5
Hi All, Assume that my process is running on multiple resources at the same time. At any given time one of them get terminated and failed due to any reason. Is there any way that terminate bot should get the name of other resources where still same process is running. In simple words, assume the Process A is running on Resources 1,2 and 3. While processing the records from the queue Resource 3 get fail. Is there any way that Resource 3 could come to know that on Resource 1 and Resource 2 Process A is still running. Thank You Jatin Kalra
Jatin Kalra Manager Genpact Noida UP [Phone]
7 REPLIES 7

BenKirimlidis
Level 7
Hi, You can do this by running a DB query.  Tried posting the query i have for this here but the site won't let me. Will try and put it up in stages to get around it.  

BenKirimlidis
Level 7
Hi Jatin__Kalra, You can get this by getting your bot to query the Blue Prism MS SQL Database. Best practice is to have a mirror of the production DB set up and to query that instead of PROD. Assuming you have access to the back end, your process can run the query below. Just needs 2 things: 1) I don't know the name of your database, everything else is standard but you'll need to replace the XXXXXXXX as the default database 2) Set the value of @ProcessName to the name of your process The query below will return a list of any sessions of that process started today that do not have an end time

BenKirimlidis
Level 7
-- START OF SQL use XXXXXXXX; -- Replace this with the name of your DB go   with cte_TodaySessionLog as -- First creates a CTE of all session data for processes run today (same as the Control room feed) ( SELECT S.SessionID ,S.StartDateTime ,S.EndDateTime ,S.StopRequested ,S.LastUpdated ,S.LastStage ,P.Name as ProcessName FROM [dbo].[BPASession] as S inner join [dbo].[BPAProcess] as P on P.[processid] = S.[processid] and P.[ProcessType] = 'P' -- only gets processes, not objects where convert(date,S.StartDateTime) = convert(date,getdate()) -- Limits results to processes running today only ) select TSL.* from cte_TodaySessionLog as TSL where TSL.EndDateTime is null -- No End recorded and TSL.Processname = 'PROCESS_NAME'     -- I use a variable for this but the ampersand symbol was causing a problem for the site ; -- END OF SQL

BenKirimlidis
Level 7
After the use XXXXXXX; go; Add the lines ---------- declare ***ProcessName as varchar(100) set    ***ProcessName = 'PROCESS_NAME'; -- Insert your Process name here, can be a stored procedure/code run in SQL VBO with this passed as a string parameter ---------- replace the *** with an AT symbol, i said ampersand above, i meant the at symbol. SORRY FOR THE MULTI POST

JatinKalra
Level 5
Hi Ben_M31, Thanks for reply. But in our case we don't have access of Production Environment of Blue Prism. Other organisation is supporting the Production runs of process, so in this we are not eligible to set query to DB, as infrastructure team will not grant access to us. Is any other way in BP vbo's or through any code stage we can accomplish this task. Thank You. Jatin Kalra
Jatin Kalra Manager Genpact Noida UP [Phone]

david.l.morris
Level 15
I do similar things with the use of Environment Locks. You just need to make a reusable action that any process can call on. The action would attempt to acquire a lock of a certain text, for example, the name of the process. Let's say that you want to limit the number of concurrent sessions of a particular process. Let's say it's allowed to run 2 concurrent sessions at once but not more. Your reusable action would first attempt to acquire a lock with the name of ""Your Process Name - 1"". If it is unable to acquire that lock, then it can assume that there is at least one session already of that process. Then it attempts to acquire a lock with the name of ""Your Process Name - 2"". If it is able to acquire the lock, then that session continues. If it is unable to acquire the lock, then it assumes there are already 2 sessions of that process running. So, anyway, I just wanted to explain a simple use case. You could adapt this for your purpose. You could name the environment locks for your three resources with one up numbers as I just mentioned and then put the name of the Resource in the Comment field. So let's say three resources are each running a session of your process; it might look something like this in the Environment Locks view in the System tab: Status | Name | Resource | Process | Lock Time | Last Comment Locked Symbol | Your Process Name - 1 | ... | ... | ... | Name of Resource 1 Locked Symbol | Your Process Name - 2 | ... | ... | ... | Name of Resource 2 Locked Symbol | Your Process Name - 3 | ... | ... | ... | Name of Resource 3 When you use the action 'Query Lock', it will return the Comment, which you can then use as you need. There are other ways to use this as well. For example, you can force environment locks to unlock from one session and other sessions could periodically check to verify their Environment Lock is still intact and they could terminate if it is not. This would simulate the behavior of the 'Fail fast on any errors' option in Scheduler. I'm mostly bringing this up since you mentioned you're limited in what you're allowed to do. If Environment Locks are too fragile for you to use, you could consider using Work Queues for the same purpose, but Work Queues require more forethought.

Dave Morris, 3Ci at Southern Company

AndreyKudinov
Level 10
I use work queue locks, where each process can aquire and release named lock. This is similar to how RW locks work. When bot aquires read lock, it creates item in a queue with lock name and gets item id (which is returned to a caller), caller then releases it with same itemid when time comes (process end). Lock counter is number of queue items with a lock name. Lock counter 0 means no other bots are active. If bot terminates for some reason - lock is relased automatically. Environment lock is used internally to make sure multiple bots at once can't acquire/release locks. I use it to make sure all bots finish working on queue items, before last one generates and sends report (others just exit process).