WIP: Introduce new artifact subcommand `delete`
Description
This MR aims to introduce the a new bst artifact delete
subcommand.
The addition of the artifact delete
subcommand itself has been split out from !1008 (closed).
This MR adds tests to the command and further ensures that the command can handle more use-cases.
Acceptance criteria
-
Cherry-pick relevant commits of !1008 (closed) -
Handle deleting non-existent/non-present refs more gracefully -
Don't touch cascache.py API -
Ensure that we can delete artifacts that have been pulled without their buildtree -
Add tests for the extra use-cases
This MR will close #477 (closed) and partially address #773 (closed)
UPDATE: This MR is now on hold due to a decision to ensure that artifact refs are handled properly Stream.py, instead of including such logic in _frontend/cli.py.
Merge request reports
Activity
added 6 commits
- 3ba9bb50 - cli.py: Defer pruning until all specified refs are removed
- 01344f51 - tests: Add tests for the artifact delete subcommand
- 8ef1aae7 - artifactcache.py: Ensure we can determine whether both elements and artifacts are cached
- cec4364c - cli.py: Print to stderr when trying to remove a nonexistent element/artifact
- 4bbb53f0 - cli.py: Ensure that artifacts with both strong and weak cache keys are removed for element deletion
- 0e4d4175 - cascache.py: Ensure path exists before trying to update the mtime
Toggle commit listadded 9 commits
- 1894178d - cli: Split classify_artifacts helper up
- 5c74ab23 - cli: Add artifact delete subcommand
- da0755cd - artifactcache.py: Add prune() method to ArtifactCache
- dfae4333 - cli.py: Defer pruning until all specified refs are removed
- 778899bd - tests: Add new tests for bst artifact delete
- bb9c7e72 - artifactcache.py: API Cleanup - Add contains_ref() method
- f1fb622a - cli.py: Print to stderr when trying to delete an uncached artifact
- a6b6edb9 - cli.py: Ensure that both 'weak' and 'strong' artifacts are deleted
- e0ace830 - cascache.py: Ensure path exists before trying to update the mtime
Toggle commit listmentioned in issue #477 (closed)
- Resolved by James Ennis
869 869 if tree.hash in reachable: 870 870 return 871 871 872 if not os.path.exists(self.objpath(tree)): 873 return 874 872 875 if update_mtime: 873 876 os.utime(self.objpath(tree)) Catching and ignoring the exception would make this handle a race between checking it exists, something else deleting it, and updating its time better.
Theoretically it might also have better performance since system calls require context switches that exceptions might not.
In the success case you'd not need an extra syscall, and it might be better in failure too.
Lacking any profiling evidence this is all conjecture though.
changed this line in version 4 of the diff
added 78 commits
-
e0ace830...ce91ce5d - 70 commits from branch
master
- ab6740f9 - cli: Add artifact delete subcommand
- e992e41c - artifactcache.py: Add prune() method to ArtifactCache
- 1050e97c - cli.py: Defer pruning until all specified refs are removed
- cc2f2957 - tests: Add new tests for bst artifact delete
- 38a09bf3 - artifactcache.py: API Cleanup - Add contains_ref() method
- 0ca62cf4 - cli.py: Print to stderr when trying to delete an uncached artifact
- 0bdb5c11 - cli.py: Ensure that both 'weak' and 'strong' artifacts are deleted
- b8aea71b - cascache.py: Ensure path exists before trying to update the mtime
Toggle commit list-
e0ace830...ce91ce5d - 70 commits from branch
mentioned in issue #773 (closed)
Resolved by ac71ea61