From 667d7a2aed86e79eb2a61b457d684990bfec7edf Mon Sep 17 00:00:00 2001 From: David Schultz Date: Sat, 26 Oct 2024 11:38:16 -0500 Subject: [PATCH] delete jel and day dir if empty (#398) --- iceprod/server/plugins/condor.py | 18 ++++++++---------- tests/server/plugins/condor_test.py | 4 +--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/iceprod/server/plugins/condor.py b/iceprod/server/plugins/condor.py index 6d5a2438..13fbcd9c 100644 --- a/iceprod/server/plugins/condor.py +++ b/iceprod/server/plugins/condor.py @@ -930,15 +930,13 @@ async def check_submit_dir(self): logger.info('cleaning up submit dir %s', path) shutil.rmtree(path) if empty: - st = daydir.lstat() - if st.st_mtime < dir_old_time: - logger.info('cleaning up daydir %s', daydir) - for path in self.jels.copy(): - if Path(path).parent == daydir: - logger.info('removing JEL') - self.jels[path].close() - del self.jels[path] - shutil.rmtree(daydir) - continue + logger.info('cleaning up daydir %s', daydir) + for path in self.jels.copy(): + if Path(path).parent == daydir: + logger.info('removing JEL') + self.jels[path].close() + del self.jels[path] + shutil.rmtree(daydir) + continue # let other processing happen await asyncio.sleep(0) diff --git a/tests/server/plugins/condor_test.py b/tests/server/plugins/condor_test.py index b4b5db97..3a58597c 100644 --- a/tests/server/plugins/condor_test.py +++ b/tests/server/plugins/condor_test.py @@ -622,9 +622,7 @@ async def test_Grid_check_delete_day(schedd, i3prod_path, set_time): jel = g.get_current_JEL() p = jel.parent - t = time.mktime(set_time.utctimetuple()) - 35 # must be older than all times added together - os.utime(p, (t, t)) - logging.info('set time to %d', t) + t = time.mktime(set_time.utctimetuple()) assert g.jels != {}