Ejemplo n.º 1
0
    def do_work_hook(self):
        if 'content_md5' in self.multipart_kwargs:
            self.multipart_kwargs.pop('content_md5')

        self.multipart_kwargs['part_size'] = self.part_size
        ma = PooledMultipartObjectAssembler(self.object_storage_client,
                                            self.namespace_name,
                                            self.bucket_name, self.object_name,
                                            self.object_storage_request_pool,
                                            **self.multipart_kwargs)

        ma.new_upload()

        # max_attempts retries - with exponential sleep time and a max wait of 60 secs.
        retry_strategy = RetryStrategyBuilder(retry_max_wait_between_calls_seconds=60).add_max_attempts(self.max_retries)\
            .no_total_elapsed_time() \
            .add_service_error_check() \
            .get_retry_strategy()

        ma.add_parts_from_file(self.file_path)
        if self.multipart_part_completion_callback:
            ma.upload(
                progress_callback=self.multipart_part_completion_callback)
        else:
            ma.upload(retry_strategy=retry_strategy)
        response = ma.commit()

        multipart_hash = cli_util.verify_checksum(
            self.file_path, no_multipart=False,
            ma=ma) if self.verify_checksum else None
        return response, multipart_hash
Ejemplo n.º 2
0
    def do_work_hook(self):
        if 'content_md5' in self.multipart_kwargs:
            self.multipart_kwargs.pop('content_md5')

        self.multipart_kwargs['part_size'] = self.part_size
        ma = PooledMultipartObjectAssembler(self.object_storage_client, self.namespace_name, self.bucket_name, self.object_name, self.object_storage_request_pool, **self.multipart_kwargs)

        ma.new_upload()
        ma.add_parts_from_file(self.file_path)
        if self.multipart_part_completion_callback:
            ma.upload(progress_callback=self.multipart_part_completion_callback)
        else:
            ma.upload()
        response = ma.commit()

        multipart_hash = cli_util.verify_checksum(self.file_path, no_multipart=False, ma=ma) if self.verify_checksum else None
        return response, multipart_hash
Ejemplo n.º 3
0
 def do_work_hook(self):
     multipart_hash = cli_util.verify_checksum(
         self.file_path, no_multipart=True,
         ma=None) if self.verify_checksum else None
     return self._make_retrying_upload_file_call(), multipart_hash