dont retry on 404s for wandb agent and wandb sweep
@@ -1019,11 +1019,11 @@ class Api(object):
if project_name is None:
project_name = self.settings('project')
- # don't retry on validation errors
- def no_retry_400(e):
+ # don't retry on validation or not found errors
+ def no_retry_400_404(e):
if not isinstance(e, requests.HTTPError):
return True
- if e.response.status_code != 400:
+ if e.response.status_code not in (400, 404):
return True
body = json.loads(e.response.content)
raise UsageError(body['errors'][0]['message'])
@@ -1032,7 +1032,7 @@ class Api(object):
'host': host,
'entityName': entity,
'projectName': project_name,
- 'sweep': sweep_id}, check_retry_fn=no_retry_400)
+ 'sweep': sweep_id}, check_retry_fn=no_retry_400_404)
return response['createAgent']['agent']
def agent_heartbeat(self, agent_id, metrics, run_states):
@@ -1129,7 +1129,7 @@ class Api(object):
def no_retry_400_or_404(e):
if not isinstance(e, requests.HTTPError):
return True
- if e.response.status_code != 400 and e.response.status_code != 404:
+ if e.response.status_code not in (400, 404):
return True
body = json.loads(e.response.content)
raise UsageError(body['errors'][0]['message'])
