-
Notifications
You must be signed in to change notification settings - Fork 45
File Sizes cleanup #1752
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
Merged
Merged
File Sizes cleanup #1752
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
For the manual intervention, I replaced:
Is that correct? The manual intervention raises this error: if sub.file_size:
AttributeError: 'Submission' object has no attribute 'file_size'I had one more migration file after a # Generated by Django 2.2.28 on 2025-03-21 13:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('competitions', '0053_auto_20250218_1151'),
]
operations = [
migrations.AlterField(
model_name='submissiondetails',
name='file_size',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True),
),
] |
Collaborator
Author
Yes, I have updated the code in the main comment with the right var name |
Collaborator
Author
curious-broccoli
added a commit
to curious-broccoli/codabench
that referenced
this pull request
May 27, 2025
* show server error instead of fronend parsing error * show back button in edit only. Show help in create only * do not allow special chars in usernames * Enable/Disable competition forum (codalab#1774) * forum enable/disable functionality added * new forum_enabled field added to competition dump data * Email in lowercase (codalab#1769) * on signup email stored in lower case letters. Whitelist emails conveted to lowercased * whitespace removed * convert email to lowercased during login * latest competition fields added to dump (codalab#1786) Co-authored-by: Adrien Pavão <adrien.pavao@gmail.com> * User quota is updated to GB from Bytes (codalab#1749) * user assigned quota will now be in GB instead of bytes * unused counter removed * File Sizes cleanup (codalab#1752) * sizes Kib to Bytes, size formatting functions cleanup * space between size and unit, removed factor multiplication from size calcualtion * file_size to bytes in SubmissionDetail * added missing migration * migration conflict resolved * reseting file sizes task removed * Resource interface: quota unit is now GB instead of B * Create CODE_OF_CONDUCT.md * Added log rolling to limit log size to 5GB for now, can be changed * Maintenance mode option added in Caddyfile, used by creating a maintenance.on file in the maintenance_mode/ directory (codalab#1799) * Maintenance mode option added in Caddyfile, used by creating a maintenance.on file in the maintenance_mode/ directory * Add offline.png * Fixed image not loading --------- Co-authored-by: Obada Haddad <obada.haddad@lisn.fr> Co-authored-by: didayolo <adrien.pavao@gmail.com> * Update version.json for release 1.18.0 * Add remove button for cancelled submissions (codalab#1808) * Add remove button for cancelled submissions * Allow remove of cancelled submissions * Update compute_worker.py * Add permissions check for bulk download * flake8 fix * Add hide_score_output option (codalab#1838) * Add hide_score_output option * Update test * Add the options for v1 bundles * Make more generic tests (v1, v2) * version update workflow removed * Add hide_prediction_output feature * Calendar lock fixed, additional check added for start and end date * Simplify code * Version bump * Removed time and updated date to today --------- Co-authored-by: Ihsan Ullah <ihsan2131@gmail.com> Co-authored-by: Adrien Pavão <adrien.pavao@gmail.com> Co-authored-by: Obada Haddad <obada.haddad@lisn.fr> Co-authored-by: Obada Haddad-Soussac <11889208+ObadaS@users.noreply.github.com> Co-authored-by: GitHub Actions <actions@github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

@ mention of reviewers
@Didayolo
A brief description of the purpose of the changes contained in this PR.
The way of dealing with file sizes was not uniform in the platform. At some places size was stored in Bytes and in other places in KiB. This is now fixes and we store bytes in the db and use KB/MB/GB instead of KiB/MiB/GiB. The size formatter used were different at different places. Now we have one formatter named
pretty_bytesthat is declared in both javascript and python.Issues this PR resolves
Important Note
I have left some size unit conversion in the following files because there is a confusion in what is going on in these files. I cannot see any data in the analytics to match the data with code BUT once analytics start working then I will check these
src/static/riot/analytics/_competitions_usage.tagsrc/static/riot/analytics/_usage_history.tagsrc/static/riot/analytics/_users_usage.tagAll these files can be found here: https://github.com/codalab/codabench/tree/master/src/static/riot/analytics
Important Todos for deployment:
We have some critical changes here so before deployment we should run the following 3 blocks of code to get the last ids of
Data,SubmissionandSubmissionDetailAfter we have the latest ids, we should deploy and run the 3 blocks of code below to fix the sizes i.e. to convert all kib to bytes to make everything consistent. For new files uploaded after the deployment, the sizes will be saved in bytes automatically that is why we need to run the following code for older files only.
Checklist