[🚀 Feature]: Make --distributor-implementation and --grid-model available for "Hub" mode
Feature and motivation
Hello,
I try to migrate a custom grid v3 to v4. This grid used servlet to add features. As servlets are not supported anymore (sadly, routes cannot be added), I owuld like to start a servlet server on Hub startup I thought I could use the "--distributor-implementation" for example to extend the behaviour, but it's only taken into account when distributor is started as a single component, not through Hub
Distributor distributor = new LocalDistributor(
tracer,
bus,
clientFactory,
sessions,
queue,
distributorOptions.getSlotSelector(),
secret,
distributorOptions.getHealthCheckInterval(),
distributorOptions.shouldRejectUnsupportedCaps(),
newSessionRequestOptions.getSessionRequestRetryInterval());
Would it be possible to be able to specify my own class as a distributor ?
Thanks
Usage example
Start a hub with a specific distributor class
@bhecquet, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
This should be possible, what error do you get?
Hello
I do not get any error, but the option is not used It was not clear in the code example but this ils extracted from Hub class which starts a LocalDistributor whatever the option is.
If you do java -jar selenium-server-4.2.2.jar hub --help you will see the flags being available for it.
Yes, you're right, the option is present, but it's not used If you look at https://github.com/SeleniumHQ/selenium/blob/2c9cbd7c3322c1e38afc02191e8dc3f02de47866/java/src/org/openqa/selenium/grid/commands/Hub.java#L156 , you can see that a LocalDistributor is created, it does not use the option
Instead, if you look at https://github.com/SeleniumHQ/selenium/blob/e0d9309438c34c4e0715bce4b7d3d03b0c3fb9e9/java/src/org/openqa/selenium/grid/distributor/httpd/DistributorServer.java#L92, you can see that Distributor creation is done through the call distributorOptions.getDistributor()
Yes, you are right.
Would you like to send a PR?
I can try ==> I cannot setup the build environment on my computer (provided by my company) bazel fails, so I'm afraid I will not be able to provide a PR
I was reading through this issue again and also checking the implementation we have for Hub and Standalone.
So, the flags are not used in the Hub and Standalone because those two modes denote very specific ways of putting all components together, and using Distributor distributor = distributorOptions.getDistributor(); won't work because the components need to interact in a specific way. That is why --distributor-implementation can only be used in the DistributorServer mode only.
I am also removing the --grid-model because it is not being used and so far no one has needed to provide their own implementation of the model.
What you are requesting in this feature is to add your own Servlets or endpoints, and providing your own Distributor or GridModel implementation does not allow you to do that.
What you are looking for is what is being asked in #9708. Which I will be having a look in the next weeks, so please watch that issue.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.