Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Jan 3, 2025
1 parent b0a35c8 commit 4b171ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions dagfactory/dagfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,14 @@ def _global_default_args():
with open(default_args_yml, "r") as file:
return yaml.safe_load(file)

def deep_merge(self, dict1, dict2):
for key, value in dict2.items():
if isinstance(value, dict) and key in dict1 and isinstance(dict1[key], dict):
dict1[key] = self.deep_merge(dict1[key], value)
else:
dict1[key] = value
return dict1

def _merge_default_args(self):
global_default_args = self._global_default_args()
default_config: Dict[str, Any] = self.get_default_config()

return self.deep_merge(global_default_args, default_config)
merged_config = global_default_args.copy()
merged_config.update(default_config)

return merged_config

@staticmethod
def _serialise_config_md(dag_name, dag_config, default_config):
Expand Down
2 changes: 1 addition & 1 deletion dev/dags/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
default_args:
start_date: "2024-01-01"
owner: "default_owner1"
owner: "global_owner"

0 comments on commit 4b171ac

Please sign in to comment.