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
No related branches found
No related tags found
No related merge requests found
......@@ -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}')
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment