-
Notifications
You must be signed in to change notification settings - Fork 0
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
Interactive apps #78
Interactive apps #78
Conversation
Notes for self for current implementation Pros
Alternative implEach app will have own endpoint, Pro:
|
Got error: usage: haddock3-re [-h] {score,clustrmsd,clustfcc} ...\nhaddock3-re: error: unrecognized arguments: 0.1 output/11_clustfcc/\n'
Now we have 3 dynamic endpoints:
These could be replaced with an endpoint for each interactive app. For example for rescore interactive app it could be:
By calling below to lifespan def unroll_interactive_app_routes(app: FastAPI) -> None:
"""Unroll interactive app routes.
Replaces `/api/job/{jobid}/interactive/{application}` endpoint with
Loop over config.interactive_applications and add a post route for each
Args:
app: FastAPI app
"""
if app.openapi_schema:
return app.openapi_schema
app.openapi()
interactive_applications = cast(
InteractiveApplicationConfigurations, app.state.config.interactive_applications
)
existing_post_path = app.openapi_schema["paths"]["/api/job/{jobid}/interactive/{application}"][
"post"
]
for iname, config in interactive_applications.items():
path = f"/api/job/{{jobid}}/interactive/{iname}"
post = {
"tags": ["interactive"],
"operationId": f"interactive_{iname}",
"parameters": [
{
"name": "jobid",
"in": "path",
"required": True,
"schema": {"type": "string"},
},
{
"name": "body",
"in": "body",
"required": True,
"schema": config.input,
},
],
"responses": existing_post_path["responses"],
"security": existing_post_path["security"],
}
if config.summary is not None:
post["summary"] = config.summary
if config.description is not None:
post["description"] = config.description
app.openapi_schema["paths"][path] = {
"post": post
} Pros:
Cons:
|
…ema` + more validation on startup
…ipped test for nested files
When the openapi spec has endpoints named after the interactive applications then it makes sense to do the same for the applications as well. For example with haddock3 application the current openapi looks like
When each application has endpoint it would look like
|
…pplications are static routes.
upload should be typed as blob, but changes locally elsewhere cause it to become any|null. Which is invalid client code. To fix had to make sure routes with fileresponse have correct response content type. TODO - When extra application is added then generated client has any|null type for last app.
Implemented this, see screenshot in PR description, but without GET routes as they are not needed. |
Make application endpoints more like interactive endpoints
There is enough stuff in this PR lets merge it. |
Adds endpoints for interactive applications (<30s).
Which can be run on a directory of a completed job and are configured in yaml file with JSON schema and Jinja template.
Refs haddocking/haddock3#686
This PR also replaces the dynamic routes for application to static ones in the openapi spec.