-
Notifications
You must be signed in to change notification settings - Fork 7
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
Liu 285 - Rebuilt lg_web with FastAPI #201
Conversation
Alters requirements to suit, replacing bottle with uvicorn in the process.
Moves prepare_lgt method from lg_web to translator_utils.
…l variables. Updates /gen_pgt GET method to use query fields rather than body form fields.
Updates several api endpoints to correctly behave. Adds algorithm parameters to gen_pgt apis (in a backwards compatible but not totally satisfying manner).
Adds reprodata wrapping to unroll endpoint.
…graph_init needs to load the object as JSON
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.
The changes in general seem pretty good. I've found two issues:
- When trying to deploy to ood-cld the graph does get deployed but there is an error message and the execution fails as well. The error message in the translator log says: TypeError: 'str' object is not an iterator
- This is actually a left-over I've found when trying the really nice FastAPI docs feature: There is a stray </script> tag at the very end of matrix_vis.html.
- The API docs should probably also be an additional item in the Help pull-down menu
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 did a quick pass through all files except the new FastAPI-based lg_web module - I can go through that with more time if needed.
Corresponding update in main.js parses pgt string into Json object, before submitting to OOD endpoint.
Addressing Andreas' comments
Fixed, the new gen_pg endpoint was returning a streaming response - which was incorrect, this has been changed to a JSONResponse; much more sensible. The JSON is a string, however, so in the main.js file, this needs to be parsed before sending off to OOD.
Easily fixed
Added |
# Conflicts: # daliuge-translator/test/dropmake/test_lgweb.py
… algorithm tests all in test_lgweb.py.
This MR re-implements the translator web service with Fast API.
Additionally, this MR provides new implementations for each of the translator command-line actions.
To see the live documentation of the translator, load up an instance (e.g. 0.0.0.0:8086) and head to 0.0.0.0:8086/docs.
Not only is this a clean presentation of the APIs, but allows for manual in-browser testing of each of the endpoints.
I have convinced myself that the re-implementation does introduce any breaking changes, although I would like this to be checked before merging if possible.
I will henceforth evangelise FastAPI - it is a delight to use.