Ejemplo n.º 1
0
def top_hosts():
    if request.is_xhr:
        table_args = __get_datatables_args()
        totalCount, filteredCount, hosts = db.get_top_hosts(**table_args)
        return render_template('top_hosts.json', table_args=table_args, count=totalCount, filtered=filteredCount, hosts=hosts)

    if request.args or 'formdata' not in session:
        session['formdata'] = request.args
    form = forms.PeriodForm(formdata=session['formdata'])
    form.validate()
    return render_template('top_hosts.html', form=form)
Ejemplo n.º 2
0
def index():
    if request.args or 'formdata' not in session:
        session['formdata'] = request.args
    form = forms.PeriodForm(formdata=session['formdata'])
    form.validate()
    start = form.get_start()
    end = form.get_end()


    raw = db.count_raw_data(start, end)
    invalid = db.count_invalid_data(start, end)
    errors = db.count_planner_errors(start, end)
    planner_stats = db.get_planner_stats(start, end)
    dagman_stats = db.get_dagman_stats(start, end)
    downloads = db.count_downloads(start, end)

    table_args = {
        "limit" : 5,
        "offset" : 0,
        "start_time" : start,
        "end_time" : end
    }
    # These count variables are just dummies to get the top_hosts and top_domains
    totalCount, filterCount, top_hosts = db.get_top_hosts(**table_args)
    totalCount, filterCount, top_domains = db.get_top_domains(**table_args)


    return render_template('index.html',
            raw=raw,
            invalid=invalid,
            planner_errors=errors,
            planner_stats=planner_stats,
            dagman_stats=dagman_stats,
            top_hosts=top_hosts,
            top_domains=top_domains,
            downloads=downloads,
            form=form)