diff --git a/build/prepare-release.sh b/build/prepare-release.sh index b508ca77..35abcc86 100755 --- a/build/prepare-release.sh +++ b/build/prepare-release.sh @@ -43,5 +43,5 @@ docker tag "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:$MAJOR" docker push "ambianic/ambianic-edge:$MAJOR" docker tag "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:$MAJOR.$MINOR" docker push "ambianic/ambianic-edge:$MAJOR.$MINOR" -docker tag "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge $RELEASE_VERSION" +docker tag "ambianic/ambianic-edge:latest" "ambianic/ambianic-edge:$RELEASE_VERSION" docker push "ambianic/ambianic-edge:$RELEASE_VERSION" diff --git a/src/ambianic/webapp/flaskr.py b/src/ambianic/webapp/flaskr.py index 1d2b96ca..66142756 100755 --- a/src/ambianic/webapp/flaskr.py +++ b/src/ambianic/webapp/flaskr.py @@ -144,6 +144,7 @@ def view_pipelines(): def get_timeline(): response_object = {'status': 'success'} req_page = request.args.get('page', default=1, type=int) + log.debug('Requested timeline events page" %d', req_page) nonlocal data_dir resp = samples.get_timeline(page=req_page, data_dir=data_dir) response_object['timeline'] = resp diff --git a/src/ambianic/webapp/server/samples.py b/src/ambianic/webapp/server/samples.py index bc133c49..e34b5810 100644 --- a/src/ambianic/webapp/server/samples.py +++ b/src/ambianic/webapp/server/samples.py @@ -1,4 +1,4 @@ -"""Restful services related to pipeline samples.""" +"""REST API for timeline events from pipeline samples.""" import logging import uuid import datetime @@ -157,8 +157,12 @@ def get_timeline(before_datetime=None, page=1, data_dir=None): log.debug('Fetched timeline file into struct of type %r with %d events: ', type(timeline_events), len(timeline_events)) - # bring latest events to front - timeline_events.reverse() + # events are appended to the file as they arrive + # we need to read in reverse order to get the latest one first + timeline_slice = \ + timeline_events[-1*page_start_position - 1: + -1*page_end_position - 1: + -1] # files = sorted(files, key=os.path.getmtime, reverse=True) # for json_file in files[page_start_position:page_end_position]: # if @@ -169,7 +173,7 @@ def get_timeline(before_datetime=None, page=1, data_dir=None): # samples.append(sample) # lines = map(str, files) # log.debug('File names follow:\n %s', "\n".join(lines)) - return timeline_events + return timeline_slice def add_sample(new_sample=None):