Пример #1
0
                   help="The path to a CSV file containing AWS credentials")
    p.add_argument("--db",
                   required=True,
                   help="The event/survey database to use")
    p.add_argument(
        "--sandbox",
        action="store_true",
        help="Whether to use the production or sandbox MTurk endpoint")

    args = p.parse_args()

    if ('mysql+pymysql://' in args.db):
        # if "mysql+mysqldb://" in args.db:
        sessionF = open_mysql_db(args.db)
    else:
        sessionF = open_sqlite_db(args.db)
    session = sessionF()

    mc = mturk_util.connect(args.credentials_file, args.sandbox)

    hitq = session.query(
        func.json_extract(Event.payload, "$.hitId").label("hit")).subquery()
    q = session.query(hitq.c.hit) \
      .filter(hitq.c.hit.notin_(session.query(SurveyData.hit)))
    for hit, in q.distinct():
        print("Loading new HIT %s..." % hit, end=' ')

        try:
            getSurveyData(session, mc, hit)
        except MTurkRequestError:
            print("error")
Пример #2
0
from lib.invgame_server.vc_check import tryAndVerifyLvl
from re import compile as reComp
from lib.invgame_server.models import open_sqlite_db, Event
from datetime import datetime, timedelta
from functools import reduce

p = argparse.ArgumentParser(description=\
        "given an experiment ran over a split levelset see if " +\
        "the combined found invariants for each split solve the original level")
p.add_argument("--lvlset", type=str, help="lvlset to check", required=True)
p.add_argument("--ename", type=str, help="experiment name", required=True)
p.add_argument("--timeout", type=int, help="timeout on z3 queries")

args = p.parse_args()
lvlsetName, lvls = levels.loadBoogieLvlSet(args.lvlset)
s = open_sqlite_db("../logs/" + args.ename + "/events.db")()

endsWithNumP = reComp(".*\.[0-9]*$")
justEnd = reComp("\.[0-9]*$")

originalToSplitM = {}
splitToOriginal = {}

lvlStats = { lvlN: {
      "usersStarted": set(),\
      "nusersStarted": 0,\
      "usersFinished": set(),\
      "nusersFinished": 0,\
      "invs": set(),\
      "ninvs": 0,\
      "invariantsTried": set(),\
Пример #3
0
if __name__ == "__main__":
    args = p.parse_args()

    e1 = load_experiment_or_die(args.exp1)
    e1.read_server_runs()
    e2 = load_experiment_or_die(args.exp2)
    e2.read_server_runs()
    try:
        e3 = Experiment(args.out, False)
        print("Error: Experiment ", args.out, "already exists")
        exit(-1)
    except IOError:
        e3 = Experiment(args.out, True)

    s1 = open_sqlite_db("../logs/" + args.exp1 + "/events.db")()
    s2 = open_sqlite_db("../logs/" + args.exp2 + "/events.db")()
    s3 = open_sqlite_db("../logs/" + args.out + "/events.db")()

    # Merging consists of 3 steps:
    # 1) Copy over all ignore-*, tut-done-* and done-* files over in target
    #    directory
    from shutil import copyfile
    from glob import glob

    e1_files = glob(join(e1.dirname, "ignore-*")) +\
               glob(join(e1.dirname, "tut-done*")) +\
               glob(join(e1.dirname, "done-*"))

    e2_files = glob(join(e1.dirname, "ignore-*")) +\
               glob(join(e1.dirname, "tut-done*")) +\