Add perf comments

This commit is contained in:
Joseph Schorr 2014-11-05 12:27:38 -05:00
parent 408fd229a7
commit a35bc11912
4 changed files with 20 additions and 0 deletions

View file

@ -24,6 +24,8 @@ logger = logging.getLogger(__name__)
def _open_stream(namespace, repository, tag, synthetic_image_id, image_json, image_list):
store = Storage(app)
# TODO: PERFORMANCE: configure DB, load the images, cache them, then disconnect.
def get_next_image():
for current_image_id in image_list:
yield model.get_repo_image(namespace, repository, current_image_id)
@ -55,6 +57,8 @@ def _write_synthetic_image_to_storage(linked_storage_uuid, linked_locations, que
queue_file.add_exception_handler(handle_exception)
# TODO: PERFORMANCE: disconnect from the DB and reconnect once the stream write finishes or on
# error.
image_path = store.image_layer_path(linked_storage_uuid)
store.stream_write(linked_locations, image_path, queue_file)
queue_file.close()
@ -132,6 +136,9 @@ def get_squashed_tag(namespace, repository, tag):
storage_args = (derived.uuid, derived.locations, storage_queue_file)
QueueProcess.run_process(_write_synthetic_image_to_storage, storage_args, finished=_cleanup)
# TODO: PERFORMANCE: close the database handle here for this process before we send the long
# download.
# Return the client's data.
return send_file(client_queue_file)