Skip to content

Commit

Permalink
add timing info to add item in collection
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhanson committed Jan 12, 2019
1 parent b149c9e commit 3a0bb79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion satstac/collection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
import os

from datetime import datetime

from .catalog import Catalog
from satstac import STACError, utils

Expand Down Expand Up @@ -48,6 +50,7 @@ def properties(self):

def add_item(self, item, path='', filename='${id}'):
""" Add an item to this collection """
start = datetime.now()
if self.filename is None:
raise STACError('Save catalog before adding items')
item_link = item.get_filename(path, filename)
Expand Down Expand Up @@ -86,5 +89,5 @@ def add_item(self, item, path='', filename='${id}'):

# save item
item.save_as(item_fname)
logger.info('Added %s as %s' % (item.id, item.filename))
logger.debug('Added %s in %s seconds' % (item.filename, datetime.now()-start))
return self

0 comments on commit 3a0bb79

Please sign in to comment.