def plotAll(fig, local_projects, BOINC_DIR):
    # todo: avoid duplicate in joblog
    projects = dict()
    for p in local_projects.values():
        url = Project(url=p.url)
        projects[url.name] = p

    for url, filename in util.getLocalFiles(BOINC_DIR, 'statistics', '.xml'):
        try:
            p = Project(url=url)
            project = projects[p.name]
            label = project.name
        except KeyError:
            logger.warning('Could not find url %s in %s', url, projects)
            label = url

        with open(filename, 'r') as f:
            data = parseStatistics(f, limitDays=15)
            plotStatistics(fig, data, label)
示例#2
0
def plotAll(fig1, fig2, fig3, web_projects, BOINC_DIR):
    projects = dict()
    for p in web_projects.values():
        url = Project(url=p.url)
        projects[url.name] = p

    for url, filename in util.getLocalFiles(BOINC_DIR, 'job_log', '.txt'):
        try:
            p = Project(url=url)
            project = projects[p.name]
            label = project.name
        except KeyError:
            logger.debug('WARNING: Could not find url %s in %s', url, projects)
            project = None
            label = url

        tasks = createFromFilename(filename, limitMonths=120)
        if project is not None:
            merge(tasks, project)
        # for t in  tasks:
        #     print t, getattr(t, 'credit', None)
        p_daily = Plot(tasks, limitMonths=1, label=label)
        p_daily.myPlot(fig1, p_daily.plot_points, fig2=fig2, label=label)
        p_daily.myPlot(fig1, p_daily.plot_bars_daily)

        p = Plot(tasks, limitMonths=120, label=label)
        #p.myPlot(fig3, p.plot_points, fig2=None)
        #p.myPlot(fig3, p.plot_bars_daily, month=True)
        p.myPlot(fig3, p.plot_bars_montly, label=label, month=True)

    try:
        p_daily.addAverageLine()
    except UnboundLocalError:   # no files, loop never happend
        return
    #p.addAverageLine()

    for fig in [fig1, fig2, fig3]:
        if fig != None and len(fig.axes) != 0:
            dayFormat(fig.axes[-1])#, month=month)
            addLegend(fig.axes[-1])
            for axis in fig.axes[:-1]:    # hide xlabels for all but last axis
                plt.setp(axis.get_xticklabels(), visible=False)