Skip to content

Commit 7bfa2a9

Browse files
committed
Merge branch 'master' of https://github.com/datajoint/datajoint-python into union_join_bug
2 parents 78c6568 + 543fa44 commit 7bfa2a9

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

datajoint/s3.py

Lines changed: 19 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
import logging
@@ -16,9 +17,24 @@ class Folder:
1617
"""
1718
A Folder instance manipulates a flat folder of objects within an S3-compatible object store
1819
"""
19-
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, **_):
20-
self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
21-
secure=secure)
20+
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False,
21+
proxy_server=None, **_):
22+
# from https://docs.min.io/docs/python-client-api-reference
23+
self.client = minio.Minio(
24+
endpoint,
25+
access_key=access_key,
26+
secret_key=secret_key,
27+
secure=secure,
28+
http_client=(
29+
urllib3.ProxyManager(proxy_server,
30+
timeout=urllib3.Timeout.DEFAULT_TIMEOUT,
31+
cert_reqs="CERT_REQUIRED",
32+
retries=urllib3.Retry(total=5,
33+
backoff_factor=0.2,
34+
status_forcelist=[500, 502, 503,
35+
504]))
36+
if proxy_server else None),
37+
)
2238
self.bucket = bucket
2339
if not self.client.bucket_exists(bucket):
2440
raise errors.BucketInaccessible('Inaccessible s3 bucket %s' % bucket)

datajoint/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ def get_store_spec(self, store):
137137
spec['subfolding'] = spec.get('subfolding', DEFAULT_SUBFOLDING)
138138
spec_keys = { # REQUIRED in uppercase and allowed in lowercase
139139
'file': ('PROTOCOL', 'LOCATION', 'subfolding', 'stage'),
140-
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION', 'secure', 'subfolding', 'stage')}
140+
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION',
141+
'secure', 'subfolding', 'stage', 'proxy_server')}
141142

142143
try:
143144
spec_keys = spec_keys[spec.get('protocol', '').lower()]

0 commit comments

Comments
 (0)