Exemplo n.º 1
0
    parser.add_argument ('-v', '--verbose', dest='verbose', action='count',
                         help='increase output verbosity', default=0)
    parser.add_argument ('-i', '--input', metavar='path/to/input.xml',
                         help="the input file (required)", required=True)
    parser.add_argument ('profile', metavar='path/to/file.conf',
                         help="a .conf file (required)")
    return parser


if __name__ == '__main__':
    build_parser ().parse_args (namespace = args)
    config = config_from_pyfile (args.profile)

    init_logging (
        args,
        logging.StreamHandler (), # stderr
        logging.FileHandler ('load_edits.log')
    )

    parameters = dict ()
    db = db_tools.PostgreSQLEngine (**config)

    tree = lxml.etree.parse (args.input if args.input != '-' else sys.stdin)

    with db.engine.begin () as conn:
        db_tools.truncate_editor_tables (conn)

    log (logging.INFO, "Loading cliques ...")

    with db.engine.begin () as conn:
        values = []
Exemplo n.º 2
0
Arquivo: server.py Projeto: cceh/ntg
        textflow.init_app (app)
        comparison.init_app (app)
        editor.init_app (sub_app)
        set_cover.init_app (sub_app)

        instances[sub_app.config['APPLICATION_ROOT']] = sub_app

    return app, instances, extra_files


if __name__ == "__main__":
    from werkzeug.wsgi import DispatcherMiddleware
    from werkzeug.serving import run_simple

    args = build_parser (Config.CONFIG_FILE).parse_args ()
    args = init_logging (args)

    Config.LOG_LEVEL   = args.log_level
    Config.CONFIG_FILE = args.config_file
    Config.ACCESS      = Config.ACCESS.lower ()

    app, instances, extra_files = create_app (Config)

    run_simple (
        app.config['APPLICATION_HOST'],
        app.config['APPLICATION_PORT'],
        DispatcherMiddleware (app, instances),
        use_reloader = app.config['USE_RELOADER'],
        use_debugger = app.config['USE_DEBUGGER'],
        extra_files=extra_files
    )
Exemplo n.º 3
0
    parser.add_argument('-v',
                        '--verbose',
                        dest='verbose',
                        action='count',
                        help='increase output verbosity',
                        default=0)
    return parser


if __name__ == '__main__':

    build_parser().parse_args(namespace=args)
    config = config_from_pyfile(args.profile)

    init_logging(
        args,
        logging.StreamHandler(),  # stderr
        logging.FileHandler('mk_users.log'))

    dba = db_tools.PostgreSQLEngine(**config)

    db.Base3.metadata.drop_all(dba.engine)
    db.Base3.metadata.create_all(dba.engine)

    pwd_context = CryptContext(schemes=[config['USER_PASSWORD_HASH']])

    with dba.engine.begin() as src:
        # create the basic roles
        execute(
            src,
            "INSERT INTO role (id, name, description) VALUES (1, 'admin',  'Administrator')",
            {})
Exemplo n.º 4
0
    info_app.config.update(app.config)
    info_app.register_blueprint(info.bp)
    do_init_app(info_app)
    info.init_app(app, instances)

    instances[app.config['APPLICATION_ROOT']] = info_app

    d = DispatcherMiddleware(app, instances)
    d.config = app.config
    d.config['EXTRA_FILES'] = extra_files
    return d


if __name__ == "__main__":
    from werkzeug.serving import run_simple

    build_parser().parse_args(namespace=args)
    init_logging(args, flask.logging.default_handler,
                 logging.FileHandler('server.log'))

    Config.LOG_LEVEL = args.log_level
    Config.CONFIG_FILE = args.config_file
    app = create_app(Config)

    run_simple(app.config['APPLICATION_HOST'],
               app.config['APPLICATION_PORT'],
               app,
               use_reloader=app.config['USE_RELOADER'],
               use_debugger=app.config['USE_DEBUGGER'],
               extra_files=app.config['EXTRA_FILES'])
Exemplo n.º 5
0
    parser.add_argument('-v',
                        '--verbose',
                        dest='verbose',
                        action='count',
                        help='increase output verbosity',
                        default=0)
    return parser


if __name__ == '__main__':

    build_parser().parse_args(namespace=args)
    config = config_from_pyfile(args.profile)

    init_logging(
        args,
        logging.StreamHandler(),  # stderr
        logging.FileHandler('cbgm.log'))

    db = db_tools.PostgreSQLEngine(**config)
    parameters = dict()
    v = CBGM_Params()

    log(logging.INFO, "Rebuilding the 'A' text ...")
    build_A_text(db, parameters)

    log(logging.INFO, "Creating the labez matrix ...")
    create_labez_matrix(db, parameters, v)

    log(logging.INFO, "Calculating mss similarity pre-co ...")
    calculate_mss_similarity_preco(db, parameters, v)
Exemplo n.º 6
0
                        help="a .conf file (required)")
    parser.add_argument('-v',
                        '--verbose',
                        dest='verbose',
                        action='count',
                        help='increase output verbosity',
                        default=0)
    return parser


if __name__ == '__main__':

    build_parser().parse_args(namespace=args)
    config = config_from_pyfile(args.profile)

    init_logging(args, logging.StreamHandler(),
                 logging.FileHandler('import.log'))

    parameters = dict()

    dbsrc1 = db_tools.MySQLEngine(config['MYSQL_CONF'], config['MYSQL_GROUP'],
                                  config['MYSQL_ECM_DB'])
    dbsrc2 = db_tools.MySQLEngine(config['MYSQL_CONF'], config['MYSQL_GROUP'],
                                  config['MYSQL_VG_DB'])
    dbsrc3 = db_tools.MySQLEngine(config['MYSQL_CONF'], config['MYSQL_GROUP'],
                                  config['MYSQL_NESTLE_DB'])
    dbdest = db_tools.PostgreSQLEngine(**config)

    db.fdw('app_fdw', db.Base.metadata, dbdest, dbsrc1)
    db.fdw('var_fdw', db.Base2.metadata, dbdest, dbsrc2)
    db.fdw('nestle_fdw', db.Base4.metadata, dbdest, dbsrc3)