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

Airflow variables #486

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/client/cornflow_client/airflow/dag_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def connect_to_cornflow(secrets):
"""
# This secret comes from airflow configuration
print("Getting connection information from ENV VAR=CF_URI")
uri = secrets.get_conn_uri("CF_URI")
uri = secrets.get_conn_value("CF_URI")
conn = urlparse(uri)
scheme = conn.scheme
if scheme == "cornflow":
Expand Down Expand Up @@ -326,7 +326,7 @@ def callback_email(context):
notification_email = EnvironmentVariablesBackend().get_variable(
"NOTIFICATION_EMAIL"
)
environment_name = EnvironmentVariablesBackend().get_variable("ENVIRONMENT_NAME")
environment_name = os.getenv("AIRFLOW__WEBSERVER__INSTANCE_NAME", "CornflowEnv")

title = f"Airflow. {environment_name} ({environment}). DAG/task error: {context['dag'].dag_id}/{context['ti'].task_id} Failed"
body = f"""
Expand Down
4 changes: 2 additions & 2 deletions libs/client/cornflow_client/tests/unit/test_dag_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def test_env_connection_vars(self, CornFlow):
]
client_instance = CornFlow.return_value
client_instance.login.return_value = ""
for (conn_str, user_info, url) in conn_uris:
secrets.get_conn_uri.return_value = conn_str
for conn_str, user_info, url in conn_uris:
secrets.get_conn_value.return_value = conn_str
du.connect_to_cornflow(secrets)
client_instance.login.assert_called_with(
username=user_info[0], pwd=user_info[1]
Expand Down
Loading