Exemplo n.º 1
0
 def check_quota(self, need_time=False, need_disk=False):
     if need_time:
         if self.time_used >= self.time_quota:
             raise UsageError('Out of time quota: %s' %
                              formatting.ratio_str(formatting.duration_str, self.time_used, self.time_quota))
     if need_disk:
         if self.disk_used >= self.disk_quota:
             raise UsageError('Out of disk quota: %s' %
                              formatting.ratio_str(formatting.size_str, self.disk_used, self.disk_quota))
Exemplo n.º 2
0
 def check_quota(self, need_time=False, need_disk=False):
     if need_time:
         if self.time_used >= self.time_quota:
             raise UsageError(
                 'Out of time quota: %s' %
                 formatting.ratio_str(formatting.duration_str,
                                      self.time_used, self.time_quota))
     if need_disk:
         if self.disk_used >= self.disk_quota:
             raise UsageError(
                 'Out of disk quota: %s' % formatting.ratio_str(
                     formatting.size_str, self.disk_used, self.disk_quota))
Exemplo n.º 3
0
    def update(self, bytes_done):
        """
        Update progress display.

        :param bytes_done: Number of bytes transferred
        """
        self.f.write('\r')
        self.f.write(self.prefix)
        if self.bytes_total is None:
            self.f.write(self.format_size(bytes_done))
        else:
            self.f.write(
                ratio_str(self.format_size, bytes_done, self.bytes_total))
        speed = float(bytes_done) / (time.time() - self.start_time)
        self.f.write(' [%s/sec]' % self.format_size(speed))
        self.f.write('    \t\t\t')
        self.f.flush()
Exemplo n.º 4
0
    def update(self, bytes_done):
        """
        Update progress display.

        :param bytes_done: Number of bytes transferred
        :returns True: To resume connections for breakable
            operations like uploads
        """
        self.f.write('\r')
        self.f.write(self.prefix)
        if self.bytes_total is None:
            self.f.write(self.format_size(bytes_done))
        else:
            self.f.write(ratio_str(self.format_size, bytes_done, self.bytes_total))
        speed = float(bytes_done) / (time.time() - self.start_time)
        self.f.write(' [%s/sec]' % self.format_size(speed))
        self.f.write('    \t\t\t')
        self.f.flush()
        return True