Skip to content
Snippets Groups Projects
Commit 74c5b55c authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Changed 'extended' jobs to allow their own templates override the parent's

parent dc1186c6
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ Templates ...@@ -20,6 +20,7 @@ Templates
--------- ---------
* Added 'match' filter, allowing to use regular expression matches * Added 'match' filter, allowing to use regular expression matches
* Changed 'extended' jobs to allow their own templates override the parent's
* Added missing tests for 'wordwrap' filter * Added missing tests for 'wordwrap' filter
* Re-wrote documentation on additional Jinja filters * Re-wrote documentation on additional Jinja filters
......
...@@ -410,14 +410,14 @@ for subjob, subconfig in jobs_config.iteritems(): ...@@ -410,14 +410,14 @@ for subjob, subconfig in jobs_config.iteritems():
# Allow simple inheritance # Allow simple inheritance
# Support deprecated keyword 'extends' but warn user # Support deprecated keyword 'extends' but warn user
template_job = subjob extended_job = None
if 'extends' in subconfig or '.extends' in subconfig: if 'extends' in subconfig or '.extends' in subconfig:
if 'extends' in subconfig: if 'extends' in subconfig:
keyword_warning('extends') keyword_warning('extends')
template_job = subconfig['extends'] extended_job = subconfig['extends']
else: else:
template_job = subconfig['.extends'] extended_job = subconfig['.extends']
pre_config.merge(jobs_config[template_job]) pre_config.merge(jobs_config[extended_job])
# Add actual subjob config # Add actual subjob config
pre_config.merge(subconfig) pre_config.merge(subconfig)
...@@ -471,13 +471,19 @@ for subjob, subconfig in jobs_config.iteritems(): ...@@ -471,13 +471,19 @@ for subjob, subconfig in jobs_config.iteritems():
format_namelist(groups) format_namelist(groups)
# Generate job script # Generate job script
expand_template_file(job_config, template_search_list = (
( get_exp_template_name(config.experiment_id, get_exp_template_name(config.experiment_id, subjob, ''),
template_job, ''), get_exp_template_name(config.experiment_kind, subjob),
get_exp_template_name(config.experiment_kind, get_exp_template_name(ExpConfig.default_name, subjob)
template_job), )
get_exp_template_name(ExpConfig.default_name, if extended_job:
template_job) ), template_search_list += (
get_exp_template_name(config.experiment_id, extended_job, ''),
get_exp_template_name(config.experiment_kind, extended_job),
get_exp_template_name(ExpConfig.default_name, extended_job)
)
expand_template_file(job_config, template_search_list,
get_exp_script_name(config.experiment_id, subjob), get_exp_script_name(config.experiment_id, subjob),
os.path.join(backup_dir, os.path.join(backup_dir,
config.experiment_id+'.'+subjob)) config.experiment_id+'.'+subjob))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment