<commit_before>import os

from functools import partial

import click

from flask import Flask

from dadd import server

app = Flask(__name__)
app.config.from_object('dadd.worker.settings')


import dadd.worker.handlers  # noqa


@click.command()
@click.pass_context
def run(ctx):
    if os.environ.get('DEBUG') or (ctx.obj and ctx.obj.get('DEBUG')):
        app.debug = True

    if ctx.obj:
        app.config.update(ctx.obj)

    register = partial(dadd.worker.handlers.register,
                       app.config['HOST'],
                       app.config['PORT'])

    server.monitor('Dadd_Heartbeat', register, 2)
    server.mount(app, '/')
    server.run(app.config)<commit_msg>Allow worker to use APP_SETTINGS_YAML correctly.<commit_after>from functools import partial

import click

from flask import Flask

from dadd import server
from dadd.master.utils import update_config

app = Flask(__name__)
app.config.from_object('dadd.worker.settings')


import dadd.worker.handlers  # noqa


@click.command()
@click.pass_context
def run(ctx):
    if ctx.obj:
        app.config.update(ctx.obj)

    update_config(app)

    register = partial(dadd.worker.handlers.register,
                       app.config['HOST'],
                       app.config['PORT'])

    server.monitor('Dadd_Heartbeat', register, 2)
    server.mount(app, '/')
    server.run(app.config)
{'fraction_non_alphanumeric': 0.11786237188872621, 'fraction_numerical': 0.0014641288433382138, 'mean_word_length': 2.997076023391813, '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': '3271398', 'n_tokens_mistral': 447, 'n_tokens_neox': 425, 'n_words': 91}