Skip to content

Commit aa5819c

Browse files
committed
[wip] try for gwdg hpc
1 parent 322ae0e commit aa5819c

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

datajoint/s3.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
from io import BytesIO
55
import minio # https://docs.minio.io/docs/python-client-api-reference
6+
import urllib3
67
import warnings
78
import uuid
89
from pathlib import Path
@@ -13,9 +14,28 @@ class Folder:
1314
"""
1415
A Folder instance manipulates a flat folder of objects within an S3-compatible object store
1516
"""
16-
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, **_):
17-
self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
18-
secure=secure)
17+
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, proxy_server=None, **_):
18+
# proxy_server: string, like "https://PROXYSERVER:PROXYPORT/"
19+
# self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
20+
# secure=secure)
21+
# TODO implement proxy_server argument
22+
http_client = urllib3.ProxyManager(
23+
"http://www-cache.gwdg.de:3128",
24+
timeout=urllib3.Timeout.DEFAULT_TIMEOUT,
25+
cert_reqs="CERT_REQUIRED",
26+
retries=urllib3.Retry(
27+
total=5,
28+
backoff_factor=0.2,
29+
status_forcelist=[500, 502, 503, 504],
30+
)
31+
)
32+
self.client = minio.Minio(
33+
endpoint,
34+
access_key=access_key,
35+
secret_key=secret_key,
36+
secure=secure,
37+
http_client=http_client,
38+
)
1939
self.bucket = bucket
2040
if not self.client.bucket_exists(bucket):
2141
raise errors.BucketInaccessible('Inaccessible s3 bucket %s' % bucket) from None

0 commit comments

Comments
 (0)