summaryrefslogtreecommitdiff
path: root/kbas
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-09-13 17:19:11 +0100
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-09-13 17:24:22 +0100
commitdb7d2859d239a2a79f6d9be6cac3fd9f24a4d86e (patch)
treedea87fe7f538b63cb74c812b82708bee8a72ed4f /kbas
parente83f8b006a744be837ac9a9e1d642f785085da38 (diff)
downloadybd-db7d2859d239a2a79f6d9be6cac3fd9f24a4d86e.tar.gz
Show download count
Diffstat (limited to 'kbas')
-rwxr-xr-xkbas/__main__.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py
index 03993bd..4445f67 100755
--- a/kbas/__main__.py
+++ b/kbas/__main__.py
@@ -42,6 +42,7 @@ class KeyedBinaryArtifactServer(object):
os.path.join(os.path.dirname(__file__), 'config', 'kbas.conf')])
app.config['start-time'] = datetime.now()
app.config['last-upload'] = datetime.now()
+ app.config['downloads'] = 0
try:
import cherrypy
@@ -90,6 +91,7 @@ class KeyedBinaryArtifactServer(object):
@bottle.get('/get/<cache_id>')
def get_artifact(cache_id):
f = os.path.join(cache_id, cache_id)
+ app.config['downloads'] += 1
return static_file(f, root=app.config['artifact-dir'], download=True,
mimetype='application/x-tar')
@@ -100,6 +102,7 @@ class KeyedBinaryArtifactServer(object):
free = stat.f_frsize * stat.f_bavail / 1000000000
artifacts = len(os.listdir(app.config['artifact-dir']))
started = app.config['start-time'].strftime('%y-%m-%d %H:%M:%S')
+ downloads = app.config['downloads']
last_upload = app.config['last-upload'].strftime('%y-%m-%d %H:%M:%S')
content = [['Started:', started, None]]
content += [['Last upload:', last_upload, None]]
@@ -107,6 +110,7 @@ class KeyedBinaryArtifactServer(object):
content += [['Last reject:', app.config['last-reject'], None]]
content += [['Space:', str(free) + 'GB', None]]
content += [['Artifacts:', str(artifacts), None]]
+ content += [['Downloads:', downloads, None]]
return template('kbas',
title='KBAS status',
content=content,