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

[dou_dag_generator] enables to find ro_dou folder inside airflow dags… #49

Merged
merged 1 commit into from
Mar 3, 2023
Merged
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
18 changes: 15 additions & 3 deletions src/dou_dag_generator.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,20 @@ class DouDigestDagGenerator():
database.
"""

SOURCE_DIR = os.path.join(os.environ['AIRFLOW_HOME'], 'dags/ro_dou/')
YAMLS_DIR = os.path.join(SOURCE_DIR, 'dag_confs/')
base_dir = os.path.join(os.environ['AIRFLOW_HOME'], 'dags')
dir_name = 'ro_dou'

# Walk through the directory tree to find the directory
for root, dirs, files in os.walk(base_dir):
if dir_name in dirs:
# If the directory is found, print its path and exit the loop
SOURCE_DIR = os.path.join(root, dir_name)
break
else:
# If the directory is not found, print a message
raise Exception("{dir_name} directory not found in {base_dir} or its subdirectories.")

YAMLS_DIR = os.path.join(SOURCE_DIR, 'dag_confs')

parser = YAMLParser
searchers: Dict[str, BaseSearcher]
Expand Down Expand Up @@ -283,7 +295,7 @@ def send_report(self, search_report_str: str, subject, report_date,
email_to_list, attach_csv, skip_null):
"""Builds the email content, the CSV if applies, and send it
"""
full_subject = f"{subject} - DOs de {report_date}"
full_subject = f"{subject} - DOs de {report_date}"
search_report = ast.literal_eval(search_report_str)
items = ['contains' for k, v in search_report.items() if v]
if items:
Expand Down