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

Add support for removing remote files when no longer needed #1126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JoshuaWatt
Copy link
Contributor

Description
Files controlled with ManagedFile can sometimes be quite large and consume a large amount of space on the exporter, potentially causing it to run out and fail tests. In these cases, it is preferred to transfer the files every time they are needed instead of keeping them around in the cache.

This adds a new cleanup API to ManagedFile to allow the remote file to be cleaned up manually when no longer required. The FlashScriptDriver has been extended to support this new API as well

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

Adds a cleanup_resource() procedure to ManagedFile that removes the file
if it is remote. In addition, a context manager has been added to make
using the class easier:

    mf = ManagedFile(path, device)
    with mf.remote_path(cleanup=True) as path:
        # Use path as the remote path here

    # File will be removed from the remote here

Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
Adds a cleanup parameter to the flashscriptdriver that removes the file
when flashing is complete

Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
The HTTPVideoDriver was accidentally put in the middle of the
FlashScriptDriver documentation, so move it back together

Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Patch coverage: 92.0% and no project coverage change.

Comparison is base (95f309d) 63.2% compared to head (e92b985) 63.2%.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #1126   +/-   ##
======================================
  Coverage    63.2%   63.2%           
======================================
  Files         152     152           
  Lines       11429   11449   +20     
======================================
+ Hits         7225    7243   +18     
- Misses       4204    4206    +2     
Impacted Files Coverage Δ
labgrid/util/managedfile.py 82.9% <88.2%> (+1.1%) ⬆️
labgrid/driver/flashscriptdriver.py 94.4% <100.0%> (+0.5%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Bastian-Krause
Copy link
Member

Could you explain why the tmpfiles.d suggestion in the "attention box" in the exporter docs does not work for you?

@Bastian-Krause Bastian-Krause added the needs author info Requires more information from the PR/Issue author label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs author info Requires more information from the PR/Issue author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants