-
Notifications
You must be signed in to change notification settings - Fork 709
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
Check if port is occupied before starting Kolibri #3302
Check if port is occupied before starting Kolibri #3302
Conversation
Codecov Report
@@ Coverage Diff @@
## release-v0.8.x #3302 +/- ##
=================================================
+ Coverage 74.48% 74.5% +0.01%
=================================================
Files 209 210 +1
Lines 8220 8251 +31
Branches 1000 1002 +2
=================================================
+ Hits 6123 6147 +24
- Misses 1897 1904 +7
Partials 200 200
Continue to review full report at Codecov.
|
863516b
to
545a1dc
Compare
kolibri/utils/cli.py
Outdated
@@ -314,6 +312,7 @@ def stop(): | |||
pid, __, __ = server.get_status() | |||
server.stop(pid=pid) | |||
stopped = True | |||
logger.info("Kolibri server has been successfully stoppped.") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nits, otherwise this looks good.
kolibri/utils/sanity_checks.py
Outdated
logger.error( | ||
"Port {} is occupied.\n" | ||
"Please check that you do not have other processes " | ||
"running on this port and try again.\n".format(port)) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
kolibri/utils/sanity_checks.py
Outdated
pid, listen_address, listen_port = get_status() | ||
logger.error( | ||
"There is another Kolibri server running. " | ||
"Please use `kolibri stop` and try again.") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
"There is another Kolibri server running. " | ||
"Please use `kolibri stop` and try again." | ||
) | ||
sys.exit(1) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Summary
This PR is to implement one of the sanity checks before starting Kolibri.
In this PR, before launching Kolibri:
server.get_status()
. If a Kolibri server is running, then users should not be able to runkolibri start
again. The program will exit with an error message.Additionally, I added a line in the function
stop()
ofcli.py
to indicate that kolibri server has been stopped.Reviewer guidance
Running with two pex files could be an easier approach.
References
Issues:
#3285
#2867
#3048
Contributor Checklist
Reviewer Checklist
yarn
andpip
)