diff --git a/CEP/Pipeline/recipes/sip/master/deprecated/bbs.py b/CEP/Pipeline/recipes/sip/master/deprecated/bbs.py index d1f4a665e4adf7aa7fb7b48f065c1f4f1fb3cbb6..491d7c0860d8b9bf9c6ade44a1a23ff021f1121b 100644 --- a/CEP/Pipeline/recipes/sip/master/deprecated/bbs.py +++ b/CEP/Pipeline/recipes/sip/master/deprecated/bbs.py @@ -196,7 +196,7 @@ class bbs(BaseRecipe): # already available on disk. # ------------------------------------------------------------------ self.logger.debug("Building VDS file describing data for BBS run") - vds_dir = tempfile.mkdtemp() + vds_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) vds_file = os.path.join(vds_dir, "bbs.gvds") combineproc = utilities.spawn_process( [ @@ -344,7 +344,7 @@ class bbs(BaseRecipe): """ env = utilities.read_initscript(self.logger, self.inputs['initscript']) self.logger.info("Running BBS GlobalControl") - working_dir = tempfile.mkdtemp() + working_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) with CatchLog4CPlus( working_dir, self.logger.name + ".GlobalControl", diff --git a/CEP/Pipeline/recipes/sip/master/new_bbs.py b/CEP/Pipeline/recipes/sip/master/new_bbs.py index 02b99cb80765a3535edf758280e1dd32c93f1710..acdaa5f073b70c4b9840c4a0a87eeca60b34c0ec 100644 --- a/CEP/Pipeline/recipes/sip/master/new_bbs.py +++ b/CEP/Pipeline/recipes/sip/master/new_bbs.py @@ -355,7 +355,7 @@ class new_bbs(BaseRecipe): code. """ self.logger.info("Running BBS GlobalControl") - working_dir = tempfile.mkdtemp() + working_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) with CatchLog4CPlus( working_dir, self.logger.name + ".GlobalControl", diff --git a/CEP/Pipeline/recipes/sip/master/setupparmdb.py b/CEP/Pipeline/recipes/sip/master/setupparmdb.py index e887d33b1ddcdd3db8a9e5a7c51c0a5d1361a4cd..ad54b38277b6376bfa188372f50da38107aeaecb 100644 --- a/CEP/Pipeline/recipes/sip/master/setupparmdb.py +++ b/CEP/Pipeline/recipes/sip/master/setupparmdb.py @@ -90,7 +90,8 @@ class setupparmdb(BaseRecipe, RemoteCommandRecipeMixIn): # generate a temp dir pdbdir = tempfile.mkdtemp( - dir=self.config.get("layout", "job_directory") + dir=self.config.get("layout", "job_directory"), + suffix=".%s" % (os.path.basename(__file__),) ) pdbfile = os.path.join(pdbdir, self.inputs['suffix']) diff --git a/CEP/Pipeline/recipes/sip/nodes/bbs_reducer.py b/CEP/Pipeline/recipes/sip/nodes/bbs_reducer.py index d327ae04c4d29a9f4b9e747632f8e7ad15940914..64e3bb9054fd2b2b5d92c631760c023a43f2706c 100644 --- a/CEP/Pipeline/recipes/sip/nodes/bbs_reducer.py +++ b/CEP/Pipeline/recipes/sip/nodes/bbs_reducer.py @@ -46,7 +46,7 @@ class bbs_reducer(LOFARnodeTCP): return 1 # Run bbs-reducer. Catch log output from bbs-reducer and stdout. - scratch_dir = mkdtemp() + scratch_dir = mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) try: cmd = [executable, "--parmdb=%s" % parmdb, diff --git a/CEP/Pipeline/recipes/sip/nodes/deprecated/bbs.py b/CEP/Pipeline/recipes/sip/nodes/deprecated/bbs.py index 6fbaca14092d505d086a556fd5dd9f5309a35f34..8ab25875631e5686dbf826d0e5e6b0b753c9c2b1 100644 --- a/CEP/Pipeline/recipes/sip/nodes/deprecated/bbs.py +++ b/CEP/Pipeline/recipes/sip/nodes/deprecated/bbs.py @@ -66,7 +66,7 @@ class bbs(LOFARnodeTCP): # Run the kernel # Catch & log output from the kernel logger and stdout # ------------------------------------------------------------------ - working_dir = mkdtemp() + working_dir = mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) env = read_initscript(self.logger, initscript) try: cmd = [executable, parset_filename, "0"] diff --git a/CEP/Pipeline/recipes/sip/nodes/deprecated/cimager.py b/CEP/Pipeline/recipes/sip/nodes/deprecated/cimager.py index 4b1d715c61f61c18b801399586793372f8e85181..278d47336c6a92541392e1bfbcb4ef7f3a6c99a3 100644 --- a/CEP/Pipeline/recipes/sip/nodes/deprecated/cimager.py +++ b/CEP/Pipeline/recipes/sip/nodes/deprecated/cimager.py @@ -47,7 +47,7 @@ class cimager(LOFARnodeTCP): self.logger.info("Image already exists: aborting.") return 0 try: - working_dir = mkdtemp() + working_dir = mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) # If a time range has been specified, copy that section of the # input MS and only image that. diff --git a/CEP/Pipeline/recipes/sip/nodes/deprecated/demixing.py b/CEP/Pipeline/recipes/sip/nodes/deprecated/demixing.py index c72a5cf9e8f49c8e1276964bd4f436f35884556a..cbd49e5a281b14cc6f0c89d7532f042d6ab3c8e4 100644 --- a/CEP/Pipeline/recipes/sip/nodes/deprecated/demixing.py +++ b/CEP/Pipeline/recipes/sip/nodes/deprecated/demixing.py @@ -54,7 +54,7 @@ class demixing(LOFARnodeTCP): def _execute(self, cmd): try: - temp_dir = tempfile.mkdtemp() + temp_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) with CatchLog4CPlus(temp_dir, self.logger.name, os.path.basename(cmd[0]) diff --git a/CEP/Pipeline/recipes/sip/nodes/dppp.py b/CEP/Pipeline/recipes/sip/nodes/dppp.py index de369323e889d343b29f7e794720b3d590ef3079..f77761729c52edc1e978753bec84419e063d34b1 100644 --- a/CEP/Pipeline/recipes/sip/nodes/dppp.py +++ b/CEP/Pipeline/recipes/sip/nodes/dppp.py @@ -142,7 +142,7 @@ class dppp(LOFARnodeTCP): temp_parset_filename ) try: - working_dir = tempfile.mkdtemp() + working_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) # **************************************************************** # 6. Run ndppp cmd = [executable, temp_parset_filename, '1'] diff --git a/CEP/Pipeline/recipes/sip/nodes/gainoutliercorrection.py b/CEP/Pipeline/recipes/sip/nodes/gainoutliercorrection.py index 03ee5128f5900c996aa9e8756d7a13d8b08793f3..db263daa8594159aae108df39faa2d69b087b1bf 100644 --- a/CEP/Pipeline/recipes/sip/nodes/gainoutliercorrection.py +++ b/CEP/Pipeline/recipes/sip/nodes/gainoutliercorrection.py @@ -77,7 +77,7 @@ class gainoutliercorrection(LOFARnodeTCP): self.logger.info( "Using the gainoutlier correction based on parmexportcal") try: - temp_dir = tempfile.mkdtemp() + temp_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) with CatchLog4CPlus( temp_dir, self.logger.name + '.' + os.path.basename(infile), diff --git a/CEP/Pipeline/recipes/sip/nodes/imager_finalize.py b/CEP/Pipeline/recipes/sip/nodes/imager_finalize.py index 81cc87d795acaf5b07bfafa27684f3b6e1430cbe..a06849c3dbdadb36aba4ca6d5c901b9c40eeb9cd 100644 --- a/CEP/Pipeline/recipes/sip/nodes/imager_finalize.py +++ b/CEP/Pipeline/recipes/sip/nodes/imager_finalize.py @@ -116,7 +116,7 @@ class imager_finalize(LOFARnodeTCP): os.unlink(fits_output) try: - temp_dir = tempfile.mkdtemp() + temp_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) with CatchLog4CPlus(temp_dir, self.logger.name + '.' + os.path.basename(awimager_output), "image2fits") as logger: diff --git a/CEP/Pipeline/recipes/sip/nodes/new_bbs.py b/CEP/Pipeline/recipes/sip/nodes/new_bbs.py index a0ee543182e7e52ddf4abd582fa7b5c0df8b5755..0123140135f7cb5329e7b693017b1ef69088fcd6 100644 --- a/CEP/Pipeline/recipes/sip/nodes/new_bbs.py +++ b/CEP/Pipeline/recipes/sip/nodes/new_bbs.py @@ -75,7 +75,7 @@ class new_bbs(LOFARnodeTCP): # Run the kernel # Catch & log output from the kernel logger and stdout # ------------------------------------------------------------------ - working_dir = mkdtemp() + working_dir = mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) try: self.logger.info("******** {0}".format(open(parset_file).read())) cmd = [executable, parset_file, "0"] diff --git a/CEP/Pipeline/recipes/sip/nodes/rficonsole.py b/CEP/Pipeline/recipes/sip/nodes/rficonsole.py index d9869abff65bbdb1049ff4244dc07d70d82163a0..ceecf728f5941a97ab1e0089ee4735ff201569bb 100644 --- a/CEP/Pipeline/recipes/sip/nodes/rficonsole.py +++ b/CEP/Pipeline/recipes/sip/nodes/rficonsole.py @@ -27,7 +27,7 @@ class rficonsole(LOFARnodeTCP): if not os.access(executable, os.X_OK): raise ExecutableMissing(executable) - working_dir = tempfile.mkdtemp(dir=wd) + working_dir = tempfile.mkdtemp(dir=wd,suffix=".%s" % (os.path.basename(__file__),)) cmd = [executable, "-j", str(nthreads)] if strategy: if os.path.exists(strategy): diff --git a/CEP/Pipeline/recipes/sip/nodes/setupsourcedb.py b/CEP/Pipeline/recipes/sip/nodes/setupsourcedb.py index ee35999e2d938e85f86acfab0991718ec62c5e32..af1212d13c4fae1f88da87dc5bf6e9b3668b3b1b 100644 --- a/CEP/Pipeline/recipes/sip/nodes/setupsourcedb.py +++ b/CEP/Pipeline/recipes/sip/nodes/setupsourcedb.py @@ -49,7 +49,7 @@ class setupsourcedb(LOFARnodeTCP): shutil.rmtree(skydb, ignore_errors=True) self.logger.info("Creating skymodel: %s" % (skydb)) - scratch_dir = tempfile.mkdtemp() + scratch_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) try: cmd = [executable, "in=%s" % catalogue, diff --git a/CEP/Pipeline/test/recipes/helpers/WritableParmDB_test.py b/CEP/Pipeline/test/recipes/helpers/WritableParmDB_test.py index adc4651d8490ebe63b5b0abf7419c4f1f0cc1b57..6da1b92ed44e36fb3e52fb68db66df1fc959a8e9 100644 --- a/CEP/Pipeline/test/recipes/helpers/WritableParmDB_test.py +++ b/CEP/Pipeline/test/recipes/helpers/WritableParmDB_test.py @@ -28,7 +28,7 @@ class writableParmdbTest(unittest.TestCase): super(writableParmdbTest, self).__init__(arg) def setUp(self): - self.tempDir = tempfile.mkdtemp() + self.tempDir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) self.tempParmDB = os.path.join(self.tempDir, "parmDB") self.writable_parmdb = writableParmdbWrapper(self.tempParmDB) diff --git a/CEP/Pipeline/test/recipes/master/copier_test.py b/CEP/Pipeline/test/recipes/master/copier_test.py index 518445c1a1ea456b6b4c612b63352c2d8fc409d4..b94b35ce06cf6f1e68eb92cfe4eb8d3b639a78b6 100644 --- a/CEP/Pipeline/test/recipes/master/copier_test.py +++ b/CEP/Pipeline/test/recipes/master/copier_test.py @@ -33,10 +33,10 @@ class copierTest(unittest.TestCase): def setUp(self): self.imager_create_dbs = copierWrapper() - self.test_path = temp_path = tempfile.mkdtemp() + self.test_path = temp_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) pass def test_validate_mapfiles_norename(self): @@ -120,10 +120,10 @@ class MasterNodeInterfaceTest(unittest.TestCase): super(MasterNodeInterfaceTest, self).__init__(arg) def setUp(self): - self.test_path = temp_path = tempfile.mkdtemp() + self.test_path = temp_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) pass def test__init__raise_exception(self): diff --git a/CEP/Pipeline/test/recipes/master/imager_bbs_test.py b/CEP/Pipeline/test/recipes/master/imager_bbs_test.py index 5bc5e2edea0b8304e6aeaf7db602c59efd408da3..d85e0d7c74b8a25c52361f5af8778e28dc1c0f64 100644 --- a/CEP/Pipeline/test/recipes/master/imager_bbs_test.py +++ b/CEP/Pipeline/test/recipes/master/imager_bbs_test.py @@ -35,10 +35,10 @@ class imager_bbsTest(unittest.TestCase): super(imager_bbsTest, self).__init__(arg) def setUp(self): - self.test_path = temp_path = tempfile.mkdtemp() + self.test_path = temp_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) pass def test_constructor(self): diff --git a/CEP/Pipeline/test/recipes/master/imager_create_dbs_test.py b/CEP/Pipeline/test/recipes/master/imager_create_dbs_test.py index af56368efd08f4a05146e517ce0e93fe6ca8c623..ca5b75912416ef0123b1dfaf485658d36a620877 100644 --- a/CEP/Pipeline/test/recipes/master/imager_create_dbs_test.py +++ b/CEP/Pipeline/test/recipes/master/imager_create_dbs_test.py @@ -35,10 +35,10 @@ class imager_create_dbsTest(unittest.TestCase): super(imager_create_dbsTest, self).__init__(arg) def setUp(self): - self.test_path = temp_path = tempfile.mkdtemp() + self.test_path = temp_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) pass def test_validate_input_data(self): diff --git a/CEP/Pipeline/test/recipes/master/imager_prepare_test.py b/CEP/Pipeline/test/recipes/master/imager_prepare_test.py index a4504406a2d623a0294d0f62cc036bc78aed9c76..5eb2c34067c9ba0f3b49ac51667d794e370fb669 100644 --- a/CEP/Pipeline/test/recipes/master/imager_prepare_test.py +++ b/CEP/Pipeline/test/recipes/master/imager_prepare_test.py @@ -33,10 +33,10 @@ class imager_prepareTest(unittest.TestCase): super(imager_prepareTest, self).__init__(arg) def setUp(self): - self.test_path = temp_path = tempfile.mkdtemp() + self.test_path = temp_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) pass def test_create_input_map_for_sbgroup_single_ms(self): diff --git a/CEP/Pipeline/test/recipes/nodes/copier_test.py b/CEP/Pipeline/test/recipes/nodes/copier_test.py index d72935df9584d0461aec7cc1de44f25b591d7fdd..fe67f3444fb0a67c210b07748c0d52463b9c9f2f 100644 --- a/CEP/Pipeline/test/recipes/nodes/copier_test.py +++ b/CEP/Pipeline/test/recipes/nodes/copier_test.py @@ -38,7 +38,7 @@ class copierTest(unittest.TestCase): def tearDown(self): pass - #shutil.rmtree(self.test_path) + shutil.rmtree(self.test_path) # # refactor of copier means this test is not needed anymore. Comment out for # # now @@ -49,7 +49,7 @@ class copierTest(unittest.TestCase): # rsync return value # # """ -# temp_dir = tempfile.mkdtemp() +# temp_dir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) # path_to_unowned_dir = "/home/klijntest/testdir" # # file_to_copy = open(os.path.join(temp_dir, "test.txt"), 'w') # file_to_copy.close() diff --git a/CEP/Pipeline/test/recipes/nodes/gainoutliercorrection_test.py b/CEP/Pipeline/test/recipes/nodes/gainoutliercorrection_test.py index 60b446fd50913463b85b5820b0cfd66d37f19a96..014fce027a85e125bf6d2cb80be6ce8704dedd84 100644 --- a/CEP/Pipeline/test/recipes/nodes/gainoutliercorrection_test.py +++ b/CEP/Pipeline/test/recipes/nodes/gainoutliercorrection_test.py @@ -30,7 +30,7 @@ class GainOutlierDetectionTest(unittest.TestCase): super(GainOutlierDetectionTest, self).__init__(arg) def setUp(self): - self.tempDir = tempfile.mkdtemp() + self.tempDir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): diff --git a/CEP/Pipeline/test/recipes/nodes/imager_bbs_test.py b/CEP/Pipeline/test/recipes/nodes/imager_bbs_test.py index 9a17e1faf8b8dde5b0baea98b62b6831bef3602b..cb67c88998a4d59e4933e6c08ec88e735f321111 100644 --- a/CEP/Pipeline/test/recipes/nodes/imager_bbs_test.py +++ b/CEP/Pipeline/test/recipes/nodes/imager_bbs_test.py @@ -33,9 +33,10 @@ class imager_bbsTest(unittest.TestCase): super(imager_bbsTest, self).__init__(arg) def setUp(self): - self.test_path = tempfile.mkdtemp() + self.test_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): + shutil.rmtree(self.test_path) pass def test_constructor(self): diff --git a/CEP/Pipeline/test/recipes/nodes/imager_create_dbs_test.py b/CEP/Pipeline/test/recipes/nodes/imager_create_dbs_test.py index bce1838dae1be5b2a20c6acb58003b1e5b1651ef..004cd81676eb1ad04fda512aec92d10cd995b22c 100644 --- a/CEP/Pipeline/test/recipes/nodes/imager_create_dbs_test.py +++ b/CEP/Pipeline/test/recipes/nodes/imager_create_dbs_test.py @@ -46,9 +46,10 @@ class ImagerCreateDBsTest(unittest.TestCase): def setUp(self): self.imager_create_dbs = ImagerCreateDBsTestWrapper() - self.test_path = tempfile.mkdtemp() + self.test_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): + shutil.rmtree(self.test_path) pass # New version of gsm: Quick fix to allow tests to succeed diff --git a/CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py b/CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py index 85cc51057fc6a076ac197c9f24be3297c16fc756..35e61a823acbc5d50635faae89d9228840efb14b 100644 --- a/CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py +++ b/CEP/Pipeline/test/recipes/nodes/imager_prepare_test.py @@ -40,9 +40,10 @@ class ImagerPrepareTest(unittest.TestCase): def setUp(self): self.ImagerPrepareTestWrapper = ImagerPrepareTestWrapper() - self.test_path = tempfile.mkdtemp() + self.test_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) def tearDown(self): + shutil.rmtree(self.test_path) pass def test__copy_input_files_multi_file(self): @@ -97,7 +98,7 @@ class ImagerPrepareTest(unittest.TestCase): """ working_dir = "" - time_slice_dir_path = tempfile.mkdtemp() + time_slice_dir_path = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) slices_per_image = 2 input_map = [("lce072", "test_file_path1"), ("lce072", "test_file_path2"), @@ -145,6 +146,8 @@ class ImagerPrepareTest(unittest.TestCase): "time_slice_1.dppp.ms.ndppp.par")).read()) self.assertTrue(parset_2_output == parset_2_content_expected, "\n{0} != \n{1}".format(parset_2_output, parset_2_content_expected)) + + shutil.rmtree(time_slice_dir_path) if __name__ == "__main__": diff --git a/CEP/Pipeline/test/support/data_map_test.py b/CEP/Pipeline/test/support/data_map_test.py index 17ad4c607ebb537455828066eae6b26a19135a75..5321e766e946f50cf085f57133a76e5b8c808cc0 100644 --- a/CEP/Pipeline/test/support/data_map_test.py +++ b/CEP/Pipeline/test/support/data_map_test.py @@ -33,7 +33,7 @@ class DataMapTest(unittest.TestCase): """ Create scratch directory and create required input files in there. """ - self.tmpdir = tempfile.mkdtemp() + self.tmpdir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) self.old_style_map_file = self._create_old_style_map_file() self.new_style_map_file = self._create_new_style_map_file() self.syntax_error_map_file = self._create_syntax_error_map_file() @@ -155,7 +155,7 @@ class MultiDataMapTest(unittest.TestCase): """ Create scratch directory and create required input files in there. """ - self.tmpdir = tempfile.mkdtemp() + self.tmpdir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) self.old_style_map_file = self._create_old_style_map_file() self.new_style_map_file = self._create_new_style_map_file() self.syntax_error_map_file = self._create_syntax_error_map_file() @@ -290,7 +290,7 @@ class HelperFunctionDataMapTest(unittest.TestCase): """ Create scratch directory and create required input files in there. """ - self.tmpdir = tempfile.mkdtemp() + self.tmpdir = tempfile.mkdtemp(suffix=".%s" % (os.path.basename(__file__),)) self.old_style_map_file = self._create_old_style_map_file() self.new_style_map_file = self._create_new_style_map_file() self.syntax_error_map_file = self._create_syntax_error_map_file()