Esempio n. 1
0
def test_main_worker(trials):
    options = FakeOptions(
        max_jobs=1,
        # XXX: sync this with TempMongo
        mongo=as_mongo_str('localhost:22334/foodb'),
        reserve_timeout=1,
        poll_interval=.5,
        workdir=None,
        exp_key='foo')
    # -- check that it runs
    #    and that the reserve timeout is respected
    main_worker_helper(options, ())
Esempio n. 2
0
def test_main_worker(trials):
    options = FakeOptions(
            max_jobs=1,
            # XXX: sync this with TempMongo
            mongo=as_mongo_str('localhost:22334/foodb'),
            reserve_timeout=1,
            poll_interval=.5,
            workdir=None,
            exp_key='foo'
            )
    # -- check that it runs
    #    and that the reserve timeout is respected
    main_worker_helper(options, ())
Esempio n. 3
0
    #'rsenses_imp_loss': "categorical_crossentropy",
}

if args.action == 'worker':
    # run distributed worker
    class Options(object):
        mongo = args.mongo
        exp_key = args.exp_key
        last_job_timeout = None
        max_consecutive_failures = 2
        max_jobs = args.evals  #= inf
        poll_interval = 300  #= 5 min
        reserve_timeout = 3600  #= 1 hour
        workdir = None
    sys.argv[0] = args.worker_helper
    sys.exit(main_worker_helper(Options(), None))

elif args.action == 'optimizer':
    # run distributed optimizer
    trials = MongoTrials(args.mongo, exp_key=args.exp_key)
    best = fmin(optimize_exec.objective, space, trials=trials, algo=tpe.suggest, max_evals=args.evals)

    # summary
    print
    print "evals: {}".format(args.evals)
    print "best:  {}".format(best)
    print "space: {}".format(space_eval(space, best))

elif args.action == 'list_best':
    # list distributed evaluation results
    best = list_best(args.mongo, exp_key=args.exp_key, space=space)