Commit 63ef090c authored by Zixian Cai's avatar Zixian Cai

Fail early, fail loudly

parent 5e302f98
......@@ -27,6 +27,7 @@ MONGODB_URI = "mongodb://{}:{}/{}".format(MONGODB_HOST,
# Executing
REDIRECT_SUBPROC = False
FAIL_EARLY = True
WEB_POI_REPO = "mu-impl-fast"
WEB_POI_HOST = "angus"
......
......@@ -16,7 +16,6 @@
import logging
import click
import json
import sys
from mubench.frontend.utils import go_through_pipelines, platform_info
from mubench.models.revision import LocalRevision
......@@ -41,7 +40,7 @@ logger = logging.getLogger(__name__)
def local(file, pipeline, skip_compile, dump):
if len(file) == 0:
logger.fatal("Too few files")
sys.exit(1)
exit(1)
logger.info("Constructing a LocalRevision")
revision = LocalRevision(file)
logger.info("Running tasks specified in file")
......
......@@ -171,6 +171,8 @@ class TaskSet:
task_print(task.name,
crayons.red(
'error output written to %s' % errlog_file))
if settings.FAIL_EARLY:
exit(e.exec_res.returncode)
# run
data = {t: [] for t in targets} # only run tasks that have a target
......@@ -197,6 +199,8 @@ class TaskSet:
task_print(task.name, crayons.red(
'error output written to %s' % errlog_file))
del data[task]
if settings.FAIL_EARLY:
exit(e.exec_res.returncode)
self.results = {task.name: task.get_result() for task in data}
return self.results
......
......@@ -23,6 +23,7 @@ from types import SimpleNamespace
from mubench.conf import settings
from pathlib import Path
import ctypes
import sys
logger = logging.getLogger(__name__)
......@@ -67,11 +68,11 @@ def run_in_subproc(cmd, env=None, **kwds):
env=env, **kwds)
so, se = res.communicate()
if settings.REDIRECT_SUBPROC:
print('---------------- stdout ----------------')
print(str(so, encoding='utf-8'))
print('---------------- stderr ----------------')
print(str(se, encoding='utf=8'))
if settings.REDIRECT_SUBPROC or res.returncode != 0:
print('---------------- stdout ----------------', file=sys.stderr)
print(str(so, encoding='utf-8'), file=sys.stderr)
print('---------------- stderr ----------------', file=sys.stderr)
print(str(se, encoding='utf=8'), file=sys.stderr)
res = SimpleNamespace(stdout=str(so, encoding='utf-8'),
stderr=str(se, encoding='utf=8'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment