def main(galaxy_config, processing_config): amqp_config = read_galaxy_amqp_config(galaxy_config) config = load_config(processing_config) store_tag = config["msg_store_tag"] log_handler = create_log_handler(config, LOG_NAME) handlers = [(store_tag, store_handler(config, store_tag))] with log_handler.applicationbound(): message_reader(handlers, amqp_config)
def create_celeryconfig(task_module, dirs, config): amqp_config = utils.read_galaxy_amqp_config(config["galaxy_config"], dirs["config"]) out_file = os.path.join(dirs["work"], "celeryconfig.py") amqp_config["rabbitmq_vhost"] = config["distributed"]["rabbitmq_vhost"] amqp_config["cores"] = multiprocessing.cpu_count() amqp_config["task_import"] = task_module with open(out_file, "w") as out_handle: out_handle.write(Template(_celeryconfig_tmpl).render(**amqp_config)) try: yield out_file finally: pyc_file = "%s.pyc" % os.path.splitext(out_file)[0] for fname in [pyc_file, out_file]: if os.path.exists(fname): os.remove(fname)
def create_celeryconfig(task_module, dirs, config, config_file): amqp_config = utils.read_galaxy_amqp_config(config["galaxy_config"], dirs["config"]) if not amqp_config.has_key("host") or not amqp_config.has_key("userid"): raise ValueError("universe_wsgi.ini does not have RabbitMQ messaging details set") out_file = os.path.join(dirs["work"], "celeryconfig.py") amqp_config["rabbitmq_vhost"] = config["distributed"]["rabbitmq_vhost"] cores = config["distributed"].get("cores_per_host", 0) if cores < 1: cores = multiprocessing.cpu_count() amqp_config["cores"] = cores amqp_config["task_import"] = task_module amqp_config["config_file"] = config_file with open(out_file, "w") as out_handle: out_handle.write(Template(_celeryconfig_tmpl).render(**amqp_config)) try: yield out_file finally: pyc_file = "%s.pyc" % os.path.splitext(out_file)[0] for fname in [pyc_file, out_file]: if os.path.exists(fname): os.remove(fname)