Commit 992e5805 authored by Celine Noirot's avatar Celine Noirot

Merge branch 'issue#124' into 'master'

Merge branch Issue#124 with master

See merge request !36
parents 4ce3e172 5645d27f
......@@ -143,14 +143,19 @@ class Analysis (Component):
logging.getLogger("Analysis.__init__").debug("tempfile.tempdir = " + tempfile.tempdir)
if not os.path.isdir(tempfile.tempdir):
os.makedirs(tempfile.tempdir, 0o751)
logging.getLogger("Analysis.__init__").debug("self.space_id = " + self.space_id)
if id != None : # If not a new analysis
logging.getLogger("Analysis.__init__").debug("Connexion à la BD")
t3mysql = t3MySQLdb()
logging.getLogger("Analysis.__init__").debug("Connexion effectuée")
self.run = Run.get_from_id(self.__get_run_id())
from ng6.project import Project
self.project = Project.get_from_run_id(self.__get_run_id())
if self.run != None :
self.project = Project.get_from_run_id(self.__get_run_id())
else :
self.project = Project.get_from_id(self.__get_project_id())
self.space_id=self.project.space_id
self.directory = t3mysql.select_analysis_directory(id)
logging.getLogger("Analysis.__init__").debug("Building analysis with id=" + str(id) + " [" + str(self) + "]")
......@@ -669,17 +674,17 @@ class Analysis (Component):
@param id : the analysis id
"""
logging.getLogger("Analysis.get_from_id").debug("Loading the analysis from id " + str(id))
try:
t3mysql = t3MySQLdb()
[name, date, description, software, options, version] = t3mysql.select_analysis(id)
my_analysis = Analysis(name, description, software, options, version, id)
if my_analysis == None:
logging.getLogger("Analysis.get_from_id").error("The analysis id=" + str(id) + " does not exists in the database.")
raise Exception("The analysis id=" + str(id) + " does not exists in the database.\n")
return my_analysis
except Exception as err:
logging.getLogger("Analysis.get_from_id").error("Error while loading the analysis from the database [" + str(err) + "]")
raise Exception("Error while loading the analysis from the database\n" + str(err))
#try:
t3mysql = t3MySQLdb()
[name, date, description, software, options, version] = t3mysql.select_analysis(id)
my_analysis = Analysis(name, description, software, options, version, id)
if my_analysis == None:
logging.getLogger("Analysis.get_from_id").error("The analysis id=" + str(id) + " does not exists in the database.")
raise Exception("The analysis id=" + str(id) + " does not exists in the database.\n")
return my_analysis
#except Exception as err:
# logging.getLogger("Analysis.qget_from_id").error("Error while loading the analysis from the database [" + str(err) + "]")
# raise Exception("Error while loading the analysis from the database\n" + str(err))
@staticmethod
......
......@@ -42,6 +42,7 @@ class BasicNG6Workflow (Workflow):
self.add_parameter("admin_login", "Who is the project administrator", required = True, type = 'ng6userlogin', display_name="Admin login")
def add_component(self, component_name, args=[], kwargs={}, component_prefix="default", parent=None, addto="run"):
logging.getLogger("ng6").debug("addto, logging test 1")
# first build and check if this component is OK
if component_name in self.internal_components or component_name in self.external_components:
......@@ -65,11 +66,14 @@ class BasicNG6Workflow (Workflow):
if derived_class.__name__ == "Analysis":
# add parent and project/run information
cmpt_object.parent = parent
if addto == "project": cmpt_object.project = self.project
elif addto == "run": cmpt_object.run = self.runobj
#We replace the default space_id
if cmpt_object.space_id == "default" and cmpt_object.space_id != cmpt_object.run.space_id:
cmpt_object.space_id = cmpt_object.run.space_id
if addto == "project":
cmpt_object.project = self.project
cmpt_object.space_id = cmpt_object.project.space_id
elif addto == "run":
cmpt_object.run = self.runobj
#We replace the default space_id
if cmpt_object.space_id == "default":
cmpt_object.space_id = cmpt_object.run.space_id
# link analysis with ots create user
cmpt_object.admin_login = self.admin_login
......
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