Skip to content

Commit

Permalink
Retry on 504 GATEWAY_TIMEOUT (kubeflow#395)
Browse files Browse the repository at this point in the history
* See if this fixes the test failures updating the jupyter web app
  image kubeflow/kubeflow#3254

related to kubeflow#306
related to kubeflow/kubeflow#3254
  • Loading branch information
jlewi authored and k8s-ci-robot committed May 15, 2019
1 parent 449485c commit e806976
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion py/kubeflow/testing/argo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ def log_status(workflow):
# https://github.com/kubeflow/testing/issues/147
logging.exception('KeyError: %s', e)

# TODO(jlewi):
# In python3 we can switch to using http.HttpStatusCode
UNAUTHORIZED = 401
FORBIDDEN = 403
GATEWAY_TIMEOUT = 504

def handle_retriable_exception(exception):
if (isinstance(exception, rest.ApiException) and
(exception.status == 401 or exception.status == 403)):
# UNAUTHORIZED and FORBIDDEN errors can be an indication we need to
# refresh credentials
(exception.status == UNAUTHORIZED or exception.status == FORBIDDEN or
exception.status == GATEWAY_TIMEOUT)):
# Due to https://github.com/kubernetes-client/python-base/issues/59,
# we need to reload the kube config (which refreshes the GCP token).
# TODO(richardsliu): Remove this workaround when the k8s client issue
Expand Down

0 comments on commit e806976

Please sign in to comment.