Commit aa57aef7 authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

No commit message

No commit message
parent 46687289
......@@ -67,12 +67,10 @@ class Component(object):
required=False, flag=None, group="default", display_name=None, add_to=None):
new_param = InputFile(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
if issubclass( default.__class__, LinkTraceback ):
new_param.parent_component_nameid = default.component_nameid
new_param.parent_component_nameid = [default.component_nameid]
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -102,13 +100,13 @@ class Component(object):
if issubclass( default.__class__, list ):
for idx, val in enumerate(default):
if issubclass( val.__class__, LinkTraceback ):
new_param[idx].parent_component_nameid = val.component_nameid
new_param[idx].parent_component_nameid = [val.component_nameid]
new_param.parent_component_nameid.append( val.component_nameid )
else:
new_param.parent_component_nameid.append( None )
else:
if issubclass( default.__class__, LinkTraceback ):
new_param[0].parent_component_nameid = default.component_nameid
new_param[0].parent_component_nameid = [default.component_nameid]
new_param.parent_component_nameid.append( default.component_nameid )
else:
new_param.parent_component_nameid.append( None )
......
......@@ -374,14 +374,14 @@ class AbstractParameter(object):
class LinkTraceback(object):
def __init__(self, component_nameid=None, parent_component_nameid=[]):
def __init__(self, component_nameid=None, parent_component_nameid=None):
self.component_nameid = component_nameid
self.parent_component_nameid = parent_component_nameid
self.parent_component_nameid = [] if parent_component_nameid == None else parent_component_nameid
class AbstractIOFile(LinkTraceback):
def __init__(self, file_format="any", component_nameid=None, parent_component_nameid=[]):
def __init__(self, file_format="any", component_nameid=None, parent_component_nameid=None):
LinkTraceback.__init__(self, component_nameid, parent_component_nameid)
self.file_format = file_format
......@@ -990,10 +990,10 @@ class OutputFilesEndsWith(DynamicOutput):
for file in os.listdir( self.output_directory ):
if file.endswith( self.end_str ) and self.include :
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.component_nameid, None) )
self.component_parent_nameid.append(None)
self.parent_component_nameid.append(None)
elif not file.endswith( self.end_str ) and not self.include:
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.component_nameid, None) )
self.component_parent_nameid.append(None)
self.parent_component_nameid.append(None)
list.__init__(self, output_files)
......@@ -1022,8 +1022,8 @@ class OutputFilesPattern(DynamicOutput):
for file in os.listdir( self.output_directory ):
if self.include and re.search( self.pattern, file ) is not None:
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.component_nameid, None) )
self.component_parent_nameid.append(None)
self.parent_component_nameid.append(None)
elif not self.include and re.search( self.pattern, file ) is None:
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.component_nameid, None) )
self.component_parent_nameid.append(None)
self.parent_component_nameid.append(None)
return list.__init__(self, output_files)
\ No newline at end of file
......@@ -346,12 +346,12 @@ class Workflow(threading.Thread):
for ioparameter in cpt.__dict__.values():
if issubclass( ioparameter.__class__, InputFile ):
if ioparameter.parent_component_nameid != None:
try: gr.add_edge((ioparameter.parent_component_nameid, ioparameter.component_nameid))
try: gr.add_edge((ioparameter.parent_component_nameid[0], ioparameter.component_nameid))
except: pass
if issubclass( ioparameter.__class__, InputFileList):
for iofile in ioparameter:
if iofile.parent_component_nameid != None:
try: gr.add_edge((iofile.parent_component_nameid, ioparameter.component_nameid))
for parent in ioparameter.parent_component_nameid:
if parent != None:
try: gr.add_edge((parent, ioparameter.component_nameid))
except: pass
return gr
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment