codalab / codabench

Codabench is a flexible, easy-to-use and reproducible benchmarking platform. Check our paper at Patterns Cell Press https://hubs.li/Q01fwRWB0
Apache License 2.0
76 stars 28 forks source link

Altering leaderboard columns breaks a live contest. No additional saves can be made #1600

Closed chansmi closed 1 month ago

chansmi commented 1 month ago

I was working with Ihsan and we made changes to the leaderboard columns. Specifically removing the columns. Everthing seemed to work properly but not I can't make any changes to the site. Trying to save any changes, even small, results in the following console error.

Live contest: https://www.codabench.org/competitions/edit/3888/#/pages

Screenshot 2024-09-27 at 4 09 36 PM

Didayolo commented 1 month ago

Here are the error logs when trying to save.

codabench-django-1         | Internal Server Error: /api/competitions/3888/
codabench-django-1         | Traceback (most recent call last):
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
codabench-django-1         |     response = get_response(request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
codabench-django-1         |     response = self.process_exception_by_middleware(e, request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
codabench-django-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
codabench-django-1         |     return view_func(*args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 116, in view
codabench-django-1         |     return self.dispatch(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 495, in dispatch
codabench-django-1         |     response = self.handle_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 455, in handle_exception
codabench-django-1         |     self.raise_uncaught_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 492, in dispatch
codabench-django-1         |     response = handler(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/mixins.py", line 84, in partial_update
codabench-django-1         |     return self.update(request, *args, **kwargs)
codabench-django-1         |   File "/app/src/apps/api/views/competitions.py", line 262, in update
codabench-django-1         |     leaderboard.save()
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/drf_writable_nested/mixins.py", line 230, in save
codabench-django-1         |     return super(BaseNestedModelSerializer, self).save(**kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 183, in save
codabench-django-1         |     assert not self.errors, (
codabench-django-1         | AssertionError: You cannot call `.save()` on a serializer with invalid data.
codabench-django-1         | Internal Server Error: /api/competitions/3888/
codabench-django-1         | Traceback (most recent call last):
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
codabench-django-1         |     response = get_response(request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
codabench-django-1         |     response = self.process_exception_by_middleware(e, request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
codabench-django-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
codabench-django-1         |     return view_func(*args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 116, in view
codabench-django-1         |     return self.dispatch(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 495, in dispatch
codabench-django-1         |     response = self.handle_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 455, in handle_exception
codabench-django-1         |     self.raise_uncaught_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 492, in dispatch
codabench-django-1         |     response = handler(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/mixins.py", line 84, in partial_update
codabench-django-1         |     return self.update(request, *args, **kwargs)
codabench-django-1         |   File "/app/src/apps/api/views/competitions.py", line 262, in update
codabench-django-1         |     leaderboard.save()
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/drf_writable_nested/mixins.py", line 230, in save
codabench-django-1         |     return super(BaseNestedModelSerializer, self).save(**kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 183, in save
codabench-django-1         |     assert not self.errors, (
codabench-django-1         | AssertionError: You cannot call `.save()` on a serializer with invalid data.
Didayolo commented 1 month ago

The first column "Avg Focal Per Capita" was previously set as an average between the two other columns. When you removed the two other columns, this computation was missing its columns and the setting got invalid. I replaced the "Average" mode by simply calling an "avg_focal_per_capita" key for this column.

Not sure if you want to have the two other columns and compute an average, or to use this key as I did right now. The key "avg_focal_per_capita" means that the scoring program must output a score associated with this key.

It is now possible to make live changes and to save the competition.

Didayolo commented 1 month ago

Regarding this issue, it should not have been possible to save the leaderboard setting after removed columns used by a "computation column".

Didayolo commented 1 month ago

I need to detail the issue but basically there is a strange behavior here:

  1. I set up the column to use key instead of computation
  2. Save
  3. Come back to the editor and the column is using computation again