def write(self, func: Callable[..., List[str]], boto3_session: boto3.Session, **func_kwargs: Any) -> None:
     """Write File."""
     if self._exec is not None:
         _utils.block_waiting_available_thread(seq=self._futures, max_workers=self._cpus)
         _logger.debug("Submitting: %s", func)
         future = self._exec.submit(
             _WriteProxy._caller,
             func=func,
             boto3_primitives=_utils.boto3_to_primitives(boto3_session=boto3_session),
             func_kwargs=func_kwargs,
         )
         self._futures.append(future)
     else:
         self._results += func(boto3_session=boto3_session, **func_kwargs)
Beispiel #2
0
 def upload(
     self,
     bucket: str,
     key: str,
     part: int,
     upload_id: str,
     data: bytes,
     boto3_session: boto3.Session,
     boto3_kwargs: Dict[str, Any],
 ) -> None:
     """Upload Part."""
     if self._exec is not None:
         _utils.block_waiting_available_thread(seq=self._futures,
                                               max_workers=self._cpus)
         future = self._exec.submit(
             _UploadProxy._caller,
             bucket=bucket,
             key=key,
             part=part,
             upload_id=upload_id,
             data=data,
             boto3_primitives=_utils.boto3_to_primitives(
                 boto3_session=boto3_session),
             boto3_kwargs=boto3_kwargs,
         )
         self._futures.append(future)
     else:
         self._results.append(
             self._caller(
                 bucket=bucket,
                 key=key,
                 part=part,
                 upload_id=upload_id,
                 data=data,
                 boto3_primitives=_utils.boto3_to_primitives(
                     boto3_session=boto3_session),
                 boto3_kwargs=boto3_kwargs,
             ))