Skip to content

Commit

Permalink
Fix deferred config resolution.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed May 30, 2024
1 parent 1848c57 commit 4389a86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ law_test.cfg
.coverage
coverage*.xml
.dmypy.json
.python-version
9 changes: 6 additions & 3 deletions law/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def _expand_path(cls, path, expand_vars=True, expand_user=True):
return path

def __init__(self, config_file="", skip_defaults=False, skip_fallbacks=False,
skip_includes=False, skip_env_sync=False, skip_luigi_sync=False):
skip_includes=False, skip_env_sync=False, skip_luigi_sync=False,
skip_resolve_deferred=False):
ConfigParser.__init__(self, allow_no_value=True)

# lookup to correct config file
Expand Down Expand Up @@ -231,7 +232,8 @@ def include_configs(filenames):
if not skip_includes and self.config_file:
# eagerly read the config file to get a glimpse of the files to inherit from
c = self.__class__(self.config_file, skip_defaults=True, skip_fallbacks=True,
skip_includes=True, skip_env_sync=True, skip_luigi_sync=True)
skip_includes=True, skip_env_sync=True, skip_luigi_sync=True,
skip_resolve_deferred=True)
opt = "inherit"
if c.has_option("core", "inherit_configs") and not c.get_expanded("core", "inherit"):
# print a warning, not using the logger yet since it's not initialized at this point
Expand Down Expand Up @@ -267,7 +269,8 @@ def include_configs(filenames):
self.sync_luigi_config()

# resolve deferred default values
self.resolve_deferred_defaults()
if not skip_resolve_deferred:
self.resolve_deferred_defaults()

def _convert_to_boolean(self, value):
# py2 backport
Expand Down

0 comments on commit 4389a86

Please sign in to comment.