def main(url_api_collections,
         url_remote_couchdb=URL_REMOTE_COUCHDB,
         log_handler=None):
    '''This should only be run in production env!
    Queue is hard coded to normal-production so that it will be run there
    '''
    config = parse_env(None)
    if not log_handler:
        log_handler = logbook.StderrHandler(level='DEBUG')
    log_handler.push_application()
    for url_api_collection in [x for x in url_api_collections.split(';')]:
        queue_couch_sync(
            config['redis_host'],
            config['redis_port'],
            config['redis_password'],
            config['redis_connect_timeout'],
            rq_queue='normal-production',
            url_api_collection=url_api_collection,
            url_remote_couchdb=url_remote_couchdb, )

    log_handler.pop_application()
Example #2
0
def main(url_api_collections,
         url_remote_couchdb=URL_REMOTE_COUCHDB,
         log_handler=None):
    '''This should only be run in production env!
    Queue is hard coded to normal-production so that it will be run there
    '''
    config = parse_env(None)
    if not log_handler:
        log_handler = logbook.StderrHandler(level='DEBUG')
    log_handler.push_application()
    for url_api_collection in [x for x in url_api_collections.split(';')]:
        queue_couch_sync(
            config['redis_host'],
            config['redis_port'],
            config['redis_password'],
            config['redis_connect_timeout'],
            rq_queue='normal-production',
            url_api_collection=url_api_collection,
            url_remote_couchdb=url_remote_couchdb,
        )

    log_handler.pop_application()
                        default=JOB_TIMEOUT,
                        help='Timeout for the RQ job')
    parser.add_argument('--pynuxrc',
                        default='~/.pynuxrc',
                        help='rc file for use by pynux')
    parser.add_argument('--replace',
                        action='store_true',
                        help='replace files on s3 if they already exist')

    return parser


if __name__ == '__main__':
    parser = def_args()
    args = parser.parse_args()
    config = parse_env(None)
    main(args.collection_ids,
         rq_queue=args.rq_queue,
         config=config,
         replace=args.replace,
         timeout=args.job_timeout,
         pynuxrc=args.pynuxrc)

# Copyright © 2017, Regents of the University of California
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright notice,
#   this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
Example #4
0
    parser.add_argument('rq_queue', type=str, help='RQ Queue to put job in')
    parser.add_argument(
        'collection_ids', type=str, help='Collection ids, ";" delimited')
    parser.add_argument(
        '--replace',
        action='store_true',
        help='replace files on s3 if they already exist')
    parser.add_argument('--job_timeout', type=int, default=JOB_TIMEOUT,
                        help='Timeout for the RQ job')
    return parser


if __name__ == '__main__':
    parser = def_args()
    args = parser.parse_args()
    config = parse_env(None)
    if not args.collection_ids or not args.rq_queue:
        parser.print_help()
        sys.exit(27)
    if args.job_timeout:
        job_timeout = args.job_timeout
    else:
        job_timeout = JOB_TIMEOUT
    main(args.collection_ids, rq_queue=args.rq_queue, replace=args.replace,
            timeout=job_timeout)

# Copyright © 2017, Regents of the University of California
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright notice,