Skip to content

Competition Delete - clean up everything when a competition is deleted - #2626

Open
ihsaan-ullah wants to merge 2 commits into
developfrom
competition_delete_cleanup
Open

ihsaan-ullah wants to merge 2 commits into
developfrom
competition_delete_cleanup

Conversation

@ihsaan-ullah

@ihsaan-ullah ihsaan-ullah commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Delete all competition data and files, not just the competition record
  • Add a delete dialog showing what will be deleted
  • Let organizers choose to also delete tasks and phase datasets
  • Keep tasks and datasets that other competitions still use
  • Only the competition creator can delete it
  • Add tests for deleting and for the delete preview

NOTE

This should be reviewed and tested carefully because it involves deletion of data and files

Issues this PR resolves

Screenshots

NOTE:

  • delete button activates with the first checkbox (Delete competition data)
  • The next two checboxes Delete competition tasks and Delete phase datasets are optional
  • You cannot always delete competition tasks and phase datasets, when they are used by other competitions.

Delete preview modal without any selection

1

Delete preview modal with selection

2

When delete is done, a celery task runs with these logs

Screenshot 2026-10-07 at 3 14 53 PM

How to test

Step 1: Upload an fill the competition

  • You can use this competition bundle: Competition_Delete_Bundle.zip
  • And this submission:Competition_Delete_Submission.zip
  • When a competition is uploaded, submit the submission 2-3 times. After that create 2-3 forum posts and 2-3 dumps. Make sure that the submissions produce results (to create logs, prediction and scoring results)

NOTE: you will need competition ID for step 2 and 4

Step 2: Get stats before deletion

You will need this script to get a preview of what data is there for a competition: check_delete_preview.py

You can run it using the command below:

docker compose exec -T \
    -e COMP_ID=<COMP_ID> \
    django \
    python manage.py shell \
    -c "$(cat check_delete_preview.py)" \
    | tee preview.txt

NOTE: the output will be saved in preview.txt

Step 3: Delete competition

You can delete it the regular way. See the screenshot to see different options you will get during deletion

Step 4: Get stats after deletion

You will need this script to get deleted stats after you delete the competition: check_delete_status.py

docker compose exec -T \
    -e COMP_ID=<COMP_ID> \
    django \
    python manage.py shell \
    -c "$(cat check_delete_status.py)" \
    < preview.txt \
    | tee status.txt

NOTE: this step takes as input the preview.txt that you generated in step 2, and will output status.txt

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

@ihsaan-ullah ihsaan-ullah mentioned this pull request Oct 8, 2026
31 of 46 tasks
@Didayolo
Didayolo force-pushed the competition_delete_cleanup branch from 90bc7ef to 8aab533 Compare October 12, 2026 12:21
@ihsaan-ullah
ihsaan-ullah force-pushed the competition_delete_cleanup branch 2 times, most recently from bbd42a2 to f5084f2 Compare October 21, 2026 08:35
@ihsaan-ullah
ihsaan-ullah force-pushed the competition_delete_cleanup branch from f5084f2 to 6c25ece Compare November 9, 2026 12:49
@Didayolo Didayolo self-assigned this Nov 12, 2026
@ihsaan-ullah
ihsaan-ullah force-pushed the competition_delete_cleanup branch from 6c25ece to 103e5cd Compare November 13, 2026 20:47
@ihsaan-ullah
ihsaan-ullah force-pushed the competition_delete_cleanup branch from 103e5cd to 5cb9b9d Compare November 18, 2026 12:32
- Delete all competition data and files, not just the competition record
- Add a delete dialog showing what will be deleted
- Let organizers choose to also delete tasks and phase datasets
- Keep tasks and datasets that other competitions still use
- Only the competition creator can delete it
- Add tests for deleting and for the delete preview
- Renamed deletion.py to competition_deletion.py so its name says what it deletes
- Updated the import and the test that use it

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Cleaning data from deleted competitions

2 participants