Customising the list of nodes to be given to the hub for request assignment

37 views
Skip to first unread message

Bhuvnesh Varshney

unread,
Mar 18, 2018, 12:45:19 AM3/18/18
to Selenium Users
Hi Everyone,

   Is there any way I can customise the list of nodes to be given to the hub for assigning the test case request coming from the client?

   Any help would be appreciated.

Shawn McCarthy

unread,
Mar 18, 2018, 11:43:49 AM3/18/18
to Selenium Users
You want certain test cases to only go to certain nodes? This is possible, with custom capabilities on the hub using a servlet.

Bhuvnesh Varshney

unread,
Mar 19, 2018, 4:17:43 AM3/19/18
to Selenium Users
Hi Shawn, 

   Thanks for replying. 
   I want to customise the assignment logic at the hub part for that I need the functionality to give the list of nodes to the hub to assign the coming request among those nodes only.

⇜Krishnan Mahadevan⇝

unread,
Mar 19, 2018, 5:21:02 AM3/19/18
to seleniu...@googlegroups.com
Pls Check if this blog post of mine helps 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/14e6b816-c818-4604-950e-7743ddcc4fd7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Bhuvnesh Varshney

unread,
Mar 19, 2018, 5:59:27 AM3/19/18
to Selenium Users
Hi Krishnan,

   I have already gone through this blog. It gave me great insight but still can not solve my use case. 
  
   I want all the nodes to be same while configuring them the first time. I want to dynamically check which node is available (based on my custom logic) and then want those available nodes to be given to hub for request assignment.

  Is there any way we can pass our customised list of nodes to the hub or eliminate some nodes before the request assignment from hub to nodes?

⇜Krishnan Mahadevan⇝

unread,
Mar 19, 2018, 6:03:55 AM3/19/18
to seleniu...@googlegroups.com
No AFAIK you cannot add/remove a note from being considered. What exactly are your trying to build. Care to elaborate ? 



For more options, visit https://groups.google.com/d/optout.

Bhuvnesh Varshney

unread,
Mar 19, 2018, 7:25:22 AM3/19/18
to Selenium Users
I want to create a proxy server using selenium grid. So I want to control which node is getting a request from Hub.

If I can not add/remove a node, is there any way I can achieve this?

⇜Krishnan Mahadevan⇝

unread,
Mar 19, 2018, 7:45:27 AM3/19/18
to seleniu...@googlegroups.com
That doesn't add a lot of context. What is your use case ? What do you aim to achieve by being able to control which node is getting new session request from hub ? Why does a capability matcher (which was built for this exact use case ) not work for you. 

Please remember, the more elaborate you can explain what you are trying to achieve, the better chance you stand at getting an apt reply. 


For more options, visit https://groups.google.com/d/optout.

Bhuvnesh Varshney

unread,
Mar 19, 2018, 8:36:09 AM3/19/18
to Selenium Users
Okay. So as I said, I want to create a proxy server using the selenium grid. So whenever client will request for a session, the request will go to hub and hub will decide which node is not serving the same domain or IP(which is coming in the request itself). This I will achieve using some database like Redis to store the 'domain(from the request)' and 'session id' to match with each new request. After knowing the list of nodes which are not serving the same domain or IP, I will want from hub to route that incoming request to any one of those nodes(which are not serving the same domain) only.

This way no node will be serving the same domain in its parallel sessions. Hope I have cleared the idea. Please let me know if I am not cleared yet.

Krishnan Mahadevan

unread,
Mar 19, 2018, 12:57:53 PM3/19/18
to seleniu...@googlegroups.com

You should very easily be able to add the required attributes (domain/ip etc.,) to your capabilities when you create a RemoteWebDriver instance.

 

At the grid end, you just plugin in the required logic to take into consideration these new attributes (domain/ip etc.,) apart from the default ones and then based upon a match, you have the capability matcher route the test.

 

Additionally, you would need a custom subclass of DefaultRemoteProxy, which after honoring a new session request, perhaps logs the ip/domain etc., into your redis cache.

 

Where exactly are you stuck when you tried this?

 

If you are talking about the session id of your application, then am not sure how to deal with it, coz AFAIK until you login, you don’t generate one.

If you are talking about the session id that the grid uses, then am afraid, you would have to consider something else, because session id is generated after a session is allocated which means a node has already been picked up to route the test to.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply-To: <seleniu...@googlegroups.com>
Date: Monday, March 19, 2018 at 6:06 PM
To: Selenium Users <seleniu...@googlegroups.com>
Subject: Re: [selenium-users] Re: Customising the list of nodes to be given to the hub for request assignment

Bhuvnesh Varshney

unread,
Mar 20, 2018, 2:27:24 AM3/20/18
to Selenium Users
Please find comments inline


On Monday, March 19, 2018 at 10:27:53 PM UTC+5:30, Krishnan Mahadevan wrote:

You should very easily be able to add the required attributes (domain/ip etc.,) to your capabilities when you create a RemoteWebDriver instance.  

 

At the grid end, you just plugin in the required logic to take into consideration these new attributes (domain/ip etc.,) apart from the default ones and then based upon a match, you have the capability matcher route the test. 

    

Additionally, you would need a custom subclass of DefaultRemoteProxy, which after honoring a new session request, perhaps logs the ip/domain etc., into your redis cache.

 

Where exactly are you stuck when you tried this?

 
    Bhuvnesh: But in this case, I have to add these custom capabilities to node config while creating nodes which will be kind of static configuration because it will restrict my nodes to get requests from some particular domain/IP only (which even I don't know how many are there).So I don't want to assign any custom capability to node config. I will manually check my Redis cache before every request assignment and then filter only those nodes which are not serving the same domain/IP that the incoming request belongs to.
 

If you are talking about the session id of your application, then am not sure how to deal with it, coz AFAIK until you login, you don’t generate one.

If you are talking about the session id that the grid uses, then am afraid, you would have to consider something else, because session id is generated after a session is allocated which means a node has already been picked up to route the test to.


Bhuvnesh: This is ok in my case as I would be having the session id (that grid uses) against the domain/IP, which client can pass while creating the RemoteWebDriver instance as a capability(that I will remove from the hashmap before matching it with node capabilities). 

To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to
selenium-users@googlegroups.com.


To view this discussion on the web visit

Reply all
Reply to author
Forward
0 new messages