<commit_before>import os
import logging

from rtrss.basedaemon import BaseDaemon
from rtrss import util


_logger = logging.getLogger(__name__)


class WorkerDaemon(BaseDaemon):
    def run(self):
        _logger.info('Daemon started with pid %d', os.getpid())

        util.init_newrelic_agent()
        util.setup_logging('daemon')
        util.setup_logentries_logging('LOGENTRIES_TOKEN_WORKER')

        from rtrss.worker import worker_action
        worker_action('run')

        _logger.info('Daemon is done and exiting')

    def start(self):
        _logger.info('Starting daemon')
        super(WorkerDaemon, self).start()

    def stop(self):
        _logger.info('Stopping daemon')
        super(WorkerDaemon, self).stop()

    def restart(self):
        _logger.info('Restarting daemon')
        super(WorkerDaemon, self).restart()


def make_daemon(cfg):
    """Returns WorkerDaemon instance"""<commit_msg>Do not initialize worker when run as a daemon<commit_after>import os
import logging

from rtrss.basedaemon import BaseDaemon
from rtrss import util, config, scheduler


_logger = logging.getLogger(__name__)


class WorkerDaemon(BaseDaemon):
    def run(self):
        _logger.info('Daemon started with pid %d', os.getpid())

        util.init_newrelic_agent()
        util.setup_logging('daemon')
        util.setup_logentries_logging('LOGENTRIES_TOKEN_WORKER')

        sched = scheduler.Scheduler(config)
        return sched.run()

        _logger.info('Daemon is done and exiting')

    def start(self):
        _logger.info('Starting daemon')
        super(WorkerDaemon, self).start()

    def stop(self):
        _logger.info('Stopping daemon')
        super(WorkerDaemon, self).stop()

    def restart(self):
        _logger.info('Restarting daemon')
        super(WorkerDaemon, self).restart()


def make_daemon(cfg):
    """Returns WorkerDaemon instance"""
{'fraction_non_alphanumeric': 0.10615711252653928, 'fraction_numerical': 0.0, 'mean_word_length': 3.323394495412844, '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': '6047347', 'n_tokens_mistral': 590, 'n_tokens_neox': 569, 'n_words': 128}