summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-03-08 19:28:50 +0000
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-03-08 22:09:18 +0000
commitb3751ffd8808ad336d18ff6d8f0bd204da26d4e0 (patch)
tree161c43daf407f57997fe3b46155b0d2162ec9894
parent36782392a95d853edc6f64be9b2adf86b5b5788e (diff)
downloadybd-b3751ffd8808ad336d18ff6d8f0bd204da26d4e0.tar.gz
Do not cull things we need for this run of ybd
-rwxr-xr-xybd/__main__.py2
-rw-r--r--ybd/app.py2
-rw-r--r--ybd/cache.py3
3 files changed, 4 insertions, 3 deletions
diff --git a/ybd/__main__.py b/ybd/__main__.py
index 059749f..1c1d785 100755
--- a/ybd/__main__.py
+++ b/ybd/__main__.py
@@ -40,7 +40,6 @@ if not os.path.exists('./VERSION'):
app.setup(sys.argv)
app.cleanup(app.config['tmp'])
-cache.cull(app.config['artifacts'])
with app.timer('TOTAL'):
tmp_lock = open(os.path.join(app.config['tmp'], 'lock'), 'r')
@@ -53,6 +52,7 @@ with app.timer('TOTAL'):
with app.timer('CACHE-KEYS', 'cache-key calculations'):
cache.cache_key(defs, app.config['target'])
+ cache.cull(app.config['artifacts'])
target = defs.get(app.config['target'])
if app.config['total'] == 0 or (app.config['total'] == 1 and
target.get('kind') == 'cluster'):
diff --git a/ybd/app.py b/ybd/app.py
index 277d924..ee38c67 100644
--- a/ybd/app.py
+++ b/ybd/app.py
@@ -133,7 +133,7 @@ def setup(args):
config['kbas-url'] += '/'
config['total'] = config['tasks'] = config['counter'] = 0
- config['reproduced'] = []
+ config['reproduced'] = config['keys'] = []
config['pid'] = os.getpid()
config['program'] = os.path.basename(args[0])
config['my-version'] = get_version(os.path.dirname(__file__))
diff --git a/ybd/cache.py b/ybd/cache.py
index ea416d0..0c9198a 100644
--- a/ybd/cache.py
+++ b/ybd/cache.py
@@ -74,6 +74,7 @@ def cache_key(defs, this):
app.log('cache-log', 'cache logged to',
app.config.get('cache-log'))
+ app.config['keys'] += [definition['cache']]
return definition['cache']
@@ -300,7 +301,7 @@ def cull(artifact_dir):
path = os.path.join(artifact_dir, artifact)
if os.path.exists(os.path.join(path, artifact + '.unpacked')):
path = os.path.join(path, artifact + '.unpacked')
- if os.path.exists(path):
+ if os.path.exists(path) and not artifact in app.config['keys']:
tmpdir = tempfile.mkdtemp()
shutil.move(path, os.path.join(tmpdir, 'to-delete'))
app.remove_dir(tmpdir)