Options

RM Server Web App - Control process execution

kershovkershov Member Posts: 9 Contributor I
edited March 2019 in Help
Imagine, that logged in web-app user run some process. How to understand, wheter process is still running or completed?
My task is to prevent other authorized users from starting processes from the web application while another user is running the process. 
Tagged:

Answers

  • Options
    SGolbertSGolbert RapidMiner Certified Analyst, Member Posts: 344 Unicorn

    you could get the desired effect by having a queue with only one job container. In that case, only one process could be running at the time.

    Here is an explanation about the server structure:


    Regards,
    Sebastian


  • Options
    kershovkershov Member Posts: 9 Contributor I
    edited March 2019
    Hi @SGolbert. Thnx for advice.

    I have RapidMiner Server 7.2
    I deleted DEFAULT queue, created Blocking Queue and set Maximum load parameter to 1.
    But it still possible to run many processes from web-app at the same time from different users (saw this in server log).

    Am i doing right things?
    Can you describe how to create and assign queue to web application step-by-step based on my case?
    Also, i'm thinking about the way of notification of second user, that the process from first user still running and etc.

    Thank you in advance
  • Options
    SGolbertSGolbert RapidMiner Certified Analyst, Member Posts: 344 Unicorn

    Oh, that's an old version of the server. The problem is that web apps, web services and scheduled processes have different execution channels, the queue is only effective for scheduled process or "run on server" processes.

    I think that you have to limit the processes "by hand", for example having a database table that controls the processes. You could set up a flag when a process start, and further processes would check whether the flag is off before starting. @BalazsBarany maybe can help you further.

    Regards,
    Sebastian


  • Options
    BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    Hi,

    @SGolbert is right, web apps are working outside of queues. 

    What you need here is a kind of locking for the process, independent of the user and execution context. You could use a database for example.
    Create a table called locks (process varchar, locked boolean). 
    Insert a line for your process name with locked = false.
    At the beginning of the process, check if locked = true. If yes, cancel the process. If not, set locked = true and go on. Bonus points for your database if it can do this in one transaction, avoiding a (very unlikely) race condition between the read and the update.
    At the end of the process, planned or unplanned (Check this!), release the lock again.

    This is one way to do it. Another, again database dependent, is to create a table just for this process and lock it in a transactional way. Other processes might wait for the lock for a specified time (e. g. 1 minute) and cancel after the timeout.

    Regards,

    Balázs
Sign In or Register to comment.