Welcome To Support Community

Pipeline Pilot

Advanced Search
Ask Search:
jfeinbergjfeinberg 

Generate list of active running jobs inside a protocol?

Is it possible to get a list of actively running jobs from within a PP protocol?  I'd like to be able to ensure that a given protocol can't be run concurrently.  I.e. if user 1 runs "massive backup protocol that takes an hour to run" and user 2 launches the same protocol 10 minutes later, I want to be able to show a message telling user 2 that the protocol is already running.​

MikeMike (BIOVIA) 
Not readily possible if you are wanting to return all jobs for every user. You can use the REST API URL
http://<server>:<port>/jobs/
to return a list of active jobs for the current user. The admin portal does display all active jobs for every user, it uses a URL and JavaScript code defined within the admin package (RunningJobs.js, https://<server>:<sslport>/admin/z?action=runningjobs).

Your objective, however, could be achieved without needing to retrieve and parse all the active jobs on the server. I would suggest using some form of 'lock' on the protocol to check whether it is running. For example, in pipe1 of the protocol check for the existence of a global PP cache - if it exists then immediately terminate the protocol, if it does not exist then create the cache. Then in the last pipe of the protocol delete that cache.
NamadevNamadev (BIOVIA) 
HI John,
  You can use the 'Lock Cross Process Mutex' component to lock the protocol being run by another user simultaneously. Have a message when failed to lock the mutex within a given 'Timeout' that the protocol is being used currently.
Best Regards,
Baskaran
jfeinbergjfeinberg
Thanks for the mutex lock suggestion - I have implemented this solution for my long-running backup protocol.  At first I was worried that it could stay locked if the protocol crashed, but I see that it automatically unlocks when the protocol stops running, even if it crashes.