Mforns has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/404662 )

Change subject: Make banner-actvity cleaner not fail when there's nothing to 
drop
......................................................................


Make banner-actvity cleaner not fail when there's nothing to drop

Bug: T185100
Change-Id: I706da26d05dbeeb81b90f454db1721ee220048b3
---
M bin/refinery-drop-banner-activity-partitions
1 file changed, 11 insertions(+), 8 deletions(-)

Approvals:
  Mforns: Verified; Looks good to me, approved
  Ottomata: Looks good to me, but someone else must approve
  Joal: Looks good to me, but someone else must approve



diff --git a/bin/refinery-drop-banner-activity-partitions 
b/bin/refinery-drop-banner-activity-partitions
index 890376b..ea2b3c1 100755
--- a/bin/refinery-drop-banner-activity-partitions
+++ b/bin/refinery-drop-banner-activity-partitions
@@ -120,12 +120,15 @@
                         if end_of_day_datetime < threshold_datetime:
                             paths_to_delete.append(day_path)
 
-    if dry_run:
-        logger.info('Listing {0} directories from {1} 
...'.format(len(paths_to_delete), location))
-        for path_to_delete in paths_to_delete:
-            print path_to_delete
-        logger.info('Dry run finished!')
+    if len(paths_to_delete) > 0:
+        if dry_run:
+            logger.info('Listing {0} directories from {1} 
...'.format(len(paths_to_delete), location))
+            for path_to_delete in paths_to_delete:
+                print path_to_delete
+            logger.info('Dry run finished!')
+        else:
+            logger.info('Removing {0} directories from {1} 
...'.format(len(paths_to_delete), location))
+            HdfsUtils.rm(' '.join(paths_to_delete))
+            logger.info('Done!')
     else:
-        logger.info('Removing {0} directories from {1} 
...'.format(len(paths_to_delete), location))
-        HdfsUtils.rm(' '.join(paths_to_delete))
-        logger.info('Done!')
+        logger.info('No directories need to be removed from 
{0}.'.format(location))

-- 
To view, visit https://gerrit.wikimedia.org/r/404662
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I706da26d05dbeeb81b90f454db1721ee220048b3
Gerrit-PatchSet: 1
Gerrit-Project: analytics/refinery
Gerrit-Branch: master
Gerrit-Owner: Mforns <mfo...@wikimedia.org>
Gerrit-Reviewer: Joal <j...@wikimedia.org>
Gerrit-Reviewer: Mforns <mfo...@wikimedia.org>
Gerrit-Reviewer: Ottomata <ao...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to