summaryrefslogtreecommitdiff
path: root/kbas
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2015-10-20 01:57:10 +0100
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2015-10-20 01:57:10 +0100
commit8a7662b4b998b69c742f0ceac820f52994621266 (patch)
tree43211e7d874ecce9b1559cf73cb0441b1f0f705d /kbas
parent23c4a709560c2346ee0a3c080f7ff21a1bc1d19a (diff)
downloadybd-8a7662b4b998b69c742f0ceac820f52994621266.tar.gz
Make kbas touch the files it's asked for, so we can cull
Diffstat (limited to 'kbas')
-rwxr-xr-xkbas/__main__.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py
index 13d9ab3..b75fe60 100755
--- a/kbas/__main__.py
+++ b/kbas/__main__.py
@@ -23,6 +23,7 @@ from time import strftime, gmtime
import tempfile
import yaml
from bottle import Bottle, request, response, template, static_file
+from subprocess import call
from ybd import app
@@ -60,20 +61,29 @@ class KeyedBinaryArtifactServer(object):
current_dir = os.getcwd()
os.chdir(app.config['artifact-dir'])
names = glob.glob('*' + name + '*')
- content = [[x, strftime('%y-%m-%d', gmtime(os.path.getmtime(x)))]
+ content = [[x, strftime('%y-%m-%d %H:%M:%S',
+ gmtime(os.path.getmtime(x))),
+ strftime('%y-%m-%d %H:%M:%S',
+ gmtime(os.path.getctime(x)))]
for x in names]
os.chdir(current_dir)
return template('kbas', rows=sorted(content), css='/static/style.css')
@bottle.get('/1.0/artifacts')
def get_morph_artifact():
- path = request.query.filename
- return static_file(path, root=app.config['artifact-dir'], download=True)
+ f = request.query.filename
+ path = os.path.join(app.config['artifact-dir'], f)
+ if os.path.exists(path):
+ call(['touch', path])
+ return static_file(f, root=app.config['artifact-dir'], download=True)
@bottle.get('/get/<cache_id>')
def get_artifact(cache_id):
- path = os.path.join(cache_id, cache_id)
- return static_file(path, root=app.config['artifact-dir'], download=True)
+ f = os.path.join(cache_id, cache_id)
+ path = os.path.join(app.config['artifact-dir'], f)
+ if os.path.exists(path):
+ call(['touch', os.path.dirname(path)])
+ return static_file(f, root=app.config['artifact-dir'], download=True)
@bottle.get('/')
@bottle.get('/status')