forked from e-mission/e-mission-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from e-mission/master
Merge server changes to figure out what's going on with overpass test
- Loading branch information
Showing
40 changed files
with
958 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
import os | ||
import logging | ||
|
||
import json | ||
import requests | ||
|
||
STUDY_CONFIG = os.getenv('STUDY_CONFIG', "stage-program") | ||
|
||
dynamic_config = None | ||
def get_dynamic_config(): | ||
global dynamic_config | ||
if dynamic_config is not None: | ||
logging.debug("Returning cached dynamic config for %s at version %s" % (STUDY_CONFIG, dynamic_config['version'])) | ||
return dynamic_config | ||
logging.debug("No cached dynamic config for %s, downloading from server" % STUDY_CONFIG) | ||
download_url = "https://raw.githubusercontent.com/e-mission/nrel-openpath-deploy-configs/main/configs/" + STUDY_CONFIG + ".nrel-op.json" | ||
logging.debug("About to download config from %s" % download_url) | ||
r = requests.get(download_url) | ||
if r.status_code != 200: | ||
logging.debug(f"Unable to download study config, status code: {r.status_code}") | ||
# sys.exit(1) | ||
# TODO what to do here? What if Github is down or something? | ||
# If we terminate, will the pipeline just try again later? | ||
else: | ||
dynamic_config = json.loads(r.text) | ||
logging.debug(f"Successfully downloaded config with version {dynamic_config['version']} "\ | ||
f"for {dynamic_config['intro']['translated_text']['en']['deployment_name']} "\ | ||
f"and data collection URL {dynamic_config['server']['connectUrl']}") | ||
return dynamic_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.