<commit_before># -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA


def default_config(config):
    """
    Provide default configuration for Celery
    """
    ## Broker settings
    ## ---------------
    config.setdefault("BROKER_URL", "redis://localhost:6379/1")

    # Extra modules with tasks which should be loaded
    # The Invenio Celery loader automatically takes care of loading tasks
    # defined in *_tasks.py files in 'invenio' package.
    config.setdefault("CELERY_INCLUDE", [
        #"invenio.celery.tasks",
        #"invenio.modules.workflows.workers.worker_celery",
    ])

    ## Result backend
    ## --------------
    config.setdefault("CELERY_RESULT_BACKEND", "redis://localhost:6379/1")
    config.setdefault("CELERY_RESULT_SERIALIZER", "pickle")

    ## Routing
    ## -------
    # ...

    ## Task execution
    ## --------------
    config.setdefault("CELERY_ALWAYS_EAGER", False)
    config.setdefault("CELERY_IGNORE_RESULT", False)
    config.setdefault("CELERY_TASK_SERIALIZER", "pickle")

    ## Worker
    ## ------
    config.setdefault("CELERYD_MAX_TASKS_PER_CHILD", 1000)

    ## Error emails
    ## ------------
    config.setdefault("CELERY_SEND_TASK_ERROR_EMAILS", False)

    if "CFG_SITE_EMERGENCY_EMAIL_ADDRESSES" in config:
        try:
            ADMINS = [
                ('', x.strip()) for x in
                config["CFG_SITE_EMERGENCY_EMAIL_ADDRESSES"]['*'].split(",")
            ]<commit_msg>celery: msgpack serialization usage<commit_after># -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA


def default_config(config):
    """
    Provide default configuration for Celery
    """
    ## Broker settings
    ## ---------------
    config.setdefault("BROKER_URL", "amqp://guest:guest@localhost:5672//")

    # Extra modules with tasks which should be loaded
    # The Invenio Celery loader automatically takes care of loading tasks
    # defined in *_tasks.py files in 'invenio' package.
    config.setdefault("CELERY_INCLUDE", [
        #"invenio.celery.tasks",
        #"invenio.modules.workflows.workers.worker_celery",
    ])

    ## Result backend
    ## --------------
    config.setdefault("CELERY_RESULT_BACKEND", "amqp://guest:guest@localhost:5672//")
    config.setdefault("CELERY_RESULT_SERIALIZER", "msgpack")

    ## Routing
    ## -------
    # ...

    ## Task execution
    ## --------------
    config.setdefault("CELERY_ALWAYS_EAGER", False)
    config.setdefault("CELERY_IGNORE_RESULT", False)
    config.setdefault("CELERY_TASK_SERIALIZER", "msgpack")

    ## Worker
    ## ------
    config.setdefault("CELERYD_MAX_TASKS_PER_CHILD", 1000)

    ## Error emails
    ## ------------
    config.setdefault("CELERY_SEND_TASK_ERROR_EMAILS", False)

    if "CFG_SITE_EMERGENCY_EMAIL_ADDRESSES" in config:
        try:
            ADMINS = [
                ('', x.strip()) for x in
                config["CFG_SITE_EMERGENCY_EMAIL_ADDRESSES"]['*'].split(",")
            ]
{'fraction_non_alphanumeric': 0.13829787234042554, 'fraction_numerical': 0.014938886373924853, 'mean_word_length': 2.9037102473498235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2385805', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1310, 'n_words': 393}