2
0
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:
2026-01-30 19:43:44 +00:00
parent a72950b546
commit 767e3d568c

View File

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