-
Notifications
You must be signed in to change notification settings - Fork 1
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
Create container #20
base: main
Are you sure you want to change the base?
Create container #20
Conversation
…ve map plot instead of the matplotlib map plot in the clustering.py section
added poetry.lock to container
Please build the container as indicated in the updated README, @eduardocorrearaujo . The container should build normally it takes a while the first time due to the downloads. |
I am receiving this error when trying run the
|
Installation of the GDAL library must be added to the Dockerfile. @esloch , could help here? I think it is just a matter of installing GDAL either via apt or mamba. |
I tried |
Gdal is a very special one. I would install it via mamba if possible. Btw, what is the error when you installed that via poetry? |
The error is: To add the gdal in the Dockerfile I should add the line: |
GDAL is a c++ library and thus can't be pip installed. |
I suggest you pass requirements.txt to a .yaml environment file and use conda/mamba to resolve GDAL dependencies. |
Thank you. I will work on that today. |
…zed the codes in diferent folders
I am facing this error to run the app in the container:
I found this issue discussing it, but I would like to ask you what is the common workflow in this case: |
@eduardocorrearaujo. Are you trying to connect to your local database from the container? |
No, I am trying to connect to the epigraphhub database. |
Eduardo, vi que usas repetidas vezes a URI de conexão chumbada nos módulos: |
app/SIR_forecast.py
Outdated
from dotenv import load_dotenv | ||
load_dotenv('../.env') | ||
|
||
engine = create_engine(f'postgresql://{os.getenv("POSTGRES_USER")}:{os.getenv("POSTGRES_PASSWORD")}@{os.getenv("POSTGRES_HOST")}:{os.getenv("POSTGRES_PORT")}/{os.getenv("POSTGRES_DB")}') |
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.
Perhaps you can use the same approach here...
Creating config.py, to avoid calling connection variables more than once.
app/bayesian_inference.py
Outdated
from dotenv import load_dotenv | ||
load_dotenv('../.env') | ||
|
||
engine = create_engine(f'postgresql://{os.getenv("POSTGRES_USER")}:{os.getenv("POSTGRES_PASSWORD")}@{os.getenv("POSTGRES_HOST")}:{os.getenv("POSTGRES_PORT")}/{os.getenv("POSTGRES_DB")}') |
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.
Same config.py here.
app/for_other_cantons.py
Outdated
from dotenv import load_dotenv | ||
load_dotenv('../.env') | ||
|
||
engine = create_engine(f'postgresql://{os.getenv("POSTGRES_USER")}:{os.getenv("POSTGRES_PASSWORD")}@{os.getenv("POSTGRES_HOST")}:{os.getenv("POSTGRES_PORT")}/{os.getenv("POSTGRES_DB")}') |
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.
Same config.py here.
app/forecast.py
Outdated
|
||
engine = create_engine(f'postgresql://{os.getenv("POSTGRES_USER")}:{os.getenv("POSTGRES_PASSWORD")}@{os.getenv("POSTGRES_HOST")}:{os.getenv("POSTGRES_PORT")}/{os.getenv("POSTGRES_DB")}') |
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.
Same config.py here.
app/get_data.py
Outdated
|
||
engine_public = create_engine("postgresql://epigraph:epigraph@localhost:5432/epigraphhub") | ||
engine = create_engine(f'postgresql://{os.getenv("POSTGRES_USER")}:{os.getenv("POSTGRES_PASSWORD")}@{os.getenv("POSTGRES_HOST")}:{os.getenv("POSTGRES_PORT")}/{os.getenv("POSTGRES_DB")}') |
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.
Same config.py here.
app/config.py
Outdated
POSTGRES_PASSWORD = os.getenv("POSTGRES_PASSWORD") | ||
POSTGRES_HOST = os.getenv("POSTGRES_HOST") | ||
POSTGRES_PORT = os.getenv("POSTGRES_PORT") | ||
POSTGRES_DB = os.getenv("POSTGRES_DB") |
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 idea would be to keep the call of all variables just inside that config file with like this:
DB_URI = (
f"postgresql://{DB_USER}:{DB_PASSWORD}"
f"@{DB_HOST}:{DB_PORT}/{DB_NAME}"
)
and in the modules use like this:
engine = create_engine(config.DB_URI)
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.
ok
510f005
to
9dd291b
Compare
This PR aims to solve issue #18.
I also make some changes on the dashboard:
About the container: The docker version was taking too long to run on my local machine, and I wasn't able to test it. But, I had the same problem trying to run the streamit-template, so maybe it's a problem in my personal machine. So, please, try to run it on your machine and let me know if you have any problem.
To create the new files, I used as reference the Dockerfile in the streamlit-template repo and this tutorial from docker: https://www.docker.com/blog/how-to-dockerize-your-python-applications/