diff options
author | Manoj Gupta <manojgupta@google.com> | 2017-12-27 10:57:17 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-27 12:53:48 -0800 |
commit | ff047088d86129fff0d5ce35ea213b20746e02f4 (patch) | |
tree | dddfbc9636be15581ddbae7c54c76ea0ee1393e3 /auto_delete_nightly_test_data.py | |
parent | 14b834382e7cac8ec20e784e20998f4e07ad3156 (diff) | |
download | toolchain-utils-ff047088d86129fff0d5ce35ea213b20746e02f4.tar.gz |
crosperf: Cleanup files downloaded with -tryjob suffix.
Add -tryjob suffix to cleanup list. Also remove whole directory
not accessed in last day instead of trying to delete individual
files/directories. This makes it easier to see only the preserved
directories later on.
+ Minor tc_format related changes.
BUG=None
TEST=Directories to be deleted show up in dry run.y
Change-Id: I711a8d9200686be56fb4f081682d76207dea368b
Reviewed-on: https://chromium-review.googlesource.com/844897
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Diffstat (limited to 'auto_delete_nightly_test_data.py')
-rwxr-xr-x | auto_delete_nightly_test_data.py | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py index 1d9853af..4f91b042 100755 --- a/auto_delete_nightly_test_data.py +++ b/auto_delete_nightly_test_data.py @@ -127,33 +127,9 @@ def CleanChromeOsImageFiles(chroot_tmp, subdir_suffix, days_to_preserve, rv2 = 0 ce = command_executer.GetCommandExecuter() minutes = 1440 * days_to_preserve - # Clean image tar files, which were last accessed 1 hour ago and clean image - # bin files that were last accessed more than specified time. - cmd = ('find {0}/*{1} -type f ' - r'\( -name "chromiumos_test_image.tar" -amin +60 -o ' - r' -name "chromiumos_test_image.tar.xz" -amin +60 -o ' - r' -name "chromiumos_test_image.bin" -amin +{2} \) ' - r'-exec bash -c "echo rm -f {{}}" \; ' - r'-exec bash -c "rm -f {{}}" \;').format(chroot_tmp, subdir_suffix, - minutes) - - if dry_run: - print('Going to execute:\n%s' % cmd) - else: - rv2 = ce.RunCommand(cmd, print_to_console=False) - if rv2 == 0: - print('Successfully cleaned chromeos images from ' - '"{0}/*{1}".'.format(chroot_tmp, subdir_suffix)) - else: - print('Some chromeos images were not removed from ' - '"{0}/*{1}".'.format(chroot_tmp, subdir_suffix)) - - rv += rv2 - - # Clean autotest files that were last accessed more than specified time. + # Clean files that were last accessed more than the specified time. rv2 = 0 - cmd = (r'find {0}/*{1} -maxdepth 2 -type d ' - r'\( -name "autotest_files" \) ' + cmd = (r'find {0}/*{1}/* -maxdepth 1 -type d ' r'-amin +{2} ' r'-exec bash -c "echo rm -fr {{}}" \; ' r'-exec bash -c "rm -fr {{}}" \;').format(chroot_tmp, subdir_suffix, @@ -179,6 +155,9 @@ def CleanChromeOsTmpAndImages(days_to_preserve=1, dry_run=False): 'chroot', 'tmp') # Clean files in tmp directory rv = CleanChromeOsTmpFiles(chromeos_chroot_tmp, days_to_preserve, dry_run) + # Clean image files in *-tryjob directories + rv += CleanChromeOsImageFiles(chromeos_chroot_tmp, '-tryjob', + days_to_preserve, dry_run) # Clean image files in *-release directories rv += CleanChromeOsImageFiles(chromeos_chroot_tmp, '-release', days_to_preserve, dry_run) |