Log time needed to load annotations from disk

This commit is contained in:
Mika Fischer
2011-06-20 16:21:43 +02:00
parent 0a0ca869a4
commit 5a6a0f4a0b
+8 -1
View File
@@ -1,5 +1,6 @@
import os
import fnmatch
import time
from sloth.core.exceptions import ImproperlyConfigured, NotImplementedException, InvalidArgumentException
from sloth.core.utils import import_callable
try:
@@ -15,6 +16,8 @@ try:
except:
pass
import okapy
import logging
LOG = logging.getLogger(__name__)
class AnnotationContainerFactory:
def __init__(self, containers):
@@ -78,7 +81,11 @@ class AnnotationContainer:
if not filename:
raise InvalidArgumentException("filename cannot be empty")
self.filename_ = filename
return self.parseFromFile(filename)
start = time.time()
ann = self.parseFromFile(filename)
diff = time.time() - start
LOG.info("Loaded annotations from %s in %.2fs" % (filename, diff))
return ann
def parseFromFile(self, filename):
"""