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
quotas: quota unit conversion server side #296
quotas: quota unit conversion server side #296
Comments
The logic to display human-readable quotas has been already implemented in this PR. This logic should be moved to the server-side. |
I think all the use cases may be covered by returning base units by default (integers, such as 23424234234, implicitly meaning bytes), and human-friendly units on demand (strings, 7.9GB or 4.0MB). We can amend |
* Show human-friendly quota usage values (note that the deleted format functionality was ported to server-side) (closes reanahub/reana-server#296).
This part is still missing. We should rethink whether we want to allow users to specify the unit ( Current situation: Since we're now fetching this value from DB (if exists), we need to perform the conversion to transform bytes into KB, etc. which is not very nice. Ideally, we should convert to a human-readable format by default using our new function |
* Show human-friendly quota usage values (note that the deleted format functionality was ported to server-side) (closes reanahub/reana-server#296).
* Creates a quota related operations mixin to propagate quota calculation to different objects (workflows, interactive sessions...) (closes reanahub/reana-server#296).
* Shows disk usage format either in raw (bytes) or humand-friendly format (closes reanahub#296). * Remove unused marshmallow for openapi generation.
* Shows disk usage format either in raw (bytes) or humand-friendly format (closes reanahub/reana-server#296).
* Creates default resources on `app` fixture. * Clean `WorkflowResource`s on workflow teardown. * Closes reanahub/reana-server#296.
* Shows disk usage format either in raw (bytes) or humand-friendly format (closes reanahub/reana-server#296).
* Shows disk usage format either in raw (bytes) or humand-friendly format (closes reanahub#296). * Remove unused marshmallow for openapi generation.
* Shows disk usage format either in raw (bytes) or humand-friendly format (closes reanahub#296). * Remove unused marshmallow for openapi generation.
Currently, we only return quota usage numbers in canonical units.
We should provide a way of getting the quota usage in human-readable ways (inside the
/api/you
and from inside Python calls) providing the number and the unit.This feature will be used by:
/api/you
)/api/you
)To enable this change, we need to:
Disk: Rethink the implementation of REANA-Commons'
get_disk_usage
function to:Provide a default human-readable value/unit (the one that makes more sense e.g. if the usage is
54000
bytes, return54
KB and not0.054
MB).Offer a way of getting the usage in the requested unit (e.g. MB, GB etc..)
The function's current problems are:
du
which causes incompatibilities between Mac and Linux (GNUdu
and BSDdu
)block_size
param), the return value is a number. However, when no unit is required the return value is a string composed of the number and a suffix with the unit e.g.334K
Whether we continue using
du
as the underlying implementation to calculate disk usage or not is indifferent, we should meet the requirement.CPU: Implement a new function to give human-readable usage times in REANA-Commons. It should
2 days and 3 hours
)It would be great if both implementations implement a similar or even better, the same interface.
The text was updated successfully, but these errors were encountered: