mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 04:27:45 +00:00
wrap in try/except so continues
This commit is contained in:
@@ -475,9 +475,7 @@ class LoadingSurvex:
|
||||
stash_data_issue(
|
||||
parser="survex", message=message, url=None, sb=(survexblock.survexfile.path)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
def save_survexblocks_to_db(self):
|
||||
"""This saves the in-memory python objects into the database, at which point
|
||||
the foreign keys are enabled and one can do queries on the database.
|
||||
@@ -700,8 +698,14 @@ class LoadingSurvex:
|
||||
parser="survex",
|
||||
message=message
|
||||
)
|
||||
|
||||
SurvexPersonRole.objects.bulk_create(valid_list)
|
||||
try:
|
||||
SurvexPersonRole.objects.bulk_create(valid_list)
|
||||
except Exception as e:
|
||||
message = f"\n ! - EXCEPTION '{e}' - in buk update. Falling back on sequential updates"
|
||||
print(message)
|
||||
print(message, file=sys.stderr)
|
||||
stash_data_issue(parser="survex", message=message)
|
||||
|
||||
|
||||
_pending_pr_saves = {} # in database now, so empty cache
|
||||
|
||||
@@ -742,8 +746,10 @@ class LoadingSurvex:
|
||||
qms.append(qm)
|
||||
#qm.save()
|
||||
except Exception as e:
|
||||
pass
|
||||
raise
|
||||
message = f"\n ! - EXCEPTION '{e}' - in buk update. Falling back on sequential updates"
|
||||
print(message)
|
||||
print(message, file=sys.stderr)
|
||||
stash_data_issue(parser="survex", message=message)
|
||||
|
||||
bulk_kwargs = {
|
||||
"update_conflicts": True,
|
||||
@@ -754,13 +760,13 @@ class LoadingSurvex:
|
||||
if connection.vendor != 'mysql':
|
||||
bulk_kwargs["unique_fields"] = ['cave', 'blockname', 'grade', 'number', 'expoyear']
|
||||
|
||||
try:
|
||||
QM.objects.bulk_create(qms, **bulk_kwargs)
|
||||
try:
|
||||
QM.objects.bulk_create(qms, **bulk_kwargs)
|
||||
except Exception as e:
|
||||
pass
|
||||
raise
|
||||
|
||||
_pending_qm_saves = {} # in database now, so empty cache
|
||||
message = f"\n ! - EXCEPTION '{e}' - in buk update. Falling back on sequential updates"
|
||||
print(message)
|
||||
print(message, file=sys.stderr)
|
||||
stash_data_issue(parser="survex", message=message)
|
||||
|
||||
def add_to_pending(self, survexblock, tm):
|
||||
"""Collects team names. We might not have a date so cannot validate
|
||||
|
||||
Reference in New Issue
Block a user