diff --git a/core/job.py b/core/job.py index 4f9aa0a75e22b2e6de2eea1e6bfc30772977194b..d033836f7855859f2b001a52ba0dd4afca90f02b 100644 --- a/core/job.py +++ b/core/job.py @@ -3,7 +3,7 @@ import subprocess import os import logging import sys -from time import sleep +import time import importlib.resources as importlib_resources import core.modes as modes @@ -64,7 +64,7 @@ class Job: pdb_attach.listen(port) if self.args[1] != 'config': logging.debug(f'Debug mode on listening on port {port}') - sleep(100) + time.sleep(100) except ImportError: if self.args[1] != 'config': logging.warning('Debug mode on but pdb_attach module not found') @@ -167,8 +167,10 @@ class Job: def prepare(self): if os.path.isdir(self.concurrent_tmp): + now = time.time() for p in os.listdir(f'{self.concurrent_tmp}'): - if p != self.pipeline_id and os.path.isdir(f'{self.concurrent_tmp}/{p}'): + if (p != self.pipeline_id and os.path.isdir(f'{self.concurrent_tmp}/{p}') and + os.stat(f'{self.concurrent_tmp}/{p}').st_mtime < (now - defines.cc_tmp_del_range * defines.seconds_per_day)): logging.debug(f'Removing concurrent_tmp: {self.concurrent_tmp}/{p}') os.system(f'rm -r {self.concurrent_tmp}/{p}') diff --git a/core/utility/defines.py b/core/utility/defines.py index 366423dd7e5780d9a9bd6f94c22e32e7ee3d6ce6..beac7f3f9994d8c8332dd02c023966645d7f4391 100644 --- a/core/utility/defines.py +++ b/core/utility/defines.py @@ -5,3 +5,6 @@ version = '0.5.4' debug = False stdout_logging = False log_level = logging.DEBUG + +seconds_per_day = 86400 +cc_tmp_del_range = 2