Add better error handling when batch refresh fails, etc.
Also don't force refresh when view is requested; instead just do a refresh after batch is first created.
This commit is contained in:
parent
3e940e3c14
commit
50430e89db
|
@ -531,7 +531,18 @@ class BatchCrud(BaseCrud):
|
||||||
# transaction binding etc.
|
# transaction binding etc.
|
||||||
session = RatSession()
|
session = RatSession()
|
||||||
batch = session.query(self.batch_class).get(batch_uuid)
|
batch = session.query(self.batch_class).get(batch_uuid)
|
||||||
self.refresh_data(session, batch, progress=progress)
|
try:
|
||||||
|
self.refresh_data(session, batch, progress=progress)
|
||||||
|
except Exception as error:
|
||||||
|
session.rollback()
|
||||||
|
log.exception("refreshing data for batch failed: {0}".format(batch))
|
||||||
|
session.close()
|
||||||
|
progress.session.load()
|
||||||
|
progress.session['error'] = True
|
||||||
|
progress.session['error_msg'] = "Data refresh failed: {0}".format(error)
|
||||||
|
progress.session.save()
|
||||||
|
return
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
session.refresh(batch)
|
session.refresh(batch)
|
||||||
session.close()
|
session.close()
|
||||||
|
@ -572,13 +583,13 @@ class FileBatchCrud(BatchCrud):
|
||||||
"""
|
"""
|
||||||
refreshable = True
|
refreshable = True
|
||||||
|
|
||||||
def pre_crud(self, batch):
|
def post_create_url(self, form):
|
||||||
"""
|
"""
|
||||||
Force refresh if batch has yet to be cognized.
|
Redirect to refresh batch after creating a batch.
|
||||||
"""
|
"""
|
||||||
if not self.creating and not batch.cognized:
|
batch = form.fieldset.model
|
||||||
return HTTPFound(location=self.request.route_url(
|
Session.flush()
|
||||||
'{0}.refresh'.format(self.route_prefix), uuid=batch.uuid))
|
return self.refresh_url(batch.uuid)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def upload_dir(self):
|
def upload_dir(self):
|
||||||
|
|
Loading…
Reference in a new issue