#!/usr/bin/env python # -*- mode: python -*- # # This file is part of eventmq. # # eventmq is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 2.1 of the License, or (at your option) # any later version. # # eventmq is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with eventmq. If not, see . import argparse from eventmq.jobmanager import JobManager from eventmq import conf if __name__ == "__main__": parser = argparse.ArgumentParser(description='Listen for job requests and ' 'manage their execution') parser.add_argument('--broker-addr', '-B', type=str, nargs='?', help='manually specify the broker address to connect ' 'to in order to receive jobs') parser.add_argument('--config', '-C', type=str, nargs='?', help='manually specify the location of eventmq.conf') parser.add_argument('--queues', '-Q', type=str, nargs='+', help='space separated list of queue names to listen ' 'on') parser.add_argument('--jobs', '-J', type=int, nargs='?', help='the max number of concurrent jobs to manage at ' 'a time') parser.add_argument('--name', '-n', type=str, default=None, help="A unique ame to give this node. If one " "isn't provided a random uuid will be " "generated") args = parser.parse_args() # Overwrite the default config location with the one passed to the app if args.config: conf.CONFIG_FILE = args.config # args.queues is a list of queues or None queues = args.queues if queues: queues = ','.join(queues) broker_addr = args.broker_addr concurrent_jobs = args.jobs name = args.name j = JobManager(queues=queues, concurrent_jobs=concurrent_jobs, name=name) j.jobmanager_main(broker_addr=broker_addr)