Skip to content
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

Prevent file downloads if the disk would be full #8683

Merged

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Nov 12, 2021

Summary

  • Adds logic from the bulk channel import page into the granular content selection page
  • Displays current free disk space in the granular content selection page
  • Makes import content tasks fail if there is insufficient free disk space
  • Adds a 'minimum free disk space' option to ensure that we leave a configurable buffer
  • Sets the default to 250MB

References

Fixes #6697 but with a slight deviation from the design to allow for direct string reuse.

Reviewer guidance

Does Kolibri prevent you from downloading files that would fill up your drive?
Does Kolibri error a task if the drive fills up while downloading? (download a large file independently to fill up the space).

To help with testing this, you can use the new option:

KOLIBRI_MINIMUM_DISK_SPACE=63000000000

Will reserve 63GB of space on your disk that Kolibri will not attempt to use.

Animation of new interaction:
freespace


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@rtibbles rtibbles added the TODO: needs review Waiting for review label Nov 12, 2021
@rtibbles rtibbles added this to the 0.15.0 milestone Nov 12, 2021
@rtibbles rtibbles added the TODO: needs gherkin update Add to our manual integration tests label Nov 12, 2021
Copy link
Contributor

@indirectlylit indirectlylit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be mostly working. However, the minimum space requirement seems to only be used in the 'resource selection' import mode, not the 'channel selection' import mode.

Non-blocking issue: the error doesn't show up until something has been selected. I would expect it to show up immediately:

2021-11-15 12 21 12

Comment on lines 501 to 508
"MINIMUM_DISK_SPACE": {
"type": "integer",
"default": 250000000,
"description": """
The minimum free disk space in bytes that Kolibri should try to maintain on the device. This will
be used as the floor value to prevent Kolibri completely filling the disk during file import.
""",
},
Copy link
Contributor

@indirectlylit indirectlylit Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we define this in MB (or maybe a decimal GB) to be a bit more user-friendly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern would be the frequent confusion between GiB and GB, and the fact that these may be used differently when people are examining their local disks. Using bytes is unambiguous if somewhat verbose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth:

Windows is the only one that seems to still report base2

Comment on lines +50 to +56
<UiAlert
v-show="transferFileSize > availableSpace"
:dismissible="false"
type="error"
>
{{ spaceTranslator.$tr('notEnoughSpaceForChannelsWarning') }}
</UiAlert>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filed a follow-up issue regarding in-page errors: #8690

@indirectlylit indirectlylit added the TODO: needs user docs Requires user docs update label Nov 15, 2021
@indirectlylit
Copy link
Contributor

indirectlylit commented Nov 15, 2021

cc @radinamatic regarding user docs and gherkins

@radinamatic
Copy link
Member

@pcenov We need to add the relevant Gherkin scenario to test this in (I presume) beta3.

@rtibbles
Copy link
Member Author

Updated with the following:
Screenshot from 2021-11-15 12-19-28

Screenshot from 2021-11-15 12-15-56

Further, the specification of the minimum free space is now able to accept an integer, or a file size demoninated in B, KB, MB, GB, TB, or PB.

Copy link
Contributor

@indirectlylit indirectlylit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works great!

Minor suggestion regarding docs.

kolibri/utils/options.py Outdated Show resolved Hide resolved
kolibri/utils/options.py Outdated Show resolved Hide resolved
Co-authored-by: Devon Rueckner <[email protected]>
@rtibbles rtibbles merged commit aa4aa9a into learningequality:release-v0.15.x Nov 16, 2021
@rtibbles rtibbles deleted the no_room_at_the_inn branch November 16, 2021 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: needs gherkin update Add to our manual integration tests TODO: needs review Waiting for review TODO: needs user docs Requires user docs update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kolibri does not report to the user that disk is full during channel import.
3 participants