Skip to content
Snippets Groups Projects
Commit a1af5de0 authored by Felix Tomski's avatar Felix Tomski
Browse files

Dirty fix for data race on concurrent tmp

parent f090741f
Branches
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ import subprocess ...@@ -3,7 +3,7 @@ import subprocess
import os import os
import logging import logging
import sys import sys
from time import sleep import time
import importlib.resources as importlib_resources import importlib.resources as importlib_resources
import core.modes as modes import core.modes as modes
...@@ -64,7 +64,7 @@ class Job: ...@@ -64,7 +64,7 @@ class Job:
pdb_attach.listen(port) pdb_attach.listen(port)
if self.args[1] != 'config': if self.args[1] != 'config':
logging.debug(f'Debug mode on listening on port {port}') logging.debug(f'Debug mode on listening on port {port}')
sleep(100) time.sleep(100)
except ImportError: except ImportError:
if self.args[1] != 'config': if self.args[1] != 'config':
logging.warning('Debug mode on but pdb_attach module not found') logging.warning('Debug mode on but pdb_attach module not found')
...@@ -167,8 +167,10 @@ class Job: ...@@ -167,8 +167,10 @@ class Job:
def prepare(self): def prepare(self):
if os.path.isdir(self.concurrent_tmp): if os.path.isdir(self.concurrent_tmp):
now = time.time()
for p in os.listdir(f'{self.concurrent_tmp}'): 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}') logging.debug(f'Removing concurrent_tmp: {self.concurrent_tmp}/{p}')
os.system(f'rm -r {self.concurrent_tmp}/{p}') os.system(f'rm -r {self.concurrent_tmp}/{p}')
......
...@@ -5,3 +5,6 @@ version = '0.5.4' ...@@ -5,3 +5,6 @@ version = '0.5.4'
debug = False debug = False
stdout_logging = False stdout_logging = False
log_level = logging.DEBUG log_level = logging.DEBUG
seconds_per_day = 86400
cc_tmp_del_range = 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment