From 2e8a91191cdba694925e4451c1d219446fbba803 Mon Sep 17 00:00:00 2001 From: Natalie Schultz <90212258+nataliejschultz@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:21:18 -0600 Subject: [PATCH 1/2] Changes to actions + echo Trying to build an image off this branch instead of the other branch, so that testing is more relevant to the changes on consolidate-differences. --- .docker/docker_start_script.sh | 1 + .github/workflows/image_build_push.yml | 2 +- .github/workflows/osx-ubuntu-manual-install.yml | 7 ++++--- .github/workflows/test-default-action.yml | 7 ++++--- .github/workflows/test-with-docker.yml | 4 ++-- .github/workflows/test-with-manual-install.yml | 10 ++++++---- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.docker/docker_start_script.sh b/.docker/docker_start_script.sh index f4bc17032..daf82b32e 100644 --- a/.docker/docker_start_script.sh +++ b/.docker/docker_start_script.sh @@ -33,6 +33,7 @@ fi #TODO: start cron jobs # change python environment +echo "Starting up e-mission-environment..." source setup/activate.sh # launch the webapp diff --git a/.github/workflows/image_build_push.yml b/.github/workflows/image_build_push.yml index 9fd15dfa0..9fbaa04f3 100644 --- a/.github/workflows/image_build_push.yml +++ b/.github/workflows/image_build_push.yml @@ -6,7 +6,7 @@ name: docker image # events but only for the master branch on: push: - branches: [ image-push-merge ] + branches: [ consolidate-differences ] # Env variable diff --git a/.github/workflows/osx-ubuntu-manual-install.yml b/.github/workflows/osx-ubuntu-manual-install.yml index e6ecf0ddc..00db6f1f9 100644 --- a/.github/workflows/osx-ubuntu-manual-install.yml +++ b/.github/workflows/osx-ubuntu-manual-install.yml @@ -5,11 +5,12 @@ name: osx-ubuntu-manual-install on: push: branches: - - master - - gis-based-mode-detection + # - master + # - gis-based-mode-detection + - consolidate-differences pull_request: branches: - - master + # - master - gis-based-mode-detection schedule: # * is a special character in YAML so you have to quote this string diff --git a/.github/workflows/test-default-action.yml b/.github/workflows/test-default-action.yml index 424e5bee1..15b38e593 100644 --- a/.github/workflows/test-default-action.yml +++ b/.github/workflows/test-default-action.yml @@ -7,11 +7,12 @@ name: CI on: push: branches: - - master - - gis-based-mode-detection + # - master + # - gis-based-mode-detection + - consolidate-differences pull_request: branches: - - master + # - master - gis-based-mode-detection # A workflow run is made up of one or more jobs that can run sequentially or in parallel diff --git a/.github/workflows/test-with-docker.yml b/.github/workflows/test-with-docker.yml index e38499544..a71fda621 100644 --- a/.github/workflows/test-with-docker.yml +++ b/.github/workflows/test-with-docker.yml @@ -6,9 +6,9 @@ name: test-with-docker # events but only for the master branch on: push: - branches: [ master ] + branches: [ consolidate-differences ] pull_request: - branches: [ master ] + branches: [ consolidate-differences ] schedule: # * is a special character in YAML so you have to quote this string - cron: '5 4 * * 0' diff --git a/.github/workflows/test-with-manual-install.yml b/.github/workflows/test-with-manual-install.yml index 4a81eb000..0056cc37a 100644 --- a/.github/workflows/test-with-manual-install.yml +++ b/.github/workflows/test-with-manual-install.yml @@ -7,12 +7,14 @@ name: ubuntu-only-test-with-manual-install on: push: branches: - - master - - gis-based-mode-detection + # - master + # - gis-based-mode-detection + - consolidate-differences pull_request: branches: - - master - - gis-based-mode-detection + # - master + # - gis-based-mode-detection + - consolidate-differences schedule: # * is a special character in YAML so you have to quote this string - cron: '5 4 * * 0' From a0190d431a1c4b11fa1abb6b26793f9ab027859a Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Tue, 30 Apr 2024 01:07:09 -0700 Subject: [PATCH 2/2] Fix for "url" KeyError observed in public-dash redesign testing The bug was triggered by a .gitignore-d conf/ directory in public-dash which had a db.conf file. This was being loaded when docker-compose.dev.yml was used to test the dev version of public-dash. This was occurring since there was a nested dictionary in the db.conf.sample and db.conf files while I had initially only stored the nested keys (url, result_limit). Since it was still reading from the file, it stored the nested dictionary format with timeseries as the parent key followed by (url, result_limit) as children. Hence, fixing it by adding the same nested dictionary structure in the emission/core/config.py and emission/core/get_database.py --- emission/core/config.py | 14 +++++++++----- emission/core/get_database.py | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/emission/core/config.py b/emission/core/config.py index 8dbbabe9d..3f4c28b3e 100644 --- a/emission/core/config.py +++ b/emission/core/config.py @@ -4,15 +4,19 @@ def get_config_data_from_env(): config_data_env = { - "url": os.getenv('DB_HOST', "localhost"), - "result_limit": os.getenv('DB_TS_RESULT_LIMIT', 250000) + "timeseries": { + "url": os.getenv('DB_HOST', "localhost"), + "result_limit": os.getenv('DB_TS_RESULT_LIMIT', 250000) + } } return config_data_env def check_unset_env_vars(): config_data_env = { - "url": os.getenv('DB_HOST'), - "result_limit": os.getenv('DB_TS_RESULT_LIMIT') + "timeseries": { + "url": os.getenv('DB_HOST'), + "result_limit": os.getenv('DB_TS_RESULT_LIMIT') + } } return not any(config_data_env.values()) @@ -26,7 +30,7 @@ def get_config_data(): # if check_unset_env_vars(): # print("All DB environment variables are set to None") ret_val = get_config_data_from_env() - if ret_val["url"] == "localhost": + if ret_val["timeseries"]["url"] == "localhost": print("storage not configured, falling back to sample, default configuration") return ret_val diff --git a/emission/core/get_database.py b/emission/core/get_database.py index 005abe3ad..c8d370fcd 100644 --- a/emission/core/get_database.py +++ b/emission/core/get_database.py @@ -12,8 +12,8 @@ import emission.core.config as ecc -url = ecc.get_config()["url"] -result_limit = ecc.get_config()["result_limit"] +url = ecc.get_config()["timeseries"]["url"] +result_limit = ecc.get_config()["timeseries"]["result_limit"] try: parsed=pymongo.uri_parser.parse_uri(url)