def __start_consumer(name, exchange, target): exchange_url = mask_password_from_url(exchange.url) thread_name = "consume-%s-%s" % (name, exchange_url) thread = threading.Thread(name=thread_name, target=target) thread.daemon = False thread.start() return thread
def __init__(self, app, queue=None, task_mapping=control_message_to_task, connection=None): super(GalaxyQueueWorker, self).__init__() log.info( "Initializing %s Galaxy Queue Worker on %s", app.config.server_name, util.mask_password_from_url(app.config.amqp_internal_connection)) self.daemon = True if connection: self.connection = connection else: self.connection = app.amqp_internal_connection_obj # explicitly force connection instead of lazy-connecting the first # time it is required. self.connection.connect() self.app = app # Eventually we may want different workers w/ their own queues and task # mappings. Right now, there's only the one. if queue: # Allows assignment of a particular queue for this worker. self.control_queue = queue else: # Default to figuring out which control queue to use based on the app config. queue = galaxy.queues.control_queue_from_config(app.config) self.task_mapping = task_mapping self.declare_queues = galaxy.queues.all_control_queues_for_declare( app.config, app.application_stack)
def __start_consumer(name, exchange, target): exchange_url = mask_password_from_url(exchange.url) thread_name = "consume-%s-%s" % (name, exchange_url) thread = threading.Thread(name=thread_name, target=target) # TODO: If the shutdown code is actually called make this # not a daemon. thread.daemon = True thread.start() return thread
def __init__(self, app, queue, task_mapping, connection=None): super(GalaxyQueueWorker, self).__init__() log.info("Initalizing Galaxy Queue Worker on %s", util.mask_password_from_url(app.config.amqp_internal_connection)) if connection: self.connection = connection else: self.connection = Connection(app.config.amqp_internal_connection) self.app = app # Eventually we may want different workers w/ their own queues and task # mappings. Right now, there's only the one. self.control_queue = queue self.task_mapping = task_mapping self.declare_queues = galaxy.queues.all_control_queues_for_declare(app.config)
def __init__(self, app, queue, task_mapping, connection=None): super(GalaxyQueueWorker, self).__init__() log.info( "Initalizing Galaxy Queue Worker on %s", util.mask_password_from_url(app.config.amqp_internal_connection)) if connection: self.connection = connection else: self.connection = Connection(app.config.amqp_internal_connection) self.app = app # Eventually we may want different workers w/ their own queues and task # mappings. Right now, there's only the one. self.control_queue = queue self.task_mapping = task_mapping self.declare_queues = galaxy.queues.all_control_queues_for_declare( app.config)
def __init__(self, app, task_mapping=None): super().__init__() log.info( "Initializing %s Galaxy Queue Worker on %s", app.config.server_name, util.mask_password_from_url(app.config.amqp_internal_connection)) self.daemon = True self.connection = app.amqp_internal_connection_obj # Force connection instead of lazy-connecting the first time it is required. # Fixes `'kombu.transport.sqlalchemy.Message' is not mapped` error. self.connection.connect() self.connection.release() self.app = app self.task_mapping = task_mapping or control_message_to_task self.exchange_queue = None self.direct_queue = None self.control_queues = [] self.epoch = 0
def __init__(self, app, queue=None, task_mapping=control_message_to_task, connection=None): super(GalaxyQueueWorker, self).__init__() log.info("Initalizing %s Galaxy Queue Worker on %s", app.config.server_name, util.mask_password_from_url(app.config.amqp_internal_connection)) self.daemon = True if connection: self.connection = connection else: self.connection = app.amqp_internal_connection_obj # explicitly force connection instead of lazy-connecting the first # time it is required. self.connection.connect() self.app = app # Eventually we may want different workers w/ their own queues and task # mappings. Right now, there's only the one. if queue: # Allows assignment of a particular queue for this worker. self.control_queue = queue else: # Default to figuring out which control queue to use based on the app config. queue = galaxy.queues.control_queue_from_config(app.config) self.task_mapping = task_mapping self.declare_queues = galaxy.queues.all_control_queues_for_declare(app.config)