Skip to content

Commit 58f75b4

Browse files
committed
Improve config options during setup
This merge makes a copy of the basic_config rather than recreating it, and configures the component only after overriding the default component_path if one is provided on the command line.
1 parent b9f529e commit 58f75b4

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

polaris/setup.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ def setup_tasks(
112112
component = tasks[first_path].component
113113

114114
basic_config = _get_basic_config(
115-
config_file, machine, component_path, component, model
115+
config_file=config_file,
116+
machine=machine,
117+
component_path=component_path,
118+
component=component,
119+
model=model,
116120
)
117121

122+
component.configure(basic_config)
123+
118124
provenance.write(work_dir, tasks, config=basic_config)
119125

120126
if clean:
@@ -124,14 +130,11 @@ def setup_tasks(
124130
print('')
125131

126132
_setup_configs(
127-
component,
128-
tasks,
129-
work_dir,
130-
config_file,
131-
machine,
132-
component_path,
133-
copy_executable,
134-
model,
133+
basic_config=basic_config,
134+
component=component,
135+
tasks=tasks,
136+
work_dir=work_dir,
137+
copy_executable=copy_executable,
135138
)
136139

137140
# do this after _setup_configs() in case tasks mark additional steps
@@ -432,20 +435,15 @@ def _expand_and_mark_cached_steps(tasks, cached_steps):
432435

433436

434437
def _setup_configs(
438+
basic_config,
435439
component,
436440
tasks,
437441
work_dir,
438-
config_file,
439-
machine,
440-
component_path,
441442
copy_executable,
442-
model,
443443
):
444444
"""Set up config parsers for this component"""
445445

446-
common_config = _get_basic_config(
447-
config_file, machine, component_path, component, model
448-
)
446+
common_config = basic_config.copy()
449447
if copy_executable:
450448
common_config.set('setup', 'copy_executable', 'True')
451449

@@ -718,8 +716,6 @@ def _get_basic_config(config_file, machine, component_path, component, model):
718716
exception=False,
719717
)
720718

721-
component.configure(config)
722-
723719
# set the component_path path from the command line if provided
724720
if component_path is not None:
725721
component_path = os.path.abspath(component_path)

0 commit comments

Comments
 (0)