Skip to content

Commit

Permalink
Merge pull request #205 from PolyJIT/f/payloads
Browse files Browse the repository at this point in the history
Add payload support
  • Loading branch information
simbuerg committed Sep 3, 2018
2 parents 4fb7fcc + 50af537 commit 94f4994
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ persistent=no
load-plugins=

# Use multiple processes to speed up Pylint.
jobs=2
jobs=1

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
Expand Down
11 changes: 2 additions & 9 deletions benchbuild/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,13 @@ def __call__(self, binary_command, *args, **kwargs):
**kwargs) as run:
run_info = run()
if self.config:
LOG.info("")
LOG.info("==CONFIG==")
run_info.add_payload("config", self.config)
LOG.info(
yaml.dump(
self.config,
width=40,
indent=4,
default_flow_style=False))
LOG.info("==CONFIG==")
LOG.info("")
self.config['baseline'] = \
os.getenv("BB_IS_BASELINE", "False")
persist_config(run_info.db_run, run_info.session, self.config)
Expand Down Expand Up @@ -252,11 +249,7 @@ def get_compilestats(prog_out):
if res is not None:
yield res

def __call__(self,
cc,
*args,
project=None,
**kwargs):
def __call__(self, cc, *args, project=None, **kwargs):
from benchbuild.experiments.compilestats import CompileStat
from benchbuild.utils.db import persist_compilestats
from benchbuild.utils.schema import Session
Expand Down
23 changes: 10 additions & 13 deletions benchbuild/utils/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def __fail(self, retcode, stdout, stderr):

db_run = attr.ib(init=False, default=None)
session = attr.ib(init=False, default=None, repr=False)
payload = attr.ib(init=False, default=None, repr=False)

def __attrs_post_init__(self):
self.__begin(self.cmd, self.project, self.experiment.name,
Expand All @@ -224,17 +225,13 @@ def __attrs_post_init__(self):
run_id = self.db_run.id
settings.CFG["db"]["run_id"] = run_id

def __add__(self, rhs):
if rhs is None:
return self

new_run_info = RunInfo(
retcode=self.retcode + rhs.retcode,
stdout=self.stdout + rhs.stdout,
stderr=self.stderr + rhs.stderr,
db_run=[self.db_run, rhs.db_run],
session=self.session)
return new_run_info
def add_payload(self, name, payload):
if self == payload:
return
if not self.payload:
self.payload = {name: payload}
else:
self.payload.update({name: payload})

@property
def has_failed(self):
Expand Down Expand Up @@ -584,8 +581,8 @@ def unionfs_set_up(ro_base, rw_image, mountpoint):
ro_base = os.path.abspath(ro_base)
rw_image = os.path.abspath(rw_image)
mountpoint = os.path.abspath(mountpoint)
return unionfs_cmd["-f", "-o", "auto_unmount,allow_other,cow",
rw_image + "=RW:" + ro_base + "=RO", mountpoint]
return unionfs_cmd["-f", "-o", "auto_unmount,allow_other,cow", rw_image +
"=RW:" + ro_base + "=RO", mountpoint]


def unionfs_is_active(root):
Expand Down
6 changes: 6 additions & 0 deletions benchbuild/utils/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,15 @@ def needed_schema(connection, meta):
sys.exit(-4)
except sa.exc.OperationalError:
# SQLite throws an OperationalError

# Now try again to add user-defined tables unconditionally.
meta.create_all(connection, checkfirst=True)
return False
except sa.exc.ProgrammingError:
# PostgreSQL throws a ProgrammingError

# Now try again to add user-defined tables unconditionally.
meta.create_all(connection, checkfirst=True)
return False
return True

Expand Down

0 comments on commit 94f4994

Please sign in to comment.