-
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
@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
|
||
|
||
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
request: Request, | ||
templates: Annotated[Jinja2Templates, Depends(get_templates)], | ||
spec: notebook.NotebookSpecWithConfig = Depends(_inject_app_config), # noqa: B008 | ||
) -> Response: | ||
|
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.
@@ -44,12 +60,13 @@ def _inject_app_config( | |||
raise RequestValidationError(errors) from None | |||
|
|||
|
|||
@app.post("/notebook", response_model=dict, response_description="Rendered notebook") | |||
async def format_notebook( | |||
@app.post("/notebook", response_model=dict, response_description="Rendered notebook with json input") |
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.post("/notebook", response_model=dict, response_description="Rendered notebook with json input") | |
@app.post("/notebook", response_model=dict, response_description="Rendered notebook from json input") |
It doesn't return the json intput.
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