Skip to content

Commit

Permalink
Add note on concurrent usage of Minio client (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
donatello authored Feb 1, 2020
1 parent a146562 commit 656ab72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ minioClient = Minio('play.min.io',
secure=True)
```

**NOTE on concurrent usage:** The `Minio` object is thread safe when using the Python `threading` library. Specifically, it is **NOT** safe to share it between multiple processes, for example when using `multiprocessing.Pool`. The solution is simply to create a new `Minio` object in each process, and not share it between processes.


## Quick Start Example - File Uploader
This example program connects to a MinIO object storage server, makes a bucket on the server and then uploads a file to the bucket.
Expand Down
2 changes: 2 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ __Parameters__
| `region` |_string_ | Set this value to override automatic bucket location discovery. (Optional defaults to `None`). |
| `http_client` |_urllib3.poolmanager.PoolManager_ | Set this value to use custom http client instead of using default http client. (Optional defaults to `None`) |

**NOTE on concurrent usage:** The `Minio` object is thread safe when using the Python `threading` library. Specifically, it is **NOT** safe to share it between multiple processes, for example when using `multiprocessing.Pool`. The solution is simply to create a new `Minio` object in each process, and not share it between processes.

__Example__

### MinIO
Expand Down
7 changes: 7 additions & 0 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ class Minio(object):
:param timeout: Set this value to control how long requests
are allowed to run before being aborted.
:return: :class:`Minio <Minio>` object
**NOTE on concurrent usage:** The `Minio` object is thread safe when using
the Python `threading` library. Specifically, it is **NOT** safe to share
it between multiple processes, for example when using
`multiprocessing.Pool`. The solution is simply to create a new `Minio`
object in each process, and not share it between processes.
"""
def __init__(self, endpoint, access_key=None,
secret_key=None,
Expand Down

0 comments on commit 656ab72

Please sign in to comment.