Skip to content
Snippets Groups Projects
Commit 4cec751d authored by Stefan Froehlich's avatar Stefan Froehlich
Browse files

Task #9015 Generic pipeline: Fixes the problem in ticket description. Keylists...

Task #9015 Generic pipeline: Fixes the problem in ticket description. Keylists returned from parset objects are now always without comments.
parent 8614cf56
Branches
Tags
No related merge requests found
...@@ -169,7 +169,7 @@ class GenericPipeline(control): ...@@ -169,7 +169,7 @@ class GenericPipeline(control):
resultdicts.update({'input': input_dictionary}) resultdicts.update({'input': input_dictionary})
resultdicts.update({self.name: input_dictionary}) resultdicts.update({self.name: input_dictionary})
if 'pipeline.mapfile' in self.parset.keys: if 'pipeline.mapfile' in self.parset.keywords():
resultdicts['input']['mapfile'] = str(self.parset['pipeline.mapfile']) resultdicts['input']['mapfile'] = str(self.parset['pipeline.mapfile'])
resultdicts[self.name]['mapfile'] = str(self.parset['pipeline.mapfile']) resultdicts[self.name]['mapfile'] = str(self.parset['pipeline.mapfile'])
...@@ -242,7 +242,7 @@ class GenericPipeline(control): ...@@ -242,7 +242,7 @@ class GenericPipeline(control):
submapfile = '' submapfile = ''
subpipeline_steplist = subpipeline_parset.getStringVector('pipeline.steps') subpipeline_steplist = subpipeline_parset.getStringVector('pipeline.steps')
if 'pipeline.mapfile' in subpipeline_parset.keys: if 'pipeline.mapfile' in subpipeline_parset.keywords():
submapfile = subpipeline_parset['pipeline.mapfile'] submapfile = subpipeline_parset['pipeline.mapfile']
subpipeline_parset.remove('pipeline.mapfile') subpipeline_parset.remove('pipeline.mapfile')
if 'mapfile_in' in inputdict.keys(): if 'mapfile_in' in inputdict.keys():
...@@ -256,10 +256,10 @@ class GenericPipeline(control): ...@@ -256,10 +256,10 @@ class GenericPipeline(control):
# maybe as dicts to combine them to one # maybe as dicts to combine them to one
subpipeline_parset.remove('pipeline.steps') subpipeline_parset.remove('pipeline.steps')
if 'pipeline.pluginpath' in subpipeline_parset.keys: if 'pipeline.pluginpath' in subpipeline_parset.keywords():
subpipeline_parset.remove('pipeline.pluginpath') subpipeline_parset.remove('pipeline.pluginpath')
checklist = copy.deepcopy(subpipeline_steplist) checklist = copy.deepcopy(subpipeline_steplist)
for k in subpipeline_parset.keys: for k in subpipeline_parset.keywords():
if 'loopsteps' in k: if 'loopsteps' in k:
for item in subpipeline_parset.getStringVector(k): for item in subpipeline_parset.getStringVector(k):
checklist.append(item) checklist.append(item)
...@@ -268,25 +268,25 @@ class GenericPipeline(control): ...@@ -268,25 +268,25 @@ class GenericPipeline(control):
# proper format only after use of parset.makesubset. then it is a different object # proper format only after use of parset.makesubset. then it is a different object
# from a different super class :(. this also explains use of parset.keys and parset.keys() # from a different super class :(. this also explains use of parset.keys and parset.keys()
# take the parset from subpipeline and add it to the master parset. # take the parset from subpipeline and add it to the master parset.
# UPDATE: do not use .keys on master parset. use .keywords(), then comments are filtered.
# ********************************************************************* # *********************************************************************
# replace names of steps with the subpipeline stepname to create a unique identifier. # replace names of steps with the subpipeline stepname to create a unique identifier.
# replacement values starting with ! will be taken from the master parset and overwrite # replacement values starting with ! will be taken from the master parset and overwrite
# the ones in the subpipeline. only works if the ! value is already in the subpipeline # the ones in the subpipeline. only works if the ! value is already in the subpipeline
for k in subpipeline_parset.keys: for k in subpipeline_parset.keywords():
if not str(k).startswith('#'): val = subpipeline_parset[k]
val = subpipeline_parset[k] if not str(k).startswith('!') and not str(k).startswith('pipeline.replace.'):
if not str(k).startswith('!') and not str(k).startswith('pipeline.replace.'): for item in checklist:
for item in checklist: if item in str(val):
if item in str(val): val = str(val).replace(item, stepname + '-' + item)
val = str(val).replace(item, stepname + '-' + item)
self.parset.add(stepname + '-' + k, str(val))
self.parset.add(stepname + '-' + k, str(val)) else:
else: self.parset.add(k, str(val))
self.parset.add(k, str(val))
for i, item in enumerate(subpipeline_steplist): for i, item in enumerate(subpipeline_steplist):
subpipeline_steplist[i] = stepname + '-' + item subpipeline_steplist[i] = stepname + '-' + item
for item in step_parset_obj[stepname].keys(): for item in step_parset_obj[stepname].keys():
for k in self.parset.keys: for k in self.parset.keywords():
if str(k).startswith('!') and item in k or str(k).startswith('pipeline.replace.') and item in k: if str(k).startswith('!') and item in k or str(k).startswith('pipeline.replace.') and item in k:
self.parset.remove(k) self.parset.remove(k)
self.parset.add('! ' + item, str(step_parset_obj[stepname][item])) self.parset.add('! ' + item, str(step_parset_obj[stepname][item]))
...@@ -299,7 +299,7 @@ class GenericPipeline(control): ...@@ -299,7 +299,7 @@ class GenericPipeline(control):
step_name_list.insert(0, name) step_name_list.insert(0, name)
# remove replacements strings to prevent loading the same key twice # remove replacements strings to prevent loading the same key twice
for k in copy.deepcopy(self.parset.keys): for k in copy.deepcopy(self.parset.keywords()):
if str(k).startswith('!'): if str(k).startswith('!'):
self.parset.remove(k) self.parset.remove(k)
...@@ -411,7 +411,7 @@ class GenericPipeline(control): ...@@ -411,7 +411,7 @@ class GenericPipeline(control):
# for name, parset in step_parset_dict.iteritems(): # for name, parset in step_parset_dict.iteritems():
try: try:
file_parset = Parset(stepparset.getString('parset')) file_parset = Parset(stepparset.getString('parset'))
for k in file_parset.keys: for k in file_parset.keywords():
if not k in stepparset.keys(): if not k in stepparset.keys():
stepparset.add(k, str(file_parset[k])) stepparset.add(k, str(file_parset[k]))
stepparset.remove('parset') stepparset.remove('parset')
...@@ -420,7 +420,7 @@ class GenericPipeline(control): ...@@ -420,7 +420,7 @@ class GenericPipeline(control):
# parset from task.cfg # parset from task.cfg
try: try:
file_parset = Parset(self.task_definitions.get(str(subparset['type']), 'parset')) file_parset = Parset(self.task_definitions.get(str(subparset['type']), 'parset'))
for k in file_parset.keys: for k in file_parset.keywords():
if not k in stepparset.keys(): if not k in stepparset.keys():
stepparset.add(k, str(file_parset[k])) stepparset.add(k, str(file_parset[k]))
except: except:
...@@ -428,7 +428,7 @@ class GenericPipeline(control): ...@@ -428,7 +428,7 @@ class GenericPipeline(control):
# for parset in control section # for parset in control section
try: try:
file_parset = Parset(subparset.getString('parset')) file_parset = Parset(subparset.getString('parset'))
for k in file_parset.keys: for k in file_parset.keywords():
if not k in stepparset.keys(): if not k in stepparset.keys():
stepparset.add(k, str(file_parset[k])) stepparset.add(k, str(file_parset[k]))
subparset.remove('parset') subparset.remove('parset')
...@@ -464,12 +464,11 @@ class GenericPipeline(control): ...@@ -464,12 +464,11 @@ class GenericPipeline(control):
tmp_keys = argsparset.keys() tmp_keys = argsparset.keys()
ordered_keys = [] ordered_keys = []
parsetdict = {} parsetdict = {}
for orig in self.parset.keys: for orig in self.parset.keywords():
for item in tmp_keys: for item in tmp_keys:
if not str(orig).startswith('#'): if (stepname + '.') in orig and ('argument.'+item in orig and not 'argument.'+item+'.' in orig):
if (stepname + '.') in orig and ('argument.'+item in orig and not 'argument.'+item+'.' in orig): ordered_keys.append(item)
ordered_keys.append(item) continue
continue
# add keys from parset files that were not in the original list # add keys from parset files that were not in the original list
for item in argsparset.keys(): for item in argsparset.keys():
if not item in ordered_keys: if not item in ordered_keys:
...@@ -498,7 +497,7 @@ class GenericPipeline(control): ...@@ -498,7 +497,7 @@ class GenericPipeline(control):
if self.task_definitions.has_option(task,'parset'): if self.task_definitions.has_option(task,'parset'):
task_parset.adoptFile(self.task_definitions.get(task,'parset')) task_parset.adoptFile(self.task_definitions.get(task,'parset'))
print 'possible arguments: key = value' print 'possible arguments: key = value'
for k in task_parset.keys: for k in task_parset.keywords():
print ' ',k,' ','=',' ',task_parset[k] print ' ',k,' ','=',' ',task_parset[k]
def _add_step(self): def _add_step(self):
...@@ -506,18 +505,17 @@ class GenericPipeline(control): ...@@ -506,18 +505,17 @@ class GenericPipeline(control):
def _replace_values(self): def _replace_values(self):
replacedict = {} replacedict = {}
for check in self.parset.keys: for check in self.parset.keywords():
if str(check).startswith('!'): if str(check).startswith('!'):
replacedict[str(check).lstrip('!').lstrip(' ')] = str(self.parset[check]) replacedict[str(check).lstrip('!').lstrip(' ')] = str(self.parset[check])
if str(check).startswith('pipeline.replace.'): if str(check).startswith('pipeline.replace.'):
replacedict[str(check).replace('pipeline.replace.', '').lstrip(' ')] = str(self.parset[check]) replacedict[str(check).replace('pipeline.replace.', '').lstrip(' ')] = str(self.parset[check])
#print 'REPLACEDICT: ',replacedict #print 'REPLACEDICT: ',replacedict
for check in self.parset.keys: for check in self.parset.keywords():
if not str(check).startswith('#'): for k, v in replacedict.iteritems():
for k, v in replacedict.iteritems(): if '{{ '+k+' }}' in str(self.parset[check]):
if '{{ '+k+' }}' in str(self.parset[check]): replacestring = str(self.parset[check]).replace('{{ '+k+' }}',v)
replacestring = str(self.parset[check]).replace('{{ '+k+' }}',v) self.parset.replace(check,replacestring)
self.parset.replace(check,replacestring)
class GenericPipelineParsetValidation(): class GenericPipelineParsetValidation():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment