Using Selenium Grid with a custom proxy, identify node

863 views
Skip to first unread message

Qays Poonawala

unread,
Jun 12, 2015, 1:05:20 AM6/12/15
to seleniu...@googlegroups.com
Looking at the docs for Grid, http://docs.seleniumhq.org/docs/07_selenium_grid.jsp it seems to suggest that we might be able to tell the node to "auto restart" or perform other actions.
I was wondering how one might gain reference to the node within the proxy class, so they we could send these instructions to it.

I am using Java and subclassing DefaultRemoteProxy as suggested in the docs. From the Registry object, I see that we can get a reference to the hub. I know that the RegistrationRequest comes from the Node, but not how to get access to the node.

Thanks for any and all help!

Krishnan Mahadevan

unread,
Jun 12, 2015, 4:19:17 AM6/12/15
to Selenium Users
I think you are getting it wrong.

Here's how the Grid works .

The Proxy is the Grid's way of representing a particular node. So the number of proxy objects that are instantiated [ they get instantiated with the node sends in a registration request to the Hub ] at the hub is directly equal to the number of actual node instances running.

So all you would need to do is within your node, you need to write the logic which determines : "When can a node be restarted". Since the current proxy instance is always going to represent a specific node, all you would need to do is send a "Shutdown instruction" to a servlet that is associated with the current node [ as represented by the current proxy instance ] 

We built a full fledged Self Healing Grid environment that does exactly this, when we built SeLion [ http://selion.io ]


The part which caters to instructing a node instance to shut itself down can be found here : https://github.com/paypal/SeLion/blob/develop/server/src/main/java/com/paypal/selion/proxy/SeLionRemoteProxy.java#L261-L284

The servlet that basically performs the shutdown operation [ which is just a System.exit() call ] can be seen here : https://github.com/paypal/SeLion/blob/develop/server/src/main/java/com/paypal/selion/node/servlets/NodeForceRestartServlet.java

I have tried my level best to explain the overall thought process on how to go about building one such Grid in my blog post : https://rationaleemotions.wordpress.com/2013/01/28/building-a-self-maintaining-grid-environment/

If you are interested in consuming what we built in SeLion, you can take a look at this documentation that we created which explains how to use the SeLion Grid : http://paypal.github.io/SeLion/html/documentation.html#selion-grid

Hope that helps !











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/

--
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/b4f10bc4-1a9d-4217-ad4f-fe07b15693f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Qays Poonawala

unread,
Jun 17, 2015, 11:52:06 AM6/17/15
to seleniu...@googlegroups.com
Thank you for your detailed answer and the links to code, as well as the blog post!

We have a custom application with a REST endpoint running on the node, much like what you are calling a servlet (sorry I was not familiar with that term, had to Google it).

I didn't realize that getRemoteHost() would refer to the node. The variable machine from the eBay/PayPal code is exactly what I was looking for, to be able to send a request to the node.

Thanks again!
Reply all
Reply to author
Forward
0 new messages