<commit_before># No shebang line, this module is meant to be imported
#
# Copyright 2015 Ambient Entertainment GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
from calendar import timegm

from flask import render_template, request

from sqlalchemy import or_

from pyfarm.models.jobqueue import JobQueue
from pyfarm.models.statistics.task_event_count import TaskEventCount
from pyfarm.master.application import db


def task_events():
    with db.session.no_autoflush:
        task_event_count_query = TaskEventCount.query.order_by(
            TaskEventCount.time_start)

        jobqueue_ids = []
        no_queue = ("no_queue" in request.args and
            request.args["no_queue"].lower() == "true")
        if "queue" in request.args or no_queue:
            jobqueue_ids = request.args.getlist("q")
            jobqueue_ids = [int(x) for x in jobqueue_ids]
            if no_queue:
                task_event_count_query = task_event_count_query.filter(or_(
                    TaskEventCount.job_queue_id.in_(jobqueue_ids),
                    TaskEventCount.job_queue_id == None))
            else:
                task_event_count_query = task_event_count_query.filter(
                    TaskEventCount().job_queue_id.in_(jobqueue_ids))

        tasks_new = []
        tasks_deleted = []
        tasks_restarted = []
        tasks_failed = []
        tasks_done = []
        avg_queued = []
        avg_running = []
        avg_done = []
        avg_failed = []
        open_sample = None
        queues_in_open_sample = set()
        for sample in task_event_count_query:
            if not open_sample:
                open_sample = sample
            elif (sample.time_start >= open_sample.time_start and
                sample.time_start < open_sample.time_end):
                open_sample.num_new += sample.num_new
                open_sample.num_deleted += sample.num_deleted<commit_msg>Fix typo in job queue filter<commit_after># No shebang line, this module is meant to be imported
#
# Copyright 2015 Ambient Entertainment GmbH & Co. KG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
from calendar import timegm

from flask import render_template, request

from sqlalchemy import or_

from pyfarm.models.jobqueue import JobQueue
from pyfarm.models.statistics.task_event_count import TaskEventCount
from pyfarm.master.application import db


def task_events():
    with db.session.no_autoflush:
        task_event_count_query = TaskEventCount.query.order_by(
            TaskEventCount.time_start)

        jobqueue_ids = []
        no_queue = ("no_queue" in request.args and
            request.args["no_queue"].lower() == "true")
        if "queue" in request.args or no_queue:
            jobqueue_ids = request.args.getlist("q")
            jobqueue_ids = [int(x) for x in jobqueue_ids]
            if no_queue:
                task_event_count_query = task_event_count_query.filter(or_(
                    TaskEventCount.job_queue_id.in_(jobqueue_ids),
                    TaskEventCount.job_queue_id == None))
            else:
                task_event_count_query = task_event_count_query.filter(
                    TaskEventCount.job_queue_id.in_(jobqueue_ids))

        tasks_new = []
        tasks_deleted = []
        tasks_restarted = []
        tasks_failed = []
        tasks_done = []
        avg_queued = []
        avg_running = []
        avg_done = []
        avg_failed = []
        open_sample = None
        queues_in_open_sample = set()
        for sample in task_event_count_query:
            if not open_sample:
                open_sample = sample
            elif (sample.time_start >= open_sample.time_start and
                sample.time_start < open_sample.time_end):
                open_sample.num_new += sample.num_new
                open_sample.num_deleted += sample.num_deleted
{'fraction_non_alphanumeric': 0.07343589743589743, 'fraction_numerical': 0.003282051282051282, 'mean_word_length': 2.5436046511627906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1082755', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1344, 'n_words': 394}