-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor endpoints #20
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
base: main
Are you sure you want to change the base?
Conversation
src/sciwyrm/main.py
Outdated
@app.get("/alive", response_description="The service is alive") | ||
async def list_templates( | ||
config: Annotated[AppConfig, Depends(app_config)] | ||
) -> bool: | ||
"""Return a list of available notebook templates.""" | ||
return True |
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.
@app.get("/alive", response_description="The service is alive") | |
async def list_templates( | |
config: Annotated[AppConfig, Depends(app_config)] | |
) -> bool: | |
"""Return a list of available notebook templates.""" | |
return True | |
@app.get("/alive", response_description="The service is alive") | |
async def is_alive() -> bool: | |
"""Return True to indicate that the service is running.""" | |
return True |
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.
How about using the more conventional name live(z) and returning the string ok
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.
I renamed it to livez
.
src/sciwyrm/main.py
Outdated
|
||
|
||
if __name__ == "__main__": | ||
uvicorn.run(app, host="0.0.0.0", port=8000) |
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.
What is this good for? I don't like that it has a fixed address and port. Doesn't this just lead to conflicts?
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.
It is the typical way to run it standalone in dev, but yes making the port configurable would be a nice addition
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.
Is it? Judging by the documentation, you are supposed to use uvicorn sciwyrm.main:app
. Plus, this way, you can use uvicorn sciwyrm.main:app --reload
which auto reloads the app when files are changed.
2ced623
to
4522331
Compare
This PR adds the
alive
endpoint which is useful when deploying with an orchestration tool like kubernetes and docker and renamed thenotebook/templates
to justtemplates