Skip to content

Commit 5825f23

Browse files
authored
rm cache enhancements (#118)
* rm cache enhancements * add rm cache tests' * add return
1 parent ae5b2ab commit 5825f23

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/test-mlc-core-actions.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ jobs:
241241
run: |
242242
mlc pull repo mlcommons@mlperf-automations --checkout=dev
243243
244+
- name: Test for rm cache - invalid cache entry tags(test succeeds if command fails)
245+
run: |
246+
! mlc rm cache --tags=sample,invalid,tags
247+
248+
- name: Test for rm cache when the cache folder is empty(only for mlc rm cache without specifying particular script)
249+
run: |
250+
mlc rm cache -f
251+
mlc rm cache -f
252+
244253
- name: Run tests from test-mlc-access.py
245254
run: |
246255
cd .github/scripts && python -c "import test_mlc_access as test; test.run_tests()"

mlc/action.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,12 @@ def rm(self, i):
337337
return res
338338

339339
if len(res['list']) == 0:
340-
return {'return': 16, 'error': f'No {target_name} found for {inp}'}
340+
# Do not error out if fetch_all is used
341+
if inp["fetch_all"] == True:
342+
logger.warning(f"{target_name} is empty! nothing to be cleared!")
343+
return {"return": 0}
344+
else:
345+
return {'return': 16, 'error': f'No {target_name} found for {inp}'}
341346
elif len(res['list']) > 1:
342347
logger.info(f"More than 1 {target_name} found for {inp}:")
343348
if not i.get('all'):

0 commit comments

Comments
 (0)