Lichess4545 / heltour

Chess tournament management software for the Lichess4545 league
https://www.lichess4545.com/
MIT License
46 stars 38 forks source link

catch error in populate_historical_ratings when a game doesn't exist #508

Closed glbert-does closed 1 year ago

glbert-does commented 1 year ago

trying to catch the following error recently reported by lukhas:

Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]: [2023-07-09 15:05:51,102: ERROR/ForkPoolWorker-2] Task heltour.tournament.tasks.populate_historical_ratings[916024c6-af34-476a-bac3-e
302b8645e78] raised unexpected: ApiClientError('API failure: CLIENT-ERROR: [404] ')
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]: Traceback (most recent call last):
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/env/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     R = retval = fun(*args, **kwargs)
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/env/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call
__
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     return self.run(*args, **kwargs)
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/2022-10-11T071331/heltour/tournament/tasks.py", line 158, in populate_historical_ra
tings
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     sp.final_rating = _find_closest_rating(sp.player, sp.season.end_date(), sp.season)
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/2022-10-11T071331/heltour/tournament/tasks.py", line 200, in _find_closest_rating
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     game_meta = lichessapi.get_game_meta(p.game_id(), priority=0, timeout=300)
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/2022-10-11T071331/heltour/tournament/lichessapi.py", line 110, in get_game_meta
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     result = _apicall_with_error_parsing(url, timeout)
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:   File "/home/lichess4545/web/www.lichess4545.com/2022-10-11T071331/heltour/tournament/lichessapi.py", line 44, in _apicall_with_erro
r_parsing
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]:     raise ApiClientError(f'API failure: {result}')
Jul 09 15:05:51 radio run-heltour-live-celery.sh[3672711]: heltour.tournament.lichessapi.ApiClientError: API failure: CLIENT-ERROR: [404]