-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ramalama serve is not checking if the port is available before running the command #797
Comments
|
We would need to somehow display the port. |
I faced this too, I will try to come up with a PR for this, minor but useful UX improvement |
Checking if a port is used is easy, on the client side, although racy. Attempt to bind to "default" port if user does not specify a port, and then fail over to random port. Launch the container or service with the port. If the user specifies --port, do not do this. Question is if user specifies a port in ramalama.conf do we fail or not? The only way the user can figure out which port we chose is to do a ramalama inspect. |
It's a good question, I would say yes fail, maybe we can make it possible to specifying a range of ports with some syntax like: 5000:5100
|
we seem to already print the serving port when starting (probably it's llama-cpp doing that?)
In any case, we can print out the chosen part before launching the container, like this :
So I would say that this could be already an improvement. |
This change checks if the default port is already taken. If it's the case, it tries to increment by 1 until finding a free port. We also print out the chosen port for the user. This does not apply if the user overrides the default port. Note that this check could be still not be enough if the chosen port is taken by another process after our check, in that case we will still fail at a later phase as today. Includes unit testing. Closes containers#797 Signed-off-by: Andrea Decorte <adecorte@redhat.com>
Being a pretty dumb user, I don't care the port where the model will be served. It can be a random port as it's being displayed
using 8080 as a default port is quite challenging because as a developer, I have tons of app that I start that are already using this port.
(so picking up a port different than 8080 can increase the "first attempt succeed"
most of the cli launchers detect that the port is in use and is serving the app using a basic '+1' on the default port
so If I launch 2 serve commands, it won't fail (unless I specify a port number and in that case yes I expect it fails if it's already taken but without specifying a port number I will assume the tool is picking one for me that works)
here is the current error message:
The text was updated successfully, but these errors were encountered: