Skip to content

Feature/storage/user quota#1251

Merged
ihsaan-ullah merged 4 commits into
codalab:user-quotafrom
OhMaley:feature/storage/user-quota
Dec 14, 2023
Merged

Feature/storage/user quota#1251
ihsaan-ullah merged 4 commits into
codalab:user-quotafrom
OhMaley:feature/storage/user-quota

Conversation

@OhMaley

@OhMaley OhMaley commented Nov 29, 2023

Copy link
Copy Markdown
Collaborator

Description

This PR adds the storage quota per user feature.

It includes the following:

  • a new 'quota' field in the User model so each user has its own quota. It can, therefore, changed per a user basis
  • a global default quota variable defined in the settings of the app
  • the users' used space and quota is displayed on the resource page
  • checks has been added on every data upload (submissions, programs and bundles)
    • the front send the the file size among other metadata to the back
    • the back checks if it is ok to upload the file based on the remaining user quota
    • if not ok an error is sent back to the frontend and is displayed to the user
  • using the django admin interface you can update the quota per user

Issues this PR resolves

Part of #713

For testing

To fake the size of a file you can overwrite the line 168 of the src/static/js/ours/client.js file

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 commented Dec 13, 2023

Copy link
Copy Markdown
Collaborator

My tests

It looks like we don't have the quota branch on codabench. I have cloned Tristan's repo and chekedout the quota branch to do the test.

Admin Interface

  • ✅ Quota field is visible in the user table on admin interface
    Screenshot 2023-12-13 at 3 28 54 PM.

  • ✅ Changing the value in this field is reflected in the resource interface

  • ✅ default value is set to 15GB

Resource Interface

  • ✅ total quota and used quota is visible in the resource interface
Screenshot 2023-12-13 at 3 31 13 PM
  • ✅ Changing the user quota from admin interface is reflected in the resource interface
Screenshot 2023-12-13 at 3 31 20 PM
  • ❌ uploading new dataset/submission/program from resource interface does not refresh the quota to show updated used quota

Limit check

  • ✅ Uploading submission when the limit is reached gives error
Screenshot 2023-12-13 at 3 41 22 PM
  • ✅ Uploading dataset/program when the limit is reached gives error
Screenshot 2023-12-13 at 3 41 47 PM
  • ✅ Uploading competition when the limit is reached gives error
Screenshot 2023-12-13 at 3 42 04 PM

Manual validation (https://github.com/codalab/codabench/wiki/manual-validation)

  • Create an user account and login
  • Create a competition
  • Create a queue
  • Upload a submission
  • Check that the submission was processed (results, visualization tab, leaderboard)
  • Change/recover password
  • Delete user
    Attempted to delete user from admin interface. Failed with this error:
django.db.utils.IntegrityError: insert or update on table "tasks_task" violates foreign key constraint "tasks_task_created_by_id_1345568a_fk_profiles_user_id"
DETAIL:  Key (created_by_id)=(2) is not present in table "profiles_user".
  • Delete submission
  • Delete queue
  • Delete competition
  • Admin page
  • Look at the logs for any problematic messages (docker-compose logs -f)

Suggestions:

  1. Refresh the interface automatically when submisison/dataset is uploaded in resource interface
  2. Readable format for the quota in the user table .e.g MB

@ihsaan-ullah ihsaan-ullah marked this pull request as ready for review December 14, 2023 14:26
@ihsaan-ullah ihsaan-ullah changed the base branch from develop to user-quota December 14, 2023 15:27
@ihsaan-ullah ihsaan-ullah merged commit 9ecd29a into codalab:user-quota Dec 14, 2023
@ihsaan-ullah ihsaan-ullah mentioned this pull request Dec 14, 2023
7 tasks
@ihsaan-ullah

Copy link
Copy Markdown
Collaborator

This PR is created again to run circle ci tests.
Check #1254

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.

2 participants