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

Containerized Visualization + ChatGrid #147

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

nedpfeiffer
Copy link
Collaborator

Merge request type

  • New feature
  • Resolves bug
  • Documentation
  • Other

Relates to

  • Visualization

This MR updates

  • Visualization

Summary

I containerized the ExaGO visualization + ChatGrid with Docker Compose, simplifying set up. I also updated the documentation.

These proposed changes will break existing manual installations and will force users to switch to Docker Compose. I had to edit viz/backend/sqlchain.py and viz/backend/config.py to get the backend and database containers communicating. If there's an approach that won't break existing manual installs, I'm happy to try to tackle that.

@abhyshr abhyshr requested a review from sichenjin June 21, 2024 23:02
@abhyshr
Copy link
Collaborator

abhyshr commented Jun 21, 2024

Thanks, @nedpfeiffer. @sichenjin : Can you please take a look at this pull request. @cameronrutherford : Can you take a look at this and see if this can be added/merged to the ExaGO docker instance?

@cameronrutherford
Copy link
Contributor

Thanks, @nedpfeiffer. @sichenjin : Can you please take a look at this pull request. @cameronrutherford : Can you take a look at this and see if this can be added/merged to the ExaGO docker instance?

The existing Docker configuration for ExaGO is a mix of our GitHub container registry (ghcr) deployment, as well as the .devcontainer folder in the repo. They are separate, and for the moment can't really be merged.

For the ExaGO deployment in the EIOC Virtual Machine, I modified the Dockerfile in .devcontainer/Dockerfile to remove the frontend viz component. @nedpfeiffer now has the viz as a standalone Dockerfile, so I could consider removing the viz from the devcontainer...

In future, once we have a ghcr version of ExaGO w/o the need for CoinHSL, both the Docker compose and devcontainer can be changes to just use that deployment.

Copy link
Contributor

@cameronrutherford cameronrutherford left a comment

Choose a reason for hiding this comment

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

Awesome work! I don't have time to try this out for myself on my own machine, but I think this great and should be merged.

Maybe we consider moving ChatGrid outside of the ExaGO repo one day?

viz/README.md Outdated
Comment on lines 31 to 36
First, we need to convert the ExaGO output `.json` files to `.csv` files. The difference between the two data formats is that JSON stores attributes and values as dictionary pairs but CSV stores attributes and values as tables. You can write your own script for this conversion or use the provided script.

To use the provided script, first copy the ExaGO output `.json` file to the `viz/data` subdirectory and simply run the following script in the `viz/data` subdirectory (replace the example filename with your json filename). This will output three CSV files: `generation.csv`, `bus.csv`, and `tranmission_line.csv`.
```
python jsontocsv.py opflowout.json
```
Copy link
Contributor

Choose a reason for hiding this comment

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

@abhyshr iirc we discussed adding direct CSV output support to both ExaGO and the Python bindings at some point, but were satisfied with this approach (post-processing based conversion). Should we open an issue explicitly to track this?

@sichenjin
Copy link
Collaborator

This is awesome, @nedpfeiffer! The setup process has been greatly simplified, and I really appreciate it. I tested it locally, and the visualization works perfectly. However, could you provide more details on how the database is currently connected to the backend? I followed the instructions to edit the setup.env file, but it seems ChatGrid can't read the database information correctly. Additionally, I'm not very familiar with Docker. Is it possible to access the backend output for debugging when running the code in Docker? Thank you.

@nedpfeiffer
Copy link
Collaborator Author

However, could you provide more details on how the database is currently connected to the backend?

Docker configures a default virtual network and automatically resolves hostnames to the names of the containers. In sqlchain.py I replaced localhost with database, and Docker does the rest.

I followed the instructions to edit the setup.env file, but it seems ChatGrid can't read the database information correctly.

Please make sure you've run geninputfile.py and jsontocsv.py on your input file. If the csv files haven't been generated, the database won't get populated using the init.sql script.

Is it possible to access the backend output for debugging when running the code in Docker?

I took a cursory look at this and haven't found an easy solution such as adding --debug to the last line of the Dockerfile. I've been using the logs left by console.log and pgadmin to troubleshoot issues so far. I'll keep looking for a solution.

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.

4 participants