17465: Don't repeat warnings when storage classes aren't supported.
[arvados.git] / sdk / python / arvados / keep.py
index 2f20132aecdf17ee9b8d6da2d043037508e989ce..1d4092d5599b60a7a3315b1c49c31af8661023ad 100644 (file)
@@ -840,6 +840,7 @@ class KeepClient(object):
         self.get_counter = Counter()
         self.hits_counter = Counter()
         self.misses_counter = Counter()
+        self._storage_classes_unsupported_warning = False
 
         if local_store:
             self.local_store = local_store
@@ -1253,7 +1254,9 @@ class KeepClient(object):
                 # success is determined only by successful copies.
                 #
                 # Disable storage classes tracking from this point forward.
-                _logger.warning("X-Keep-Storage-Classes header not supported by the cluster")
+                if not self._storage_classes_unsupported_warning:
+                    self._storage_classes_unsupported_warning = True
+                    _logger.warning("X-Keep-Storage-Classes header not supported by the cluster")
                 done_classes = None
                 loop.save_result(
                     (done_copies >= copies, writer_pool.total_task_nr))