Commit b143425b authored by Gerald Salin's avatar Gerald Salin

add logs

parent 6a984af9
......@@ -52,6 +52,7 @@ def add_analysis(parent_id, analysis_cfg, *input_files):
import pickle
import logging
logging.getLogger("Analysis").debug("Start. Imports went good.")
logging.getLogger("Analysis").debug("Start. working for analysis " + analysis_cfg)
# get inputs from parameters
analysis_serialized_path = input_files[0]
......@@ -399,6 +400,7 @@ class Analysis (Component):
run_id = self.__get_run_id()
my_run = Run.get_from_id(run_id)
samples = my_run.get_samples()
logging.getLogger("Analysis").debug("_create_and_archive with samples")
gfiles = {}
ungrouped_files = []
what_left = []
......@@ -472,14 +474,20 @@ class Analysis (Component):
for file in what_left:
copyfile(file, os.path.join(tmp_dir, os.path.basename(file)))
logging.getLogger("Analysis").debug("_create_and_archive before tarf")
tarf = Utils.tar_dir(tmp_dir, os.path.join(self.__get_work_directory(), archive_name))
logging.getLogger("Analysis").debug("_create_and_archive before targzf")
targzf = Utils.gzip(tarf, self.__get_work_directory(), delete=False)
# Then delete temporary files
logging.getLogger("Analysis").debug("_create_and_archive before os.remove(tarf)")
os.remove(tarf)
logging.getLogger("Analysis").debug("_create_and_archive before rmtree(tmp_dir)")
rmtree(tmp_dir)
logging.getLogger("Analysis").debug("_create_and_archive before return " + os.path.join(self.directory, os.path.basename(targzf)))
return 'fileadmin' + os.path.join(self.directory, os.path.basename(targzf))
except :
logging.getLogger("Analysis").debug("_create_and_archive in execpt, without samples?")
gfiles = {}
# Group files by folders
for file in files:
......@@ -500,19 +508,29 @@ class Analysis (Component):
os.makedirs(dir)
for file in gfiles[dir_name]:
copyfile(file, os.path.join(dir, os.path.basename(file)))
logging.getLogger("Analysis").debug("_create_and_archive before tarf")
tarf = Utils.tar_dir(tmp_dir, os.path.join(self.__get_work_directory(), archive_name))
logging.getLogger("Analysis").debug("_create_and_archive before targzf")
targzf = Utils.gzip(tarf, self.__get_work_directory(), delete=False)
# Then delete temporary files
logging.getLogger("Analysis").debug("_create_and_archive before os.remove(tarf)")
os.remove(tarf)
logging.getLogger("Analysis").debug("_create_and_archive before rmtree(tmp_dir)")
rmtree(tmp_dir)
logging.getLogger("Analysis").debug("_create_and_archive before return " + os.path.join(self.directory, os.path.basename(targzf)))
return 'fileadmin' + os.path.join(self.directory, os.path.basename(targzf))
else :
logging.getLogger("Analysis").debug("_create_and_archive, length differs")
logging.getLogger("Analysis").debug("_create_and_archive before tarf")
tarf = Utils.tar_files(files, os.path.join(self.__get_work_directory(), archive_name))
logging.getLogger("Analysis").debug("_create_and_archive before targzf")
targzf = Utils.gzip(tarf, self.__get_work_directory(), delete=False)
# Then delete temporary files
logging.getLogger("Analysis").debug("_create_and_archive before os.remove(tarf)")
os.remove(tarf)
logging.getLogger("Analysis").debug("_create_and_archive before return " + os.path.join(self.directory, os.path.basename(targzf)))
return 'fileadmin' + os.path.join(self.directory, os.path.basename(targzf))
......
......@@ -179,7 +179,7 @@ class FastQC (Analysis):
self._add_result_element("metrics", "metric", metric, metric)
# Finaly create and add the archive to the analysis
logging.getLogger("FastQC").debug("post_process, results_files = " + str(results_files))
logging.getLogger("FastQC").debug("post_process, archive_name = " + archive_name)
logging.getLogger("FastQC").debug("post_process, archive_name = " + self.archive_name)
self.archive_name = self.archive_name.replace("/","-")
self._create_and_archive(results_files, self.archive_name)
......
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