Exemplo n.º 1
0
    def __init__(self, project_url, project_name, name, nbytes, 
                 status, time_so_far, nbytes_xferred, is_upload):
        kwargs = dict()
        if is_upload == '1':
            state = 'uploading'
        else:                   # todo: fix, use status as well
            state = 'downloading'
        nbytes = float(nbytes)
        nbytes_xferred = float(nbytes_xferred)

        kwargs['elapsedCPUtime'] = time_so_far
        kwargs['name'] = name
        kwargs['state'] = state
        if nbytes != 0:
            kwargs['fractionDone'] = 1 - (nbytes - nbytes_xferred)/nbytes
        self.bytesDone = '{}B/{}B'.format(util.fmtSi(nbytes_xferred), 
                                        util.fmtSi(nbytes))
        self.project_url = project_url
        self.project_name = project_name
        Task.__init__(self, **kwargs)
Exemplo n.º 2
0
def setTitle(fig, up, down):
    s_up, s_down = sum(up), sum(down)
    fig.suptitle("Total upload/download = {}B/{}B".format(util.fmtSi(s_up), util.fmtSi(s_down)))
Exemplo n.º 3
0
 def memUsage_str(self):
     if self.memUsage == 0:
         return ''
     else:
         return util.fmtSi(self.memUsage) + 'B'