How to use the ara.utils.fast_count function in ara

To help you get started, we’ve selected a few ara examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ansible-community / ara / ara / views / about.py View on Github external
hosts = hosts.filter(models.Host.playbook_id.in_(override))
        playbooks = playbooks.filter(models.Playbook.id.in_(override))
        records = records.filter(models.Data.playbook_id.in_(override))
        tasks = tasks.filter(models.Task.playbook_id.in_(override))
        results = (results
                   .join(models.Task)
                   .filter(models.Task.playbook_id.in_(override)))

    return render_template(
        'about.html',
        active='about',
        files=fast_count(files),
        hosts=fast_count(hosts),
        facts=fast_count(facts),
        playbooks=fast_count(playbooks),
        records=fast_count(records),
        tasks=fast_count(tasks),
        results=fast_count(results)
    )
github dmsimard / ara-archive / ara / views / about.py View on Github external
task_results = (models.TaskResult.query
                        .join(models.Task)
                        .filter(models.Task.playbook_id.in_(override)))
    else:
        files = models.File.query
        host_facts = models.HostFacts.query
        hosts = models.Host.query
        playbooks = models.Playbook.query
        records = models.Data.query
        tasks = models.Task.query
        task_results = models.TaskResult.query

    return render_template('about.html',
                           active='about',
                           files=fast_count(files),
                           host_facts=fast_count(host_facts),
                           hosts=fast_count(hosts),
                           playbooks=fast_count(playbooks),
                           records=fast_count(records),
                           tasks=fast_count(tasks),
                           task_results=fast_count(task_results))
github dmsimard / ara-archive / ara / views / about.py View on Github external
.filter(models.Task.playbook_id.in_(override)))
    else:
        files = models.File.query
        host_facts = models.HostFacts.query
        hosts = models.Host.query
        playbooks = models.Playbook.query
        records = models.Data.query
        tasks = models.Task.query
        task_results = models.TaskResult.query

    return render_template('about.html',
                           active='about',
                           files=fast_count(files),
                           host_facts=fast_count(host_facts),
                           hosts=fast_count(hosts),
                           playbooks=fast_count(playbooks),
                           records=fast_count(records),
                           tasks=fast_count(tasks),
                           task_results=fast_count(task_results))
github dmsimard / ara-archive / ara / views / about.py View on Github external
else:
        files = models.File.query
        host_facts = models.HostFacts.query
        hosts = models.Host.query
        playbooks = models.Playbook.query
        records = models.Data.query
        tasks = models.Task.query
        task_results = models.TaskResult.query

    return render_template('about.html',
                           active='about',
                           files=fast_count(files),
                           host_facts=fast_count(host_facts),
                           hosts=fast_count(hosts),
                           playbooks=fast_count(playbooks),
                           records=fast_count(records),
                           tasks=fast_count(tasks),
                           task_results=fast_count(task_results))
github ansible-community / ara / ara / filters.py View on Github external
def jinja_fast_count(query):
        return fast_count(query)
github ansible-community / ara / ara / views / reports.py View on Github external
def ajax_records(playbook):
    records = (models.Data.query
               .filter(models.Data.playbook_id == playbook))
    if not utils.fast_count(records):
        abort(404)

    jinja = current_app.jinja_env
    record_key = jinja.get_template('ajax/record_key.html')
    record_value = jinja.get_template('ajax/record_value.html')

    results = dict()
    results['data'] = list()

    log.debug('Loading records')
    for record in records:
        key = record_key.render(record=record)
        value = record_value.render(record=record)

        results['data'].append([key, value])
github ansible-community / ara / ara / views / about.py View on Github external
.join(models.Host)
                 .filter(models.Host.playbook_id.in_(override)))
        hosts = hosts.filter(models.Host.playbook_id.in_(override))
        playbooks = playbooks.filter(models.Playbook.id.in_(override))
        records = records.filter(models.Data.playbook_id.in_(override))
        tasks = tasks.filter(models.Task.playbook_id.in_(override))
        results = (results
                   .join(models.Task)
                   .filter(models.Task.playbook_id.in_(override)))

    return render_template(
        'about.html',
        active='about',
        files=fast_count(files),
        hosts=fast_count(hosts),
        facts=fast_count(facts),
        playbooks=fast_count(playbooks),
        records=fast_count(records),
        tasks=fast_count(tasks),
        results=fast_count(results)
    )
github ansible-community / ara / ara / views / reports.py View on Github external
def ajax_results(playbook):
    tasks_in_playbook = models.Task.query.filter(
        models.Task.playbook_id == playbook)
    if not utils.fast_count(tasks_in_playbook):
        abort(404)

    jinja = current_app.jinja_env
    time = jinja.from_string('{{ time | timefmt }}')
    action_link = jinja.get_template('ajax/action.html')
    name_cell = jinja.get_template('ajax/task_name.html')
    task_status_link = jinja.get_template('ajax/task_status.html')

    results = dict()
    results['data'] = list()

    log.debug('Loading results')
    for task in tasks_in_playbook:
        task_results = task.task_results
        for result in task_results:
            name = name_cell.render(tags=result.task.tags,
github ansible-community / ara / ara / webapp.py View on Github external
def jinja_fast_count(query):
        return fast_count(query)
github dmsimard / ara-archive / ara / views / reports.py View on Github external
def ajax_plays(playbook):
    plays = (models.Play.query
             .filter(models.Play.playbook_id.in_([playbook])))
    if not utils.fast_count(plays):
        abort(404)

    jinja = current_app.jinja_env
    date = jinja.from_string('{{ date | datefmt }}')
    time = jinja.from_string('{{ time | timefmt }}')

    results = dict()
    results['data'] = list()

    for play in plays:
        name = u"<span class="pull-left">{0}</span>".format(play.name)
        start = date.render(date=play.time_start)
        end = date.render(date=play.time_end)
        duration = time.render(time=play.duration)
        results['data'].append([name, start, end, duration])