Commit 61a4c53d authored by Romain Therville's avatar Romain Therville 🐭
Browse files

Enhancement for the workflow 'switch_project_space_id'

I have moved the DB updates down in the code, to only register
migrations that went well.

issue #129
parent 18a04beb
...@@ -65,10 +65,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -65,10 +65,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
logging.getLogger("SwitchProjectSpaceId.process").error("Error while searching space_id '" + str(self.space_id) + "' in application.properties, it certainly doesn't exist. \n" + str(err)) logging.getLogger("SwitchProjectSpaceId.process").error("Error while searching space_id '" + str(self.space_id) + "' in application.properties, it certainly doesn't exist. \n" + str(err))
raise Exception("Error while searching space_id '" + str(self.space_id) + "' in application.properties, it certainly doesn't exist. \n" + str(err)) raise Exception("Error while searching space_id '" + str(self.space_id) + "' in application.properties, it certainly doesn't exist. \n" + str(err))
#Update to the projcet's space_id
t3mysql = t3MySQLdb()
project.update_space_id(self.space_id)
base_path = ng6conf.get_save_directory() base_path = ng6conf.get_save_directory()
#Process for the project's runs #Process for the project's runs
...@@ -83,7 +79,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -83,7 +79,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
#Update the directory in DB #Update the directory in DB
new_run_directory = run.get_directory() new_run_directory = run.get_directory()
new_run_directory = new_run_directory.replace(old_directory, new_directory) new_run_directory = new_run_directory.replace(old_directory, new_directory)
run.set_directory(new_run_directory)
#Moving the files #Moving the files
#if not os.path.isdir(path_new_run_directory) : #if not os.path.isdir(path_new_run_directory) :
...@@ -103,7 +98,8 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -103,7 +98,8 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
#Update the retention in DB #Update the retention in DB
old_retention = run.get_creation_date() old_retention = run.get_creation_date()
new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention) new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention)
run.set_retention(new_retention) run.set_retention(new_retention)
run.set_directory(new_run_directory)
#Process for the project's analyzes #Process for the project's analyzes
analyzes_ids = project.get_project_analyzes_ids() analyzes_ids = project.get_project_analyzes_ids()
...@@ -117,7 +113,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -117,7 +113,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
#Update the directory in DB #Update the directory in DB
new_analysis_directory = analysis.get_directory() new_analysis_directory = analysis.get_directory()
new_analysis_directory = new_analysis_directory.replace(old_directory, new_directory) new_analysis_directory = new_analysis_directory.replace(old_directory, new_directory)
analysis.set_directory(new_analysis_directory)
#Moving the files #Moving the files
#if not os.path.isdir(path_new_analysis_directory) : #if not os.path.isdir(path_new_analysis_directory) :
...@@ -138,6 +133,7 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -138,6 +133,7 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
old_retention = analysis.get_creation_date() old_retention = analysis.get_creation_date()
new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention) new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention)
analysis.set_retention(new_retention) analysis.set_retention(new_retention)
analysis.set_directory(new_analysis_directory)
#Process for the project's run's analyzes #Process for the project's run's analyzes
run_analyzes_ids = project.get_project_runs_analyzes_ids() run_analyzes_ids = project.get_project_runs_analyzes_ids()
...@@ -151,7 +147,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -151,7 +147,6 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
#Update the directory in DB #Update the directory in DB
new_analysis_directory = analysis.get_directory() new_analysis_directory = analysis.get_directory()
new_analysis_directory = new_analysis_directory.replace(old_directory, new_directory) new_analysis_directory = new_analysis_directory.replace(old_directory, new_directory)
analysis.set_directory(new_analysis_directory)
#Moving the files #Moving the files
#if not os.path.isdir(path_new_analysis_directory) : #if not os.path.isdir(path_new_analysis_directory) :
...@@ -171,4 +166,8 @@ class SwitchProjectSpaceId (BasicNG6Workflow): ...@@ -171,4 +166,8 @@ class SwitchProjectSpaceId (BasicNG6Workflow):
#Update the retention in DB #Update the retention in DB
old_retention = analysis.get_creation_date() old_retention = analysis.get_creation_date()
new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention) new_retention = ng6conf.compute_new_retention_date(self.space_id,old_retention)
analysis.set_retention(new_retention) analysis.set_retention(new_retention)
\ No newline at end of file analysis.set_directory(new_analysis_directory)
#Update to the projcet's space_id
project.update_space_id(self.space_id)
\ No newline at end of file
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