-
Notifications
You must be signed in to change notification settings - Fork 45
Django to 3.0 #1730
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
Django to 3.0 #1730
Conversation
|
Current problem is that running: docker compose exec django py.test -m "not e2e"Is failing in file assert CompetitionParticipant.objects.filter(
user=self.other_user,
competition=self.comp,
status=CompetitionParticipant.APPROVED
).count() == 1produces a count of 1 in django 2.28.0 and in 3.0 I get not returned results: 3.0: > /app/src/apps/api/tests/test_competitions.py(52)test_adding_organizer_creates_accepted_participant()
-> assert CompetitionParticipant.objects.filter(
(Pdb) CompetitionParticipant.objects.filter(user=self.other_user,competition=self.comp,status=CompetitionParticipant.APPROVED)
<QuerySet []>
(Pdb) 2.2.28: > /app/src/apps/api/tests/test_competitions.py(52)test_adding_organizer_creates_accepted_participant()
-> assert CompetitionParticipant.objects.filter(
(Pdb) CompetitionParticipant.objects.filter(user=self.other_user,competition=self.comp,status=CompetitionParticipant.APPROVED)
<QuerySet [<CompetitionParticipant: (238) - User: other_user in Competition: Competition 39>]>
(Pdb) |
|
Ok so this line: resp = self.client.put(url, data=json.dumps(data), content_type="application/json")is supposed to edit the data object which is holding an updated "colaborators" list with the 'other_user' pk. It seems like it is not doing that. So the new version isn't adding 'other_user' to table 'competitions_competitionparticipant' based on PUT request. |
|
Have you tried using different version of PostgresSQL and Django ? |
|
So I found out that in Django 2.2.28 and below many to many relationships when altered auto updated the complex entities they are related to. People complained about too much magic in the database operations and so the bug is that we need to create CompetitionParticipant records for folks marked as collaborators or admins or a challenge from the Edit menu. It happens automatically in django 2 but not in 3 on purpose. There is another bug I'm working on now related to solutions in a task. In the automated tests, they create a task with submission and solution and something about triangulating the two of them in the TaskViewSet in throws an error. @ObadaS - I haven't ruled anything out. I guess this is worth toggling. |
|
@ObadaS : Tried:
Still has the same error: ==================================================================================================================== short test summary info =====================================================================================================================
FAILED src/apps/api/tests/test_tasks.py::TestTasks::test_task_shown_as_validated_properly - django.db.utils.ProgrammingError: syntax error at or near ""tasks_solution""
================================================================================================================ 1 failed, 32 warnings in 13.38s =================================================================================================================
Used this structure to try diff postgres's: DB_NAME=postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
DUMP_NAME=postgres:12-alpine
docker exec codabench-db-1 bash -c "PGPASSWORD=$DB_PASSWORD pg_dump -Fc -U $DB_USERNAME $DB_NAME > /app/backups/$DUMP_NAME.dump"
# Also to be sure
# sudo cp -r /home/bbearce/Documents/codabench/var/postgres /home/bbearce/Documents/codabench/var/postgres_orig
sudo rm -r /home/bbearce/Documents/codabench/var/postgres/*
docker compose down
# Change version of postgres image under service 'db'
docker compose up -d
docker compose logs -f db
docker compose exec db bash
dropdb $DB_NAME -U $DB_USERNAME
createdb $DB_NAME -U $DB_USERNAME
pg_restore -U $DB_USERNAME -d $DB_NAME -1 /app/backups/postgres:12-alpine.dumpIt didn't work. There might be something I'm missing and maybe I can keep trying images but I have a hunch the logic is the issue. Going to keep going down that road for now. |
Merge develop to master (version.json to 1.18.0)
* Add remove button for cancelled submissions * Allow remove of cancelled submissions
|
Ok this this needed this block in circleci/config.yml: Basically after making new tests for checking ingestion\submission logs, docker images need to be pulled and used by the competitions in the test. The tests are timing out because the compute_worker is pulling images during a submission and it takes a while. Pre-pulling helps the tests go faster and not time out. |
|
Under test at https://codabench-test.lri.fr |
|
@bbearce It looks like in https://codabench-test.lri.fr/ I need to refresh the page after a submission to see the score and the status updated. The live logs terminal does not always work. So I think the failing test did actually highlight an existing problem. Not sure if it is related, but when making a submission, during 1 second the table is "broken" with "Invalid time" etc. and then refresh with the right display. I am using Firefox. |
|
Yes, 100%. I think I showed this many times and also struggled with it for many weeks. I think we decided it wasn't worth getting hung up on this one live terminal issue. I thought the consensus was that we were going to rewrite the test so that it at least tests that submissions generate the right logs and hope that Django 4 or 5 magically fix this issue. |
|
Oh OK, I thought the problem was only in CircleCI but not when using the platform. Yes let's hope we can get this fixed in the future. |


Description
Consumer needed a new library "asgiref" versus "channels.db" for using the method "sync_to_async".
Issues this PR resolves
Dependabot wanted to upgrade Django to the absolute latest which is too big to do yet. This however upgrades django from 2.2.28 to 3.0. This was a large change but not too large.
A checklist for hand testing
docker compose up -d buildChecklist