Skip to content
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

Improve EOSdash. #417

Open
wants to merge 2 commits into
base: feature/config-nested
Choose a base branch
from

Conversation

b0661
Copy link
Collaborator

@b0661 b0661 commented Jan 25, 2025

Make EOSdash use UI components from MonsterUI to ease further development.

  • Add a first menu with some dummy pages and the configuration page.
  • Make the configuration scrollable.
  • Add markdown component that uses markdown-it-py (same as used by
    the myth-parser for documentation generation).
  • Add bokeh (https://docs.bokeh.org/) component for charts
  • Added several prediction charts to demo
  • Add a footer that displays connection status with EOS server
  • Add logo and favicon

Update EOS server:

  • Provide health endpoint for alive checking.
  • Move error message generation to extra module

For feature branch: feature/config-nested. Based on #431 (to be merged first)

@b0661 b0661 force-pushed the add_eosapp branch 3 times, most recently from e36c529 to cc29506 Compare January 26, 2025 15:12
@b0661 b0661 requested review from NormannK and Lasall January 26, 2025 16:25
@b0661
Copy link
Collaborator Author

b0661 commented Jan 26, 2025

Ready for review and merge.

Copy link
Collaborator

@Lasall Lasall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very excited to check it out, can you upload footer.py as well?
ModuleNotFoundError: No module named 'akkudoktoreos.server.dash.footer'

src/akkudoktoreos/server/eos.py Outdated Show resolved Hide resolved
src/akkudoktoreos/server/eosdash.py Show resolved Hide resolved
@b0661
Copy link
Collaborator Author

b0661 commented Jan 26, 2025

I'm very excited to check it out, can you upload footer.py as well? ModuleNotFoundError: No module named 'akkudoktoreos.server.dash.footer'

Sorry, test for EOSdash is definitively missing. Module added now.

@Lasall
Copy link
Collaborator

Lasall commented Jan 26, 2025

Looks pretty nice!
The content of the table (at least dark mode) is quite difficult to read.
Screenshot_20250126_183318

Also after initial load the footer shows "Footer" for 5sec.

@NormannK
Copy link
Collaborator

NormannK commented Jan 26, 2025

after starting eos on windows accessing http://localhost:8503/ i get the 404.
image

access to eosdash does work (http://localhost:8504/)

very nice.

Documentation link should open in a new tab.

@b0661
Copy link
Collaborator Author

b0661 commented Jan 27, 2025

after starting eos on windows accessing http://localhost:8503/ i get the 404.

Please wait a little bit and refresh. It takes some time for EOSdash to start up. Maybe we have to add a longer timeout here until display of the page.

@NormannK
Copy link
Collaborator

I did wait several minutes. same result. some kind of console output like Loading .... | ... Loading finished would be great.

@NormannK
Copy link
Collaborator

I did wait several minutes. same result. some kind of console output like Loading .... | ... Loading finished would be great.

some minutes after that and many refreshes i get:
image

@b0661
Copy link
Collaborator Author

b0661 commented Jan 27, 2025

Looks pretty nice! The content of the table (at least dark mode) is quite difficult to read.

Now used themed content. Should be better readable.

Also after initial load the footer shows "Footer" for 5sec.

Footer needs to wait for alive connection result. Now a loading symbol is displayed for the first 5 seconds.

@b0661
Copy link
Collaborator Author

b0661 commented Jan 27, 2025

I did wait several minutes. same result. some kind of console output like Loading .... | ... Loading finished would be great.

some minutes after that and many refreshes i get: image

Your EOS server does not supply the openapi.json. Seems to be related to the EOS server. Could you please check.

@b0661 b0661 force-pushed the add_eosapp branch 2 times, most recently from fb46c19 to 4ab0561 Compare January 27, 2025 19:47
@NormannK
Copy link
Collaborator

sorry but it does not start anymore. same 404 on 8503 and http://localhost:8504/ gets a "Internal Server Error" without any further debug information. I did delete all config/cache folders before starting it.

@b0661
Copy link
Collaborator Author

b0661 commented Jan 28, 2025

sorry but it does not start anymore. same 404 on 8503 and http://localhost:8504/ gets a "Internal Server Error" without any further debug information. I did delete all config/cache folders before starting it.

Please assure you did install all required packages.

make pip-dev

If it still does not work, please only start eosdash and provide the error output:

.venv/bin/python src/akkudoktoreos/server/eosdash.py --reload True

@NormannK
Copy link
Collaborator

sorry but it does not start anymore. same 404 on 8503 and http://localhost:8504/ gets a "Internal Server Error" without any further debug information. I did delete all config/cache folders before starting it.

Please assure you did install all required packages.

make pip-dev

If it still does not work, please only start eosdash and provide the error output:

.venv/bin/python src/akkudoktoreos/server/eosdash.py --reload True

https://pastebin.com/s4n3N2B8

@b0661
Copy link
Collaborator Author

b0661 commented Jan 28, 2025

sorry but it does not start anymore. same 404 on 8503 and http://localhost:8504/ gets a "Internal Server Error" without any further debug information. I did delete all config/cache folders before starting it.

@NormannK, Please try the new version.

@b0661
Copy link
Collaborator Author

b0661 commented Jan 28, 2025

done. http://localhost:8504/ does load again. looks good. 8503 same 404

edit: in the footer: HTTPConnectionPool(host='0.0.0.0', port=8503): Max retries exceeded with url: /v1/health (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001CAD82736D0>: Failed to establish a new connection: [WinError 10049] The requested address is not valid in its context'))

Footer is ok. EOS is not running and this is the lengthy error message. Should vanish when you start EOS.

Did you also start EOS?

@b0661 b0661 force-pushed the add_eosapp branch 2 times, most recently from 38fee88 to e5ab66d Compare February 2, 2025 21:42
@b0661
Copy link
Collaborator Author

b0661 commented Feb 2, 2025

done. http://localhost:8504/ does load again. looks good. 8503 same 404
edit: in the footer: HTTPConnectionPool(host='0.0.0.0', port=8503): Max retries exceeded with url: /v1/health (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001CAD82736D0>: Failed to establish a new connection: [WinError 10049] The requested address is not valid in its context'))

Footer is ok. EOS is not running and this is the lengthy error message. Should vanish when you start EOS.

Did you also start EOS?

@NormannK, please try the new version. Should now detect if a server is already running. Hopefully this helps.

@b0661 b0661 force-pushed the add_eosapp branch 2 times, most recently from 64c7fa2 to 1c29f85 Compare February 7, 2025 19:04
@b0661
Copy link
Collaborator Author

b0661 commented Feb 7, 2025

Updated. Please Test.

E.g. new demo page.
Screenshot_20250207_200740

Copy link
Collaborator

@Lasall Lasall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great dashboard changes + cache improvments. Could already drop the demo (force of demo settings) and display the real system, probably have to adjust the test then a little.
I would probably also go as far as separate the backend/frontend more (different repos) as the dependencies and assets start diverging. But that's a different discussion/PR.

Only remark I have: Let's let the user decide about their app startup (systemd, docker-compose, initXYZ, ...) and we can drop a dependency and remove some controlling code. Currently it would block startup if I have the server-file open for some reason (e.g. development).

@@ -171,9 +90,26 @@ def start_eosdash() -> subprocess.Popen:
access_log = args.access_log
reload = args.reload

# Check if EOSdash process is already running
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init system

@@ -912,28 +1028,25 @@ def site_map() -> RedirectResponse:

# Keep the proxy last to handle all requests that are not taken by the Rest API.

if config_eos.server.startup_eosdash:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it break the proxy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did it break the proxy?

Proxy operation is not related to startup_eosdash. EOSdash may be started by other means.

@@ -1004,6 +1117,21 @@ def run_eos(host: str, port: int, log_level: str, access_log: bool, reload: bool
# Make hostname Windows friendly
if host == "0.0.0.0" and os.name == "nt":
host = "localhost"

# Check if EOSdash process is already running
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init system

"""
# Make hostname Windows friendly
if host == "0.0.0.0" and os.name == "nt":
host = "localhost"

# Check if EOSdash process is already running
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init system

@b0661 b0661 force-pushed the add_eosapp branch 2 times, most recently from dd36445 to 4c54550 Compare February 8, 2025 00:13
@b0661
Copy link
Collaborator Author

b0661 commented Feb 8, 2025

Could already drop the demo (force of demo settings) and display the real system, probably have to adjust the test then a little.

Demo is for situations where we do not have a full config or the config is invalid - e.g. first time use. Maybe the Demo button can be made configurable, so a user can just decide it not to be shown.

@b0661
Copy link
Collaborator Author

b0661 commented Feb 8, 2025

Currently it would block startup if I have the server-file open for some reason (e.g. development).

EOSdash would not start up if another EOSdash is already running on the same host. This is by intention. Can you explain why this is a problem?

@Lasall
Copy link
Collaborator

Lasall commented Feb 8, 2025

With the current implementation it also does not start up if I access the file in any other way, e.g. vim ...py . Let's keep any advanced startup handling to the OS.

@b0661
Copy link
Collaborator Author

b0661 commented Feb 8, 2025

With the current implementation it also does not start up if I access the file in any other way, e.g. vim ...py . Let's keep any advanced startup handling to the OS.

Ok, I see. The criterium for the correct process is to weak.

b0661 added 2 commits February 8, 2025 03:09
* Move the caching module to core.

Add an in memory cache that for caching function and method results
during an energy management run (optimization run). Two decorators
are provided for methods and functions.

* Improve the file cache store by load and save functions.

Make EOS load the cache file store on startup and save it on shutdown.
Add a cyclic task that cleans the cache file store from outdated cache files.

* Improve startup of EOSdash by EOS

Make EOS starting EOSdash adhere to path configuration given in EOS.
The whole environment from EOS is now passed to EOSdash.
Should also prevent test errors due to unwanted/ wrong config file creation.

* Allow to check server process startup by health status

Both servers now provide a health endpoint that can be used to detect whether
the server is running. This is also used for testing now.

* Add administration endpoints to control caching from REST API.

* Improve test support (to be able to test caching)

  - Add system test option to pytest for running tests with "real" resources
  - Add new test fixture to start server for test class

Signed-off-by: Bobby Noelte <[email protected]>
Make EOSdash use UI components from MonsterUI to ease further development.

- Add a first menu with some dummy pages and the configuration page.
- Make the configuration scrollable.
- Add markdown component that uses markdown-it-py (same as used by
  the myth-parser for documentation generation).
- Add bokeh (https://docs.bokeh.org/) component for charts
- Added several prediction charts to demo
- Add a footer that displays connection status with EOS server
- Add logo and favicon

Update EOS server:

- Move error message generation to extra module

Signed-off-by: Bobby Noelte <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants