コード例 #1
0
 def call(self, total_bytes_transferred, total_size):
   """Forcibly exits if the transfer has passed the halting point."""
   if total_bytes_transferred >= self._halt_at_byte:
     sys.stderr.write(
         'Halting transfer after byte %s. %s/%s transferred.\r\n' % (
             self._halt_at_byte, MakeHumanReadable(total_bytes_transferred),
             MakeHumanReadable(total_size)))
     if self._is_upload:
       raise ResumableUploadException('Artifically halting upload.')
     else:
       raise ResumableDownloadException('Artifically halting download.')
コード例 #2
0
ファイル: util.py プロジェクト: tank0226/gsutil
    def call(self, total_bytes_transferred, total_size):
        """Forcibly exits if the transfer has passed the halting point.

    Note that this function is only called when the conditions in
    gslib.progress_callback.ProgressCallbackWithTimeout.Progress are met, so
    self._halt_at_byte is only precise if it's divisible by
    gslib.progress_callback._START_BYTES_PER_CALLBACK.
    """
        if total_bytes_transferred >= self._halt_at_byte:
            sys.stderr.write(
                'Halting transfer after byte %s. %s/%s transferred.\r\n' %
                (self._halt_at_byte,
                 MakeHumanReadable(total_bytes_transferred),
                 MakeHumanReadable(total_size)))
            if self._is_upload:
                raise ResumableUploadException('Artifically halting upload.')
            else:
                raise ResumableDownloadException(
                    'Artifically halting download.')