A transfer manager interface for Amazon S3 :param client: Client to be used by the manager :param config: TransferConfig to associate specific configurations :param osutil: OSUtils object to use for os-related behavior when using with transfer manager. :
(self, client, config=None, osutil=None, executor_cls=None)
| 229 | } |
| 230 | |
| 231 | def __init__(self, client, config=None, osutil=None, executor_cls=None): |
| 232 | """A transfer manager interface for Amazon S3 |
| 233 | |
| 234 | :param client: Client to be used by the manager |
| 235 | :param config: TransferConfig to associate specific configurations |
| 236 | :param osutil: OSUtils object to use for os-related behavior when |
| 237 | using with transfer manager. |
| 238 | |
| 239 | :type executor_cls: s3transfer.futures.BaseExecutor |
| 240 | :param executor_cls: The class of executor to use with the transfer |
| 241 | manager. By default, concurrent.futures.ThreadPoolExecutor is used. |
| 242 | """ |
| 243 | self._client = client |
| 244 | self._config = config |
| 245 | if config is None: |
| 246 | self._config = TransferConfig() |
| 247 | self._osutil = osutil |
| 248 | if osutil is None: |
| 249 | self._osutil = OSUtils() |
| 250 | self._coordinator_controller = TransferCoordinatorController() |
| 251 | # A counter to create unique id's for each transfer submitted. |
| 252 | self._id_counter = 0 |
| 253 | |
| 254 | # The executor responsible for making S3 API transfer requests |
| 255 | self._request_executor = BoundedExecutor( |
| 256 | max_size=self._config.max_request_queue_size, |
| 257 | max_num_threads=self._config.max_request_concurrency, |
| 258 | tag_semaphores={ |
| 259 | IN_MEMORY_UPLOAD_TAG: TaskSemaphore( |
| 260 | self._config.max_in_memory_upload_chunks |
| 261 | ), |
| 262 | IN_MEMORY_DOWNLOAD_TAG: SlidingWindowSemaphore( |
| 263 | self._config.max_in_memory_download_chunks |
| 264 | ), |
| 265 | }, |
| 266 | executor_cls=executor_cls, |
| 267 | ) |
| 268 | |
| 269 | # The executor responsible for submitting the necessary tasks to |
| 270 | # perform the desired transfer |
| 271 | self._submission_executor = BoundedExecutor( |
| 272 | max_size=self._config.max_submission_queue_size, |
| 273 | max_num_threads=self._config.max_submission_concurrency, |
| 274 | executor_cls=executor_cls, |
| 275 | ) |
| 276 | |
| 277 | # There is one thread available for writing to disk. It will handle |
| 278 | # downloads for all files. |
| 279 | self._io_executor = BoundedExecutor( |
| 280 | max_size=self._config.max_io_queue_size, |
| 281 | max_num_threads=1, |
| 282 | executor_cls=executor_cls, |
| 283 | ) |
| 284 | |
| 285 | # The component responsible for limiting bandwidth usage if it |
| 286 | # is configured. |
| 287 | self._bandwidth_limiter = None |
| 288 | if self._config.max_bandwidth is not None: |
nothing calls this directly
no test coverage detected