Ejemplo n.º 1
0
def main(argv=None):
    args, extra_argv = parse_args(argv)
    engine = Engine(args.engine)

    wdir = engine.get_tempdir('training')
    log_file = engine.get_logfile('training', ensure=True, append=True)

    if engine.exists():
        if not args.resume and not args.force_delete:
            confirm_or_die(args.engine)

        node = EngineNode(engine)
        node.stop()

    if not args.resume:
        if os.path.isdir(engine.path):
            shutil.rmtree(engine.path)
        os.makedirs(engine.path)

        shutil.rmtree(wdir, ignore_errors=True)
        os.makedirs(wdir)

        if os.path.isfile(log_file):
            os.remove(log_file)

    activity = CreateActivity(engine,
                              args,
                              extra_argv,
                              wdir=wdir,
                              log_file=log_file,
                              delete_on_exit=not args.debug)
    activity.run()
Ejemplo n.º 2
0
def main(argv=None):
    args = parse_args(argv)

    engine = Engine(args.engine)
    ensure_engine_exists(engine)

    node = EngineNode(engine)
    ensure_node_running(node)
    ensure_node_has_api(node)

    wdir = engine.get_tempdir('evaluate')
    shutil.rmtree(wdir, ignore_errors=True)
    os.makedirs(wdir)

    activity = EvaluateActivity(node, args, wdir=wdir, delete_on_exit=not args.debug)
    activity.run()