def run_celery(study, run_mode=None):
    """
    Run the given MerlinStudy object. If the run mode is set to "local"
    configure Celery to run locally (without workers).
    """
    from merlin.celery import app
    from merlin.common.tasks import queue_merlin_study
    adapter_config = study.get_adapter_config(override_type='local')
    if run_mode == 'local':
        app.conf.task_always_eager = True
        app.conf.task_eager_propogates = True
    else:
        app.connection().connect()
    queue_merlin_study(study, adapter_config)
