Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[note to self] empty schedule creates invalid database state which can not recover itself #8

Open
saerdnaer opened this issue Dec 27, 2022 · 0 comments

Comments

@saerdnaer
Copy link
Contributor

saerdnaer commented Dec 27, 2022

Ich hab grade keinen besseren Platz das aufzuschreiben, deswegen kurz hier – wir machen dann im Zweifel einfach selbst nen Fix als PR dafür.

Wir hatten vorhin mal die situation das der upstream schedule kurz leer war, dadurch hat das plugin dann in der postgres DB eine schedule version bei der nicht alle Pflichtfelder ausgefüllt waren – konkret kommt es beim end unten im zitierten Codeblock in Zeile 131 zu einem None. Versucht man danach das wieder korrekte schedule.xml einzuspielen, schlägt das end.date() fehl, und die Exception verhindert das man über die GUI wieder in sinnvollen Zustand kommt.

Nachdem ich die fehlerhafte Schedule-Version in der Postgres DB von Hand gelöscht habe hat sich das Problem behoben.

Dec 27 16:55:16 pretalx celery[6321]: [2022-12-27 15:55:16,762: INFO/ForkPoolWorker-1] processing jev22
Dec 27 16:55:23 pretalx celery[6321]: [2022-12-27 15:55:23,084: ERROR/ForkPoolWorker-1] Task pretalx_downstream.tasks.task_refresh_upstream_schedule[62381851-5633-492f-a182-7b2dd0c1de74] raised unexpected: AttributeError("'NoneType' object has no attribute 'date'")
Dec 27 16:55:23 pretalx celery[6321]: Traceback (most recent call last):
Dec 27 16:55:23 pretalx celery[6321]:   File "/opt/pretalx/venv/lib/python3.7/site-packages/celery/app/trace.py", line 412, in trace_task
Dec 27 16:55:23 pretalx celery[6321]:     R = retval = fun(*args, **kwargs)
Dec 27 16:55:23 pretalx celery[6321]:   File "/opt/pretalx/venv/lib/python3.7/site-packages/celery/app/trace.py", line 704, in __protected_call__
Dec 27 16:55:23 pretalx celery[6321]:     return self.run(*args, **kwargs)
Dec 27 16:55:23 pretalx celery[6321]:   File "/opt/pretalx/plugin_downstream/pretalx_downstream/tasks.py", line 78, in task_refresh_upstream_schedule
Dec 27 16:55:23 pretalx celery[6321]:     root, event, release_new_version=release_new_version
Dec 27 16:55:23 pretalx celery[6321]:   File "/usr/lib/python3.7/contextlib.py", line 74, in inner
Dec 27 16:55:23 pretalx celery[6321]:     return func(*args, **kwds)
Dec 27 16:55:23 pretalx celery[6321]:   File "/opt/pretalx/plugin_downstream/pretalx_downstream/tasks.py", line 131, in process_frab
Dec 27 16:55:23 pretalx celery[6321]:  event.date_to = end.date()
Dec 27 16:55:23 pretalx celery[6321]: AttributeError: 'NoneType' object has no attribute 'date'

if release_new_version:
schedule_version = root.find("version").text
if event.settings.downstream_discard_after:
schedule_version = schedule_version.split(
event.settings.downstream_discard_after
)[0]
try:
event.wip_schedule.freeze(schedule_version, notify_speakers=False)
schedule = event.schedules.get(version=schedule_version)
except Exception as e:
raise Exception(
f'Could not import "{event.name}" schedule version "{schedule_version}": {e}.'
)
schedule.talks.update(is_visible=True)
start = schedule.talks.order_by("start").first().start
end = schedule.talks.order_by("-end").first().end
event.date_from = start.date()
event.date_to = end.date()
event.save()
return changes, schedule

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant