Exemplo n.º 1
0
def createFromFilehandle(f, limitMonths=None):
    """ Returns a JobLog instance from a given filehandle
    ue - estimated_runtime_uncorrected
    ct - final_cpu_time, cpu time to finish
    fe - rsc_fpops_est, estimated flops
    et - final_elapsed_time, clock time to finish
    """
    #logger.debug('createFromFilehandle(%s, %s)', f, limitMonths)
    tasks = list()
    now = datetime.datetime.utcnow()
    for line in f:
        t = task.Task_jobLog.createFromJobLog(line)
        if limitMonths == None or util.diffMonths(t.time, now) < limitMonths:
            logger.debug('Appending from JobLog %s', t)
            tasks.append(t)
    return tasks
Exemplo n.º 2
0
    def __init__(self, tasks, limitMonths=1, minDays=15, label=''):
        """Show at least minDays, but only limitMonths months"""
        self.label = label
        self.ax = list()
        # First figure out the length:
        now = datetime.datetime.utcnow()
        time = list()
        for t in tasks:
            if abs((now - t.time).days) < minDays or util.diffMonths(t.time, now) < limitMonths:
                time.append(t.time)

        self.time = np.array(time) #self.createArray('time', dtype=datetime.datetime)
        self.N = len(self.time)

        self.estimated_runtime_uncorrected = self.createArray(tasks, 'estimated_runtime_uncorrected')
        self.final_cpu_time = self.createArray(tasks, 'final_cpu_time')
        self.final_elapsed_time = self.createArray(tasks, 'final_elapsed_time')
        self.rsc_fpops_est = self.createArray(tasks, 'rsc_fpops_est')
        self.credit = self.createArray(tasks, 'credit')
Exemplo n.º 3
0
def parse(page, limitMonths):
    """
    Returns a dictionary which should contain a list of 'when', 'up' and 'down'
    """
    tree = xml.etree.ElementTree.parse(page)
    data = defaultdict(list)
    now = datetime.datetime.utcnow()
    for d in tree.iter("dx"):
        for child in d:
            if child.tag == "when":
                item = float(child.text)
                item = datetime.datetime.fromtimestamp(item * 60 * 60 * 24)
                if limitMonths == None or util.diffMonths(item, now) < limitMonths:
                    data[child.tag].append(item)
                else:
                    break
            else:
                item = float(child.text)
                data[child.tag].append(float(item))

    for key in data:
        data[key] = np.array(data[key])

    return data