Commit 707f5883 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

fixe a bug when providing inputs

parent 580d8800
......@@ -44,20 +44,26 @@ from jflow.component import Component
from weaver.function import PythonFunction
def add_analysis(analysis_serialized_path, *files):
def add_analysis(analysis_cfg, *input_files):
from ng6.analysis import Analysis
from ng6.project import Project
from import Run
import pickle
# get inputs from parameters
analysis_serialized_path = input_files[0]
try: parent_analysis_cfg = input_files[1]
except: parent_analysis_cfg = None
# load the analysis object
analysis_dump = open(analysis_serialized_path, "rb")
analysis = pickle.load(analysis_dump)
# check if the parent analysis config file is in files
for file in files:
if file != analysis.get_config_file_path() and os.path.basename(file) == Analysis.ANALYSIS_CONFIG_FILE_NAME:
parent = Analysis.get_from_file(file)
# add the parent information
if parent_analysis_cfg:
if os.path.isfile(parent_analysis_cfg):
parent = Analysis.get_from_file(parent_analysis_cfg)
analysis.parent = parent
# process the parsing of the analysis
......@@ -148,11 +154,13 @@ class Analysis (Component):
# then add analysis information
inputs = []
# serialized the object
analysis_dump_path = self.get_temporary_file(".dump")
analysis_dump = open(analysis_dump_path, "wb")
pickle.dump(self, analysis_dump)
wait_for_files = []
for attr in self.__dict__:
......@@ -163,13 +171,13 @@ class Analysis (Component):
elif self.__getattribute__(attr).__class__.__name__ == "OutputFileList":
if self.parent:
# then run the component
# add the add_analysis command lines to the make
add = PythonFunction(add_analysis, cmd_format="{EXE} {ARG} {IN} {OUT}")
add(inputs=wait_for_files, outputs=self.get_config_file_path(), arguments=analysis_dump_path)
add = PythonFunction(add_analysis, cmd_format="{EXE} {OUT} {IN}")
add(includes=wait_for_files, outputs=self.get_config_file_path(), inputs=inputs)
def __str__(self):
Supports Markdown
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