Repository: epam/cloud-pipeline
Issue: Requests retrying doesn't work with S3 data storages in pipe cli

**Describe the bug**

Currently in case of some low level error (socket error) retrying won't be performed for S3 data storages.

**To Reproduce**

It's pretty hard to reproduce.

**Expected behavior**

Retrying should be performed automatically in case of any low level error.

**Environment:**
 - Version 0.16.0.7199.33c273b34df7ae62f93c2f5af6e71b63be49c6ab

**Additional context**

Add any other context about the problem here.


Changed files:
pipe-cli/src/utilities/storage/s3_proxy_utils.py, pipe-cli/src/utilities/storage/gs.py

diff --git a/pipe-cli/src/utilities/storage/gs.py b/pipe-cli/src/utilities/storage/gs.py
index 47fffe588..f525baa59 100644
--- a/pipe-cli/src/utilities/storage/gs.py
+++ b/pipe-cli/src/utilities/storage/gs.py
@@ -16,6 +16,7 @@ import base64
 import copy
 import hashlib
 import os
+import socket
 from datetime import datetime, timedelta
 
 from requests import RequestException
@@ -683,12 +684,12 @@ class VerifiedHTTPSConnectionWithHeaders(VerifiedHTTPSConnection):
 
         if code != OK:
             self.close()
-            raise OSError("Tunnel connection failed: %d %s" % (code,
-                                                               message.strip()))
+            raise socket.error("Tunnel connection failed: %d %s" % (code,
+                                                                    message.strip()))
         while True:
             line = response.fp.readline(http_client._MAXLINE + 1)
             if len(line) > http_client._MAXLINE:
-                raise RuntimeError("header line")
+                raise http_client.LineTooLong("header line")
             if not line:
                 # for sites which EOF without sending a trailer
                 break
diff --git a/pipe-cli/src/utilities/storage/s3_proxy_utils.py b/pipe-cli/src/utilities/storage/s3_proxy_utils.py
index 851ed3946..8223a8614 100644
--- a/pipe-cli/src/utilities/storage/s3_proxy_utils.py
+++ b/pipe-cli/src/utilities/storage/s3_proxy_utils.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import socket
+
 from botocore.vendored.requests.adapters import HTTPAdapter
 from botocore.vendored.requests.packages.urllib3 import ProxyManager
 from botocore.vendored.requests.packages.urllib3.connection import VerifiedHTTPSConnection
@@ -47,12 +49,12 @@ class VerifiedHTTPSConnectionWithHeaders(VerifiedHTTPSConnection):
 
         if code != OK:
             self.close()
-            raise OSError("Tunnel connection failed: %d %s" % (code,
-                                                               message.strip()))
+            raise socket.error("Tunnel connection failed: %d %s" % (code,
+                                                                    message.strip()))
         while True:
             line = response.fp.readline(http_client._MAXLINE + 1)
             if len(line) > http_client._MAXLINE:
-                raise RuntimeError("header line")
+                raise http_client.LineTooLong("header line")
             if not line:
                 # for sites which EOF without sending a trailer
                 break