Example #1
0
 def setUp(self):
     from edacc import models, config
     config.DEFAULT_DATABASES = [("edacc", "edaccteam", TEST_DATABASE, TEST_DATABASE, True)]
     from edacc.web import app
     self.app = app.test_client()
     self.db = db = models.add_database("edacc", "edaccteam", TEST_DATABASE, TEST_DATABASE)
     clean_database(db)
     fixtures.setup_ranking_fixture(db)
 def setUp(self):
     from edacc import models, config
     config.DEFAULT_DATABASES = [("edacc", "edaccteam", TEST_DATABASE,
                                  TEST_DATABASE, True)]
     from edacc.web import app
     self.app = app.test_client()
     self.db = db = models.add_database("edacc", "edaccteam", TEST_DATABASE,
                                        TEST_DATABASE)
     clean_database(db)
     fixtures.setup_ranking_fixture(db)
Example #3
0
def databases_add():
    """ Display a form to add databases to the web frontend """
    error = None
    if request.method == 'POST':
        label = request.form['label']
        database = request.form['database']
        username = request.form['username']
        password = request.form['password']
        hidden = request.form.has_key('hidden')

        if models.get_database(database):
            error = "A database with this name already exists"
        else:
            try:
                models.add_database(username, password, database, label, hidden)
                return redirect(url_for('frontend.index'))
            except Exception as e:
                error = "Can't add database: " + str(e)

    return render('/admin/databases_add.html', error=error)
Example #4
0
def databases_add():
    """ Display a form to add databases to the web frontend """
    error = None
    if request.method == 'POST':
        label = request.form['label']
        database = request.form['database']
        username = request.form['username']
        password = request.form['password']
        hidden = request.form.has_key('hidden')

        if models.get_database(database):
            error = "A database with this name already exists"
        else:
            try:
                models.add_database(username, password, database, label,
                                    hidden)
                return redirect(url_for('frontend.index'))
            except Exception as e:
                error = "Can't add database: " + str(e)

    return render('/admin/databases_add.html', error=error)
import sys, tempfile, subprocess, os
sys.path.append("..")
from sqlalchemy.orm import joinedload_all
from edacc import models, config, constants

db = models.add_database(*config.DEFAULT_DATABASES[0])
TMP_DIR = '/tmp'
SATZILLA_FEATURE_SCRIPT = "featuresSAT12"


#instance_class = db.session.query(db.InstanceClass).options(joinedload_all('instances.properties')).filter_by(name=INSTANCE_CLASS).first()
property_by_name = dict()
for instance in db.session.query(db.Instance).options(joinedload_all('properties')):
    instance_path = os.path.join(TMP_DIR, instance.md5)
    with open(instance_path, 'wb') as instance_file:
        instance_file.write(instance.get_instance(db))

    features = subprocess.Popen([SATZILLA_FEATURE_SCRIPT, "-base", instance_path], stdout=subprocess.PIPE)
    feature_names = features.stdout.readline().strip().split(",")
    feature_values = features.stdout.readline().strip().split(",")
    features.wait()
    os.remove(instance_path)
    if not feature_names or not feature_values or len(feature_names) == 1:
        print "Couldn't compute features of instance " + instance.name
        continue

    for name, value in zip(feature_names, feature_values):
        if name not in property_by_name:
            property_by_name[name] = db.session.query(db.Property).filter_by(name=name).first()
            if not property_by_name[name]:
                raise Exception("Property " + repr(name) + " not found")
Example #6
0
if config.LOGGING:
    # set up logging if configured
    import logging
    from logging.handlers import RotatingFileHandler

    file_handler = RotatingFileHandler(config.LOG_FILE)
    file_handler.setLevel(logging.WARNING)
    formatter = logging.Formatter("---------------------------\n" + \
                                  "%(asctime)s - %(name)s - " + \
                                  "%(levelname)s\n%(message)s")
    file_handler.setFormatter(formatter)
    app.logger.addHandler(file_handler)

# initialize configured database connections
for username, password, database, label, hidden in config.DEFAULT_DATABASES:
    models.add_database(username, password, database, label, hidden)


class LimitedRequest(Request):
    """ extending Flask's request class to limit form uploads to 500 MB """
    max_form_memory_size = 500 * 1024 * 1024


app.request_class = LimitedRequest
app.config.update(
    SECRET_KEY=config.SECRET_KEY,
    PERMANENT_SESSION_LIFETIME=datetime.timedelta(days=14),
    CACHE_TYPE='filesystem',
    CACHE_DIR=config.TEMP_DIR,
    MAIL_SERVER=config.MAIL_SERVER,
    MAIL_PORT=config.MAIL_PORT,
 def setUp(self):
     from edacc import models
     self.db = db = models.add_database("edacc", "edaccteam", TEST_DATABASE,
                                        TEST_DATABASE)
     clean_database(db)
     fixtures.setup_ranking_fixture(db)
 def setUp(self):
     from edacc import models
     self.db = models.add_database("edacc", "edaccteam", TEST_DATABASE,
                                   TEST_DATABASE)
Example #9
0
 def setUp(self):
     from edacc import models
     self.db = models.add_database("edacc", "edaccteam", TEST_DATABASE, TEST_DATABASE)
Example #10
0
if config.LOGGING:
    # set up logging if configured
    import logging
    from logging.handlers import RotatingFileHandler

    file_handler = RotatingFileHandler(config.LOG_FILE)
    file_handler.setLevel(logging.WARNING)
    formatter = logging.Formatter("---------------------------\n" + \
                                  "%(asctime)s - %(name)s - " + \
                                  "%(levelname)s\n%(message)s")
    file_handler.setFormatter(formatter)
    app.logger.addHandler(file_handler)

# initialize configured database connections
for username, password, database, label, hidden in config.DEFAULT_DATABASES:
    models.add_database(username, password, database, label, hidden)


class LimitedRequest(Request):
    """ extending Flask's request class to limit form uploads to 500 MB """
    max_form_memory_size = 500 * 1024 * 1024


app.request_class = LimitedRequest
app.config.update(SECRET_KEY=config.SECRET_KEY,
                  PERMANENT_SESSION_LIFETIME=datetime.timedelta(days=14),
                  CACHE_TYPE='filesystem',
                  CACHE_DIR=config.TEMP_DIR,
                  MAIL_SERVER=config.MAIL_SERVER,
                  MAIL_PORT=config.MAIL_PORT,
                  MAIL_USE_TLS=config.MAIL_USE_TLS,
""" Parse solver info from the SAT Competition 09 website.
    To be used after the import script.
"""
import sys, urllib2
sys.path.append("..")
from BeautifulSoup import BeautifulSoup

from edacc import models, config
config.DATABASE_HOST = "localhost"
models.add_database("edacc", "passw", "EDACC5", "EDACC5")
db = models.get_database("EDACC5")

html_url = raw_input('Enter solverlist url (e.g. http://www.cril.univ-artois.fr/SAT09/results/solverlist.php?idev=22): ')
p = urllib2.urlopen(html_url)
soup = BeautifulSoup(p.read())

for solver_tab in soup.findAll('table'):
    if not solver_tab.find('td', text='Event'): continue
    version = solver_tab.find('td', attrs={"class": "fieldname"}, text='Version').findNext('td').string.strip()
    name = solver_tab.find('td', attrs={"class": "fieldname"}, text='Name').findNext('td').string.strip()
    authors = solver_tab.find('td', attrs={"class": "fieldname"}, text='Authors').findNext('td').string.strip()
    description = solver_tab.find('td', attrs={"class": "fieldname"}, text='Comments').findNext('td').contents
    description = map(lambda e: '\n' if str(e) == '<br />' else e, description)

    solver = db.session.query(db.Solver).filter_by(name=name,version=version).first()
    if solver:
        solver.authors = authors
        db.session.commit()
    else:
        print "Didn't find", name, version, " in the DB, skipping"
Example #12
0
# -*- coding: utf-8 -*-
"""
    SAT Competition 2011 results import script
"""
import os, sys, datetime
sys.path.append("..") # append parent directory to python path to be able to import edacc when running from ./scripts
from edacc import models, config

config.DATABASE_HOST = "localhost"
models.add_database("user", "pw", "db", "label")
db = models.get_database("db")

# mapping the "checked answer" column to EDACC's status/resultCode codes
ANSWER_MAP = {
    'UNKNOWN':          (1, 0),
    'UNKNOWN EXCODE':   (1, 0),
    'UNKNOWN TO':       (21, -21),
    'UNKNOWN MO':       (23, -23),
    'UNKNOWN (?)':      (1, 0),
    'SIGNAL':           (21, -309),
    'SAT':              (1, 11),
    'UNSAT':            (1, 10),
    'ERR WRONGCERT':    (1, 0),
    'ERR NOCERT':       (1, 0),
    'ERR UNSAT':        (1, 0),
}

def parse_phase_txt(filepath, phase):
    experiments = {'RANDOM': db.Experiment(), 'CRAFTED': db.Experiment(), 'APPLICATION': db.Experiment(), 'MUS': db.Experiment()}
    for exp in experiments.keys():
        experiments[exp].name = 'phase' + str(phase) + ' ' + exp
# -*- coding: utf-8 -*-
"""
    SAT Competition 2011 results import script
"""
import os, sys, datetime
sys.path.append(
    ".."
)  # append parent directory to python path to be able to import edacc when running from ./scripts
from edacc import models, config

config.DATABASE_HOST = "localhost"
models.add_database("user", "pw", "db", "label")
db = models.get_database("db")

# mapping the "checked answer" column to EDACC's status/resultCode codes
ANSWER_MAP = {
    'UNKNOWN': (1, 0),
    'UNKNOWN EXCODE': (1, 0),
    'UNKNOWN TO': (21, -21),
    'UNKNOWN MO': (23, -23),
    'UNKNOWN (?)': (1, 0),
    'SIGNAL': (21, -309),
    'SAT': (1, 11),
    'UNSAT': (1, 10),
    'ERR WRONGCERT': (1, 0),
    'ERR NOCERT': (1, 0),
    'ERR UNSAT': (1, 0),
}


def parse_phase_txt(filepath, phase):
Example #14
0
 def setUp(self):
     from edacc import models
     self.db = db = models.add_database("edacc", "edaccteam", TEST_DATABASE, TEST_DATABASE)
     clean_database(db)
     fixtures.setup_ranking_fixture(db)
Example #15
0
""" Parse solver info from the SAT Competition 09 website.
    To be used after the import script.
"""
import sys, urllib2
sys.path.append("..")
from BeautifulSoup import BeautifulSoup

from edacc import models, config
config.DATABASE_HOST = "localhost"
models.add_database("edacc", "passw", "EDACC5", "EDACC5")
db = models.get_database("EDACC5")

html_url = raw_input(
    'Enter solverlist url (e.g. http://www.cril.univ-artois.fr/SAT09/results/solverlist.php?idev=22): '
)
p = urllib2.urlopen(html_url)
soup = BeautifulSoup(p.read())

for solver_tab in soup.findAll('table'):
    if not solver_tab.find('td', text='Event'): continue
    version = solver_tab.find('td',
                              attrs={
                                  "class": "fieldname"
                              },
                              text='Version').findNext('td').string.strip()
    name = solver_tab.find('td', attrs={
        "class": "fieldname"
    }, text='Name').findNext('td').string.strip()
    authors = solver_tab.find('td',
                              attrs={
                                  "class": "fieldname"
Example #16
0
import sys, tempfile, subprocess, os
sys.path.append("..")
from sqlalchemy.orm import joinedload_all
from edacc import models, config, constants

db = models.add_database(*config.DEFAULT_DATABASES[0])
TMP_DIR = '/tmp'
SATZILLA_FEATURE_SCRIPT = "featuresSAT12"

#instance_class = db.session.query(db.InstanceClass).options(joinedload_all('instances.properties')).filter_by(name=INSTANCE_CLASS).first()
property_by_name = dict()
for instance in db.session.query(db.Instance).options(
        joinedload_all('properties')):
    instance_path = os.path.join(TMP_DIR, instance.md5)
    with open(instance_path, 'wb') as instance_file:
        instance_file.write(instance.get_instance(db))

    features = subprocess.Popen(
        [SATZILLA_FEATURE_SCRIPT, "-base", instance_path],
        stdout=subprocess.PIPE)
    feature_names = features.stdout.readline().strip().split(",")
    feature_values = features.stdout.readline().strip().split(",")
    features.wait()
    os.remove(instance_path)
    if not feature_names or not feature_values or len(feature_names) == 1:
        print "Couldn't compute features of instance " + instance.name
        continue

    for name, value in zip(feature_names, feature_values):
        if name not in property_by_name:
            property_by_name[name] = db.session.query(
import sys, tempfile, subprocess, os
sys.path.append("..")

from edacc import models, config, constants
from satchallenge_config import *

db = models.add_database(DB_USER, DB_PASSWORD, DB_NAME, DB_NAME)

SAT_verifier = "./SAT"

TEMP_DIR = '/tmp/satchallenge'
try:
    os.makedirs(TEMP_DIR)
except: pass

UNSAT = 10
SAT = 11

limits_by_experiment = {
    21: (900, -1, 6144),
    18: (900, -1, 6144),
    19: (900, -1, 6144),
    20: (-1, 900, 12288),
    24: (900, -1, 6144),
    25: (900, -1, 6144)
}

# check sequential experiments

for experiment_id in [19, 21, 18, 20, 24]:
    experiment = db.session.query(db.Experiment).get(experiment_id)