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

No commit message

No commit message
parent aa57aef7
......@@ -68,9 +68,9 @@ class Component(object):
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()
new_param.linkTrace_nameid = self.get_nameid()
if issubclass( default.__class__, LinkTraceback ):
new_param.parent_component_nameid = [default.component_nameid]
new_param.parent_linkTrace_nameid = [default.linkTrace_nameid]
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -96,20 +96,18 @@ class Component(object):
new_param = InputFileList(name, help, flag=flag, file_format=file_format, default=inputs,
type=type, required=required, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
new_param.linkTrace_nameid = self.get_nameid()
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.parent_component_nameid.append( val.component_nameid )
else:
new_param.parent_component_nameid.append( None )
new_param[idx].parent_linkTrace_nameid = [val.linkTrace_nameid]
if not val.linkTrace_nameid in new_param.parent_linkTrace_nameid:
new_param.parent_linkTrace_nameid.append( val.linkTrace_nameid )
else:
if issubclass( default.__class__, LinkTraceback ):
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 )
new_param[0].parent_linkTrace_nameid = [default.linkTrace_nameid]
if not default.linkTrace_nameid in new_param.parent_linkTrace_nameid:
new_param.parent_linkTrace_nameid.append( default.linkTrace_nameid )
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -154,7 +152,7 @@ class Component(object):
new_param = OutputFile(name, help, default=os.path.join(self.output_directory, filename),
file_format=file_format, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -170,7 +168,7 @@ class Component(object):
default = [IOFile(file, file_format, self.get_nameid(), None) for file in self.get_outputs(pattern, items)]
new_param = OutputFileList(name, help, default=default, file_format=file_format, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -186,7 +184,7 @@ class Component(object):
new_param = OutputFilesEndsWith(name, help, self.output_directory, pattern, include=(behaviour == "include"),
file_format=file_format, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -202,7 +200,7 @@ class Component(object):
new_param = OutputFilesPattern(name, help, self.output_directory, pattern, include=(behaviour == "exclude"),
file_format=file_format, group=group, display_name=display_name)
# store where the parameter is coming from
new_param.component_nameid = self.get_nameid()
new_param.linkTrace_nameid = self.get_nameid()
# if this input should be added to a particular parameter
if add_to:
try:
......
......@@ -374,15 +374,14 @@ class AbstractParameter(object):
class LinkTraceback(object):
def __init__(self, component_nameid=None, parent_component_nameid=None):
self.component_nameid = component_nameid
self.parent_component_nameid = [] if parent_component_nameid == None else parent_component_nameid
def __init__(self, linkTrace_nameid=None, parent_linkTrace_nameid=None):
self.linkTrace_nameid = linkTrace_nameid
self.parent_linkTrace_nameid = [] if parent_linkTrace_nameid == None else parent_linkTrace_nameid
class AbstractIOFile(LinkTraceback):
def __init__(self, file_format="any", component_nameid=None, parent_component_nameid=None):
LinkTraceback.__init__(self, component_nameid, parent_component_nameid)
def __init__(self, file_format="any", linkTrace_nameid=None, parent_linkTrace_nameid=None):
LinkTraceback.__init__(self, linkTrace_nameid, parent_linkTrace_nameid)
self.file_format = file_format
......@@ -989,11 +988,9 @@ class OutputFilesEndsWith(DynamicOutput):
output_files = list()
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.parent_component_nameid.append(None)
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.linkTrace_nameid, 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.parent_component_nameid.append(None)
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.linkTrace_nameid, None) )
list.__init__(self, output_files)
......@@ -1021,9 +1018,7 @@ class OutputFilesPattern(DynamicOutput):
output_files = list()
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.parent_component_nameid.append(None)
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.linkTrace_nameid, 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.parent_component_nameid.append(None)
output_files.append( IOFile(os.path.join(self.output_directory, file), self.file_format, self.linkTrace_nameid, None) )
return list.__init__(self, output_files)
\ No newline at end of file
......@@ -161,7 +161,7 @@ class Workflow(threading.Thread):
except: size_limit="0"
new_param = InputFile(name, help, flag=flag, file_format=file_format, default=default,
type=type, required=required, group=group, display_name=display_name, size_limit=size_limit)
new_param.component_nameid = name
new_param.linkTrace_nameid = name
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -186,7 +186,7 @@ class Workflow(threading.Thread):
inputs = [IOFile(default, file_format, name, None)]
new_param = InputFileList(name, help, flag=flag, file_format=file_format, default=inputs,
type=type, required=required, group=group, display_name=display_name, size_limit=size_limit)
new_param.component_nameid = name
new_param.linkTrace_nameid = name
# if this input should be added to a particular parameter
if add_to:
try:
......@@ -289,13 +289,11 @@ class Workflow(threading.Thread):
new_param = InputFileList( parameter.name, parameter.help, file_format=parameter.file_format, default=parameter.prepare_input_files(value),
type=parameter.type, choices=parameter.choices, required=parameter.required, flag=parameter.flag,
group=parameter.group, display_name=parameter.display_name, size_limit=parameter.size_limit )
new_param.component_nameid = parameter.component_nameid
elif parameter.__class__ == InputFile:
if value == "" : value = None # from GUI
new_param = InputFile( parameter.name, parameter.help, file_format=parameter.file_format, default=parameter.prepare_input_file(value),
type=parameter.type, choices=parameter.choices, required=parameter.required, flag=parameter.flag,
group=parameter.group, display_name=parameter.display_name )
new_param.component_nameid = parameter.component_nameid
else:
raise Exception( "Unknown class '" + parameter.__class__.__name__ + "' for parameter.")
return new_param
......@@ -344,15 +342,10 @@ class Workflow(threading.Thread):
gr.add_node_attribute(cpt.get_nameid(), self.COMPONENT_GRAPH_LABEL)
for cpt in self.components:
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[0], ioparameter.component_nameid))
if issubclass( ioparameter.__class__, InputFile ) or issubclass( ioparameter.__class__, InputFileList):
for parent in ioparameter.parent_linkTrace_nameid:
try: gr.add_edge((parent, ioparameter.linkTrace_nameid))
except: pass
if issubclass( ioparameter.__class__, InputFileList):
for parent in ioparameter.parent_component_nameid:
if parent != None:
try: gr.add_edge((parent, ioparameter.component_nameid))
except: pass
return gr
def set_stderr(self):
......
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