コード例 #1
0
    def __init__(self, fp, file_size, part_size, upload, retry_count, timeout,
                 storage_session, api):
        """
        Emulates the partitioned file. Uses the upload pool attached to the
        api session to submit the file parts for uploading.

        :param fp: File descriptor.
        :param file_size: File size.
        :param part_size: Part size.
        :param upload: Upload identifier.
        :param retry_count: Number of times to retry if error happens.
        :param timeout: Timeout for storage session service.
        :param storage_session: Storage session.
        :param api: Api instance.
        """
        self.fp = fp
        self.file_size = file_size
        self.part_size = part_size
        self.upload_id = upload
        self.retry = retry_count
        self.timeout = timeout
        self.session = storage_session
        self.api = api
        self.pool = api.upload_pool
        self.submitted = 0
        self.total_submitted = 0
        self.total = total_parts(self.file_size, self.part_size)
        self.parts = self.get_parts()
コード例 #2
0
 def __init__(self, file_path, session, url, file_size, part_size, retry,
              timeout, pool):
     """
     Emulates the partitioned file. Uses the download pool attached to the
     api session to download file parts.
     :param file_path: Full path to the new file.
     :param session: Requests session.
     :param url: Resource url.
     :param file_size: Resource file size.
     :param part_size: Part size.
     :param retry: Number of times to retry on error.
     :param timeout: Session timeout.
     :param pool: Download pool.
     """
     self.url = url
     self.file_path = file_path
     self.session = session
     self.file_size = file_size
     self.part_size = part_size
     self.retry = retry
     self.timeout = timeout
     self.submitted = 0
     self.total_submitted = 0
     self.total = total_parts(self.file_size, self.part_size)
     self.pool = pool
     self.parts = self.get_parts()
コード例 #3
0
ファイル: download.py プロジェクト: sbg/sevenbridges-python
 def __init__(self, file_path, session, url, file_size, part_size, retry,
              timeout,
              pool):
     """
     Emulates the partitioned file. Uses the download pool attached to the
     api session to download file parts.
     :param file_path: Full path to the new file.
     :param session: Requests session.
     :param url: Resource url.
     :param file_size: Resource file size.
     :param part_size: Part size.
     :param retry: Number of times to retry on error.
     :param timeout: Session timeout.
     :param pool: Download pool.
     """
     self.url = url
     self.file_path = file_path
     self.session = session
     self.file_size = file_size
     self.part_size = part_size
     self.retry = retry
     self.timeout = timeout
     self.submitted = 0
     self.total_submitted = 0
     self.total = total_parts(self.file_size, self.part_size)
     self.pool = pool
     self.parts = self.get_parts()