Skip to content

Commit

Permalink
Remove mandatoriness of --dags-path
Browse files Browse the repository at this point in the history
  • Loading branch information
BAntonellini committed Oct 4, 2024
1 parent c97b152 commit 7091e36
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dbt_coves/tasks/generate/airflow_dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def _generate_dag(self, yml_filepath: Path):
try:
if self.dags_path:
yml_relpath = yml_filepath.relative_to(self.ymls_path)
dag_destination = self.dags_path.joinpath(yml_relpath).with_suffix(".py")
dag_destination = (
Path(self.dags_path).resolve().joinpath(yml_relpath).with_suffix(".py")
)
dag_destination.parent.mkdir(parents=True, exist_ok=True)
else:
dag_destination = yml_filepath.with_suffix(".py")
Expand All @@ -133,9 +135,9 @@ def _generate_dag(self, yml_filepath: Path):
@trackable
def run(self):
ymls_path = self.get_config_value("yml_path")
dags_path = self.get_config_value("dags_path")
if not (ymls_path and dags_path):
raise MissingArgumentException(["--yml-path", "--dags-path"], self.coves_config)
self.dags_path = self.get_config_value("dags_path")
if not (ymls_path):
raise MissingArgumentException(["--yml-path"], self.coves_config)
self.validate_operators = self.get_config_value("validate_operators")
self.secrets_path = self.get_config_value("secrets_path")
self.secrets_manager = self.get_config_value("secrets_manager")
Expand All @@ -145,8 +147,6 @@ def run(self):
"Can't use 'secrets_path' and 'secrets_manager' simultaneously."
)
self.ymls_path = Path(ymls_path).resolve()
self.dags_path = Path(dags_path).resolve()
self.dags_path.mkdir(exist_ok=True, parents=True)
if self.ymls_path.is_dir():
for yml_filepath in glob(f"{self.ymls_path}/**/*.yml", recursive=True):
self._generate_dag(Path(yml_filepath))
Expand Down

0 comments on commit 7091e36

Please sign in to comment.