-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(client): adapt session storage to repository #3058
Conversation
You can access the deployment of this PR at https://renku-ci-ui-3058.dev.renku.ch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very good!
I think the code that computes the storage size to request would benefit from a few test cases in the repo, but that is the only thing that needs to be added.
const { minimumStorageGb, recommendedStorageGb } = | ||
checkStorage({ lfsAutoFetch, statistics }) ?? {}; | ||
const clampedRecommended = recommendedStorageGb | ||
? validateStorageAmount({ | ||
value: recommendedStorageGb, | ||
maxValue: currentSessionClass.max_storage, | ||
}) | ||
: null; | ||
const requestedStorage = | ||
clampedRecommended && | ||
minimumStorageGb && | ||
clampedRecommended > currentSessionClass.default_storage && | ||
clampedRecommended > minimumStorageGb | ||
? clampedRecommended | ||
: minimumStorageGb && | ||
minimumStorageGb > currentSessionClass.default_storage | ||
? minimumStorageGb | ||
: currentSessionClass.default_storage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: extract this logic into a utility function in the sessionOptions.utils.ts
file. That would allow writing a test for it; I think I understand the logic here, but a few test cases would greatly help clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9bbc1e2.
Co-authored-by: Chandrasekhar Ramakrishnan <ciyer@users.noreply.github.com>
Done in 9bbc1e2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding those refactoring and adding the tests! 🚀
Tearing down the temporary RenkuLab deplyoment for this PR. |
Fixes #3057.
Adds storage size computation based on GitLab statistics when starting a session.
minimumStorage
isrepository_size
orrepository_size + 2 x lfs_objects_size
if LFS auto-fetch is enabledrecommendedStorage
isminimumStorage + lfs_objects_size + 1GB
orminimumStorage + 1GB
if LFS auto-fetch is enabledAll sizes are rounded up to the next gigabytes and we use powers of 10 to go from bytes to GB.
The
recommendedStorage
is used as a default value andminimumStorage
is used to interrupt the auto-start session flow and to filter session classes.Note that statistics are available only to project members, so starting sessions on public projects could still lead to session start issues.
/deploy