Skip to content

Commit

Permalink
add local teste env config override
Browse files Browse the repository at this point in the history
  • Loading branch information
yuli_han authored and yuli_han committed Feb 23, 2024
1 parent ac5095b commit d40f160
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/py/ai/chronon/repo/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ def set_runtime_env(args):
environment["team_env"] = (
teams_json[team].get(context, {}).get(effective_mode, {})
)
environment["dev_team_env"] = (
teams_json[team].get("dev", {}).get(effective_mode, {})
)
environment["default_env"] = (
teams_json.get("default", {})
.get(context, {})
Expand Down Expand Up @@ -326,7 +329,12 @@ def set_runtime_env(args):
environment["cli_args"]["CHRONON_DRIVER_JAR"] = args.chronon_jar
environment["cli_args"]["CHRONON_ONLINE_JAR"] = args.online_jar
environment["cli_args"]["CHRONON_ONLINE_CLASS"] = args.online_class
order = ["conf_env", "team_env", "default_env", "common_env", "cli_args"]
# If the job is running on airflow, ignore the dev team environment.
if 'AIRFLOW_CTX_EXECUTION_DATE' in os.environ:
order = ["conf_env", "team_env", "default_env", "common_env", "cli_args"]
else:
# If the job is running locally for testing, dev team environment should be prioritized.
order = ["conf_env", "dev_team_env", "team_env", "default_env", "common_env", "cli_args"]
print("Setting env variables:")
for key in os.environ:
if any([key in environment[set_key] for set_key in order]):
Expand Down

0 comments on commit d40f160

Please sign in to comment.