From 01ea5f9f94ad893dba11c3af7aa23cc5a07c21bc Mon Sep 17 00:00:00 2001 From: Neil Vaytet <neil.vaytet@esss.se> Date: Wed, 5 Sep 2018 19:50:35 +0200 Subject: [PATCH] Refs #23373 : cleaned up scripts --- .../SystemTests/lib/systemtests/stresstesting.py | 16 ++++++---------- .../analysis/ISISDirectReductionComponents.py | 9 --------- .../Diffraction/isis_powder/routines/focus.py | 1 - scripts/Inelastic/Direct/ReductionWrapper.py | 4 ---- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/Testing/SystemTests/lib/systemtests/stresstesting.py b/Testing/SystemTests/lib/systemtests/stresstesting.py index 4e1237baf7f..6a1e0440238 100644 --- a/Testing/SystemTests/lib/systemtests/stresstesting.py +++ b/Testing/SystemTests/lib/systemtests/stresstesting.py @@ -72,14 +72,14 @@ class MantidStressTest(unittest.TestCase): from mantid.kernel import MemoryStats self.memory = MemoryStats().residentMem()/1024 - def setSearchSaveDirectories(self, core_id, searchDir, saveDir): + def setSearchSaveDirectories(self, core_id, saveDir): + ''' + Modify the defaultsave.directory to a path specific to each thread + ''' from mantid.kernel import config config['datasearch.directories'] += "/core-%i" % (core_id) config['defaultsave.directory'] = "%s/core-%i" % (saveDir,core_id) sys.path.insert(0, config['defaultsave.directory']) - # print("in here") - # print(config['datasearch.directories']) - # print(config['defaultsave.directory']) return def runTest(self): @@ -632,8 +632,7 @@ class TestRunner(object): exec_call += ' ' + self._exec_args # write script to temporary file and execute this file tmp_file = tempfile.NamedTemporaryFile(mode='w', delete=False) - tmp_file.write(script.asString(clean=self._clean, core_id=self._core_id, - searchDir=self._searchDir, saveDir=self._saveDir)) + tmp_file.write(script.asString(clean=self._clean, core_id=self._core_id, saveDir=self._saveDir)) tmp_file.close() cmd = exec_call + ' ' + tmp_file.name results = self.spawnSubProcess(cmd) @@ -657,7 +656,7 @@ class TestScript(object): ("sys.path.append('%s')\n" % self._test_dir) + \ ("from %s import %s\n" % (self._modname, self._test_cls_name)) + \ ("systest = %s()\n" % self._test_cls_name) + \ - ("systest.setSearchSaveDirectories(%i,'%s','%s')\n" % (core_id, searchDir, saveDir)) + \ + ("systest.setSearchSaveDirectories(%i,'%s')\n" % (core_id, saveDir)) + \ ("if %r:\n" % self._exclude_in_pr_builds) + \ (" systest.excludeInPullRequests = lambda: False\n") if (not clean): @@ -1013,19 +1012,16 @@ class MantidFrameworkConfig: def __moveFile(self, src, dst): if os.path.exists(src): - # import shutil shutil.move(src, dst) def __copyFile(self, src, dst): if os.path.exists(src): - # import shutil shutil.copyfile(src, dst) saveDir = property(lambda self: self.__saveDir) testDir = property(lambda self: self.__testDir) dataDir = property(lambda self: self.__dataDirs) - def config(self): # Start mantid diff --git a/Testing/SystemTests/tests/analysis/ISISDirectReductionComponents.py b/Testing/SystemTests/tests/analysis/ISISDirectReductionComponents.py index 24732665513..38fac795f80 100644 --- a/Testing/SystemTests/tests/analysis/ISISDirectReductionComponents.py +++ b/Testing/SystemTests/tests/analysis/ISISDirectReductionComponents.py @@ -25,26 +25,17 @@ class ISIS_ReductionWebLike(stresstesting.MantidStressTest): self.rd.def_main_properties() self.rd.def_advanced_properties() - # save_folder = config['defaultsave.directory'] - - # self.rd.save_web_variables(os.path.join(save_folder,'reduce_vars13.py')) - def runTest(self): save_folder = config['defaultsave.directory'] self.rd.save_web_variables(os.path.join(save_folder,'reduce_vars.py')) # run reduction using saved variables like web variables web_var_folder = config['defaultsave.directory'] - print("NVAYTET1",web_var_folder) sys.path.insert(0,web_var_folder) - print("NVAYTET2",web_var_folder) reload(mr) # change these variables to save result as nxs workspace - print("NVAYTET3",mr) run_dir = os.path.dirname(os.path.realpath(__file__)) - print("NEIL",run_dir) - # exit() mr.web_var.advanced_vars['save_format']='nxs' # web services currently needs input file to be defined input_file = 'MAR11001.RAW' diff --git a/scripts/Diffraction/isis_powder/routines/focus.py b/scripts/Diffraction/isis_powder/routines/focus.py index 5540b12bc2c..ae7eda231e8 100644 --- a/scripts/Diffraction/isis_powder/routines/focus.py +++ b/scripts/Diffraction/isis_powder/routines/focus.py @@ -99,7 +99,6 @@ def _batched_run_focusing(instrument, perform_vanadium_norm, run_number_string, read_ws_list = common.load_current_normalised_ws_list(run_number_string=run_number_string, instrument=instrument) run_details = instrument._get_run_details(run_number_string=run_number_string) - print("NVAYTET 5",run_details.splined_vanadium_file_path) vanadium_splines = None if perform_vanadium_norm: vanadium_splines = mantid.LoadNexus(Filename=run_details.splined_vanadium_file_path) diff --git a/scripts/Inelastic/Direct/ReductionWrapper.py b/scripts/Inelastic/Direct/ReductionWrapper.py index 4bb977f0f01..4d233fedf1f 100644 --- a/scripts/Inelastic/Direct/ReductionWrapper.py +++ b/scripts/Inelastic/Direct/ReductionWrapper.py @@ -118,10 +118,6 @@ class ReductionWrapper(object): if not FileName: FileName = 'reduce_vars.py' - # FileName = 'reduce_vars11.py' - run_dir = os.path.dirname(os.path.realpath(__file__)) - print("NEIL11",run_dir) - f = open(FileName,'w') f.write("standard_vars = {\n") str_wrapper = ' ' -- GitLab