Skip to content

Commit

Permalink
add retry to get pod status
Browse files Browse the repository at this point in the history
  • Loading branch information
areshand committed Dec 24, 2024
1 parent a2bf54b commit f2b3234
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testsuite/replay-verify/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import json
import argparse
import sys
from tenacity import retry, stop_after_attempt, wait_fixed, retry_if_exception_type


sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))

Expand Down Expand Up @@ -251,6 +253,14 @@ def get_pod_exit_code(self):
return container_status.state.terminated.exit_code
return None

@retry(
stop=stop_after_attempt(MAX_RETRIES),
wait=wait_fixed(RETRY_DELAY),
retry=retry_if_exception_type(ApiException),
before_sleep=lambda retry_state: logger.warning(
f"Retry {retry_state.attempt_number}/{MAX_RETRIES} failed: {retry_state.outcome.exception()}"
)
)
def get_pod_status(self):
pod_status = self.client.read_namespaced_pod_status(
name=self.name, namespace=self.namespace
Expand Down

0 comments on commit f2b3234

Please sign in to comment.