Skip to content

Commit

Permalink
retry Prometheus query in cluster load in case of IndexError (#3159)
Browse files Browse the repository at this point in the history
* retry Prometheus query in cluster load in case of IndexError

Signed-off-by: Elad Ben Aharon <[email protected]>

* use retry decorator

Signed-off-by: Elad Ben Aharon <[email protected]>
  • Loading branch information
ebenahar authored Oct 19, 2020
1 parent de8e546 commit 4ecb000
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ocs_ci/ocs/cluster_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from range_key_dict import RangeKeyDict

from ocs_ci.utility.retry import retry
from ocs_ci.utility.prometheus import PrometheusAPI
from ocs_ci.utility.utils import get_trim_mean
from ocs_ci.utility import templating
Expand Down Expand Up @@ -313,6 +314,7 @@ def reach_cluster_load_percentage(self):
logger.info(wrap_msg(msg))
self.target_pods_number = len(self.dc_objs)

@retry(IndexError, tries=5, delay=5, backoff=1)
def get_query(self, query, mute_logs=False):
"""
Get query from Prometheus and parse it
Expand Down

0 comments on commit 4ecb000

Please sign in to comment.