[ARVADOS] created: 6a5cfd533c78824f65a9cf91e722570278d955e7
git at public.curoverse.com
git at public.curoverse.com
Thu Oct 22 10:48:24 EDT 2015
at 6a5cfd533c78824f65a9cf91e722570278d955e7 (commit)
commit 6a5cfd533c78824f65a9cf91e722570278d955e7
Author: Brett Smith <brett at curoverse.com>
Date: Wed Oct 21 12:35:45 2015 -0400
7587: PySDK retries socket.error exceptions from API requests.
diff --git a/sdk/python/arvados/api.py b/sdk/python/arvados/api.py
index 086487a..02ecb9c 100644
--- a/sdk/python/arvados/api.py
+++ b/sdk/python/arvados/api.py
@@ -4,6 +4,7 @@ import json
import logging
import os
import re
+import socket
import types
import apiclient
@@ -60,6 +61,15 @@ def _intercept_http_request(self, uri, **kwargs):
# previous call did not succeed, so this is slightly
# risky.
return self.orig_http_request(uri, **kwargs)
+ except socket.error:
+ # This is the one case where httplib2 doesn't close the
+ # underlying connection first. Close all open connections,
+ # expecting this object only has the one connection to the API
+ # server. This is safe because httplib2 reopens connections when
+ # needed.
+ for conn in self.connections.itervalues():
+ conn.close()
+ return self.orig_http_request(uri, **kwargs)
def _patch_http_request(http, api_token):
http.arvados_api_token = api_token
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list