rfswarm icon indicating copy to clipboard operation
rfswarm copied to clipboard

Run robot scripts in separate "Sessions"

Open damies13 opened this issue 5 years ago • 2 comments

Describe the solution you'd like Run robot scripts in separate "Sessions" so you can run multiple GUI robots on the same agent machine (Sikuli, White, AutoIt, etc)

Additional context On Windows this will probably look like RunAs (Win 7 +?) on Linux (unix?) systems this might be su -u or even creating a separate XWindows session, No idea what this will look like on MacOS yet.

More investigation is going to be needed to determine if this is possible and will probably need do use different strategies for different os's

damies13 avatar Jan 10 '20 22:01 damies13

My thinking on this issue is that the best way to resolve it will be to use docker containers, there already exist windows, MacOS and Linux docker images, so I expect you could produce a docker template with the OS required, the application to be tested, robot framework + RF Libraries needed for the AUT and rfswarm-agent.

A docker container typically is assigned 2GB ram and 2 CPU's this means a typical 8GB desktop could run 4 containers, or if the ram is upgraded to 16GB could run about 8 containers.

I found a docker example template that had robotframework + robotframework-seleniumlibrary, I added rfswarm-agent to this template and was able to run several selenium browser sessions with it, it was a bit rough as I needed to install a newer python version. I need to spend more time investigating and documenting how to do this nicely, in the bean time if someone needs this functionality hopefully this info will help you to a solution.

damies13 avatar Feb 14 '21 12:02 damies13

I had some other ideas about this today:

  • Docker Containers typically don't have GUI's but I found I can run XVFB on a Linux docker, not sure what to do about Windows/MacOS docker containers yet
  • Virtual machines and containers (I know this works)
    • any virtual machine software will work, the disadvantage is you'll have the overhead of the full OS in each VM
    • Proxmox Containers work well (Linux only?) can run XVFB in a Proxmox Container
  • On Windows run the agent as a service with different user accounts
    • create n windows user accounts (local or domain accounts, domain accounts, are probably better)
    • use srvany from the windows resource kit to create n number of windows services (one per user account)
    • configure the services to run as a nominated account (not SYSTEM)
    • When configuring the command line for service you'll probably want to use some of these options:
      • -a %HOSTNAME%-%USERNAME% - so that each agent has a unique name
      • -i %USERPROFILE%\rfswarmAgent.ini- This will give each agent it's own ini file without having to hard code them
      • -m http://yourmanager:8138/ - this might make it easier to change the manager if needed, just edit the command line options on the service, but then it might be easier to edit the ini files in the user profile directories too
  • On Linux run the agent in multiple XVFB's
    • write a shell script that takes a number as an argument (e.g. variable might be called $AGENTNO)
    • script will first start XVFB on the display number $AGENTNO
    • script would then set the display variable for the display number $AGENTNO ( 0:$AGENTNO ?)
    • script would then start the agent with -a $HOSTNAME-$AGENTNO so that each agent has a unique name
  • On MacOS run the agent as multiple users
    • MacOS has the ability to switch users, so create n number of user accounts on the MAC
    • Login on the mac and configure the agent so start on login (https://support.apple.com/en-au/guide/mac-help/mh15189/mac)
    • MacOS has a auto login on boot option but I'm not sure if you can configure multiple accounts to login on boot? could be worth to try this otherwise after a reboot you'd need to login to each account then switch user and log in the next user, repeat till all the users are logged in (this is why you want the agent to start on login) (https://support.apple.com/en-au/guide/mac-help/mchlp1158/13.0/mac/13.0)

I think the approach chosen will need to vary depending on the OS the GUI app need to run on, I think the above gives a reasonable option for each OS.

damies13 avatar Jun 23 '23 01:06 damies13