diff options
author | George Burgess IV <gbiv@google.com> | 2019-04-10 15:16:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-11 09:32:38 -0700 |
commit | d79abc97ab310b8d9cfa0ff364eb141cd57ecc0c (patch) | |
tree | b140e102ad1732fbdea36dd3d8bc3bdb78bc4dc1 /auto_delete_nightly_test_data.py | |
parent | 7a9397f6cf4d1a3b453848b3bf642674f5686bff (diff) | |
download | toolchain-utils-d79abc97ab310b8d9cfa0ff364eb141cd57ecc0c.tar.gz |
test data cleanup: also delete CrAU_* files
These are currently consuming 97GB of disk on chrotomation2, and should
probably be cleaned up regularly.
BUG=None
TEST=None
Change-Id: I85bcf38b19a75653d089baa0aa85d661b8d8dd14
Reviewed-on: https://chromium-review.googlesource.com/1562354
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'auto_delete_nightly_test_data.py')
-rwxr-xr-x | auto_delete_nightly_test_data.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/auto_delete_nightly_test_data.py b/auto_delete_nightly_test_data.py index 4f91b042..699e12a0 100755 --- a/auto_delete_nightly_test_data.py +++ b/auto_delete_nightly_test_data.py @@ -1,4 +1,10 @@ #!/usr/bin/env python2 +# -*- coding: utf-8 -*- +# +# Copyright 2019 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + """A crontab script to delete night test data.""" from __future__ import print_function @@ -21,7 +27,8 @@ DIR_BY_WEEKDAY = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun') def CleanNumberedDir(s, dry_run=False): """Deleted directories under each dated_dir.""" chromeos_dirs = [ - os.path.join(s, x) for x in os.listdir(s) + os.path.join(s, x) + for x in os.listdir(s) if misc.IsChromeOsTree(os.path.join(s, x)) ] ce = command_executer.GetCommandExecuter(log_level='none') @@ -62,7 +69,8 @@ def CleanNumberedDir(s, dry_run=False): def CleanDatedDir(dated_dir, dry_run=False): # List subdirs under dir subdirs = [ - os.path.join(dated_dir, x) for x in os.listdir(dated_dir) + os.path.join(dated_dir, x) + for x in os.listdir(dated_dir) if os.path.isdir(os.path.join(dated_dir, x)) ] all_succeeded = True @@ -104,6 +112,7 @@ def CleanChromeOsTmpFiles(chroot_tmp, days_to_preserve, dry_run): cmd = (r'find {0} -maxdepth 1 -type d ' r'\( -name "test_that_*" -amin +{1} -o ' r' -name "cros-update*" -amin +{1} -o ' + r' -name "CrAU_temp_data*" -amin +{1} -o ' r' -regex "{0}/tmp......" -amin +{1} \) ' r'-exec bash -c "echo rm -fr {{}}" \; ' r'-exec bash -c "rm -fr {{}}" \;').format(chroot_tmp, minutes) @@ -190,6 +199,7 @@ def Main(argv): os.path.join(constants.CROSTC_WORKSPACE, dated_dir), options.dry_run) else 1 + ## Finally clean temporaries, images under crostc/chromeos rv2 = CleanChromeOsTmpAndImages( int(options.days_to_preserve), options.dry_run) |