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_bytes
that 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.tag
src/static/riot/analytics/_usage_history.tag
src/static/riot/analytics/_users_usage.tag
All 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
,Submission
andSubmissionDetail
After 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