Skip to content

Commit 7f4f593

Browse files
committed
added retry mechanism for post requests
1 parent 5cdf487 commit 7f4f593

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pipeline.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ def make_request(self, method: str, endpoint: str, **kwargs):
8787
except ValueError:
8888
return response.text
8989

90+
@retry(
91+
retry=retry_if_exception_type((RequestException, Timeout, HTTPError)),
92+
wait=wait_exponential(multiplier=1, min=2, max=10),
93+
stop=stop_after_attempt(2),
94+
reraise=True
95+
)
9096
def post_request(self, endpoint: str, **kwargs):
9197
url = f"{self.api_base}{endpoint}"
9298
response = requests.request("POST", url, headers=self.headers, timeout=30, **kwargs)
@@ -173,7 +179,7 @@ def _get_workflow_status(self, workflow_id: int) -> dict:
173179
"""
174180
1. Get workflow details for a given workflow id.
175181
2. Check for errored jobs
176-
3. return total jobs (finished + errored + cancelled)
182+
3. return total jobs (finished + errored + canceled)
177183
"""
178184
finished_jobs = 0
179185
errored_jobs = 0

0 commit comments

Comments
 (0)