Commit 2c74aa16 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[dataimport] tell more and nicely about transaction status

branch : stable
parent 32b5d9d43a7e
......@@ -79,6 +79,7 @@ from import strptime
from logilab.common.decorators import cached
from logilab.common.deprecation import deprecated
from cubicweb import QueryError
from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES
from cubicweb.server.utils import eschema_eid
from cubicweb.server.edition import EditedEntity
......@@ -540,6 +541,10 @@ class CWImportController(object):
def run(self):
self.errors = {}
if self.commitevery is None:
self.tell('Will commit all or nothing.')
self.tell('Will commit every %s iterations' % self.commitevery)
for func, checks in self.generators:
self._checks = {}
func_name = func.__name__
......@@ -558,7 +563,12 @@ class CWImportController(object):
err = func(buckets)
if err:
self.errors[title] = (help, err)
txuuid =
txuuid =
if txuuid is not None:
self.tell('Transaction commited (txuuid: %s)' % txuuid)
except QueryError, ex:
self.tell('Transaction aborted: %s' % ex)
if self.errors:
if self.askerror == 2 or (self.askerror and confirm('Display errors ?')):
......@@ -566,8 +576,7 @@ class CWImportController(object):
for errkey, error in self.errors.items():
self.tell("\n%s (%s): %d\n" % (error[0], errkey, len(error[1])))
if txuuid is not None:
print 'transaction id:', txuuid
def _print_stats(self):
nberrors = sum(len(err[1]) for err in self.errors.values())
self.tell('\nImport statistics: %i entities, %i types, %i relations and %i errors'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment