Conversation
josephmckinsey
left a comment
There was a problem hiding this comment.
Do we plan on having some sort of UI like helics-cli-extras currently has? If we do, then maybe we should replace the helics-cli-extras code instead, especially since I believe it now unreachable.
| server implementation. | ||
| """ | ||
|
|
||
| from __future__ import annotations |
There was a problem hiding this comment.
Shouldn't be needed given that we are now using a newer version of Python.
| async def get_broker_state(name: str) -> QueryResponse: | ||
| """Return the broker's current HELICS state using the standard query.""" | ||
| try: | ||
| value = await run_in_threadpool( |
There was a problem hiding this comment.
Why bother with the run_in_threadpool? I believe we can just make these sync functions:
https://fastapi.tiangolo.com/async/#in-a-hurry
If you are using a third party library that communicates with something (a database, an API, the file system, etc.) and doesn't have support for using await, (this is currently the case for most database libraries), then declare your path operation functions as normally, with just def, like:
And:
When you declare a path operation function with normal def instead of async def, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).
add a webserver into pyHELICS.
The plan will be to get the base in here and some capabilities.
The next stages will add more capabilities and then migrate the existing web ui into the same structure. Probably over the course of 3 or more PR's. This will remove the flask UI and simplify the interface.
This will also add pydantic types for all (most) queries to make query operations cleaner in python.