Example #1
0
    def __init__(self):
        parser = amqp_worker.base_argument_parser()
        parser.add_argument('worker_account', type=str)
        args, settings = amqp_worker.parse_base_args(parser, 'app:main')

        self.base_file_path = settings['file_directory']
        self.private_key_file = settings['ssh_priv_key']
        self.account = args.worker_account
        machines = settings['worker_machines']
        if isinstance(machines, basestring):
            machines = [machines]
        random.shuffle(machines)
        self.machines = [(5., x) for x in machines]
        engine = engine_from_config(settings, 'sqlalchemy.')
        configure_sql(engine)

        worker = amqp_worker.AMQPWorker(
            settings['queue_server'],
            settings['queue_tell_worker'],
            self.do_work,
            is_daemon=args.daemon,
            error_queue=settings.get('queue_tell_worker_error'),
            log_file=settings['worker_proxy_log_file'].format(self.account),
            pid_file=settings['worker_proxy_pid_file'].format(self.account),
            email_subject='WorkerProxy {} Exception'.format(self.account),
            email_from=settings['exc_mail_from'],
            email_to=settings['exc_mail_to'])

        worker.handle_command(args.command)
Example #2
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'main')
    # All of the settings in the ini file correspond to a parameter in
    # the constructor.
    worker = amqp_worker.AMQPWorker(worker_func=do_work, is_daemon=args.daemon,
                                    **settings)
    worker.handle_command(args.command)
Example #3
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'main')
    # All of the settings in the ini file correspond to a parameter in
    # the constructor.
    worker = amqp_worker.AMQPWorker(worker_func=do_work,
                                    is_daemon=args.daemon,
                                    **settings)
    worker.handle_command(args.command)
Example #4
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'main')

    log_file = os.path.expanduser(settings['log_file'])
    working_dir = os.path.expanduser(settings['working_dir'])

    worker = amqp_worker.AMQPWorker(settings['server'],
                                    settings['receive_queue'],
                                    do_work, is_daemon=args.daemon,
                                    complete_queue=settings['complete_queue'],
                                    working_dir=working_dir,
                                    log_file=log_file)
    worker.start()
Example #5
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'main')

    log_file = os.path.expanduser(settings['log_file'])
    working_dir = os.path.expanduser(settings['working_dir'])

    worker = amqp_worker.AMQPWorker(settings['server'],
                                    settings['receive_queue'],
                                    do_work,
                                    is_daemon=args.daemon,
                                    complete_queue=settings['complete_queue'],
                                    working_dir=working_dir,
                                    log_file=log_file)
    worker.start()
Example #6
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'app:main')
    workers.BASE_FILE_PATH = settings['file_directory']

    engine = engine_from_config(settings, 'sqlalchemy.')
    configure_sql(engine)

    worker = amqp_worker.AMQPWorker(
        settings['queue_server'], settings['queue_verification'], do_work,
        is_daemon=args.daemon, complete_queue=settings['queue_tell_worker'],
        error_queue=settings.get('queue_verification_error'),
        log_file=settings['verification_log_file'],
        pid_file=settings['verification_pid_file'],
        email_subject='Verification Exception',
        email_from=settings['exc_mail_from'], email_to=settings['exc_mail_to'])

    worker.handle_command(args.command)
Example #7
0
def main():
    parser = amqp_worker.base_argument_parser()
    args, settings = amqp_worker.parse_base_args(parser, 'app:main')
    workers.BASE_FILE_PATH = settings['file_directory']

    engine = engine_from_config(settings, 'sqlalchemy.')
    configure_sql(engine)

    worker = amqp_worker.AMQPWorker(
        settings['queue_server'],
        settings['queue_verification'],
        do_work,
        is_daemon=args.daemon,
        complete_queue=settings['queue_tell_worker'],
        error_queue=settings.get('queue_verification_error'),
        log_file=settings['verification_log_file'],
        pid_file=settings['verification_pid_file'],
        email_subject='Verification Exception',
        email_from=settings['exc_mail_from'],
        email_to=settings['exc_mail_to'])

    worker.handle_command(args.command)