Skip to content

Commit

Permalink
Better error messages for build and launch. Make post_run_hook a full
Browse files Browse the repository at this point in the history
config option and fix it to install properly.
  • Loading branch information
Nathan Pemberton committed Dec 28, 2018
1 parent a0385b2 commit 964cd37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
23 changes: 16 additions & 7 deletions sw_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@ def main():
j['initramfs'] = True

if args.command == "build":
if args.binOnly or args.imgOnly:
# It's fine if they pass -IB, it just builds both
wlutil.buildWorkload(cfgPath, cfgs, buildBin=args.binOnly, buildImg=args.imgOnly)
else:
wlutil.buildWorkload(cfgPath, cfgs)
try:
if args.binOnly or args.imgOnly:
# It's fine if they pass -IB, it just builds both
wlutil.buildWorkload(cfgPath, cfgs, buildBin=args.binOnly, buildImg=args.imgOnly)
else:
wlutil.buildWorkload(cfgPath, cfgs)
except Exception as e:
log.error("Error while building workload: ")
log.error(str(e))

elif args.command == "launch":
# job-configs are named special internally
Expand All @@ -100,8 +104,13 @@ def main():
else:
log.error("Job " + args.job + " requested, but no jobs specified in config file\n")
parser.print_help()

wlutil.launchWorkload(cfgPath, cfgs, args.job, args.spike)

try:
wlutil.launchWorkload(cfgPath, cfgs, args.job, args.spike)
except Exception as e:
log.error("Failed to launch workload:")
log.error(str(e))

elif args.command == "test":
skipCount = 0
failCount = 0
Expand Down
4 changes: 2 additions & 2 deletions wlutil/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@

# These are the user-defined options that should be converted to absolute
# paths (from workload-relative). Derived options are already absolute.
configToAbs = ['guest-init', 'run', 'overlay', 'linux-src', 'linux-config', 'host-init', 'cfg-file', 'bin', 'img', 'spike']
configToAbs = ['guest-init', 'run', 'overlay', 'linux-src', 'linux-config', 'host-init', 'cfg-file', 'bin', 'img', 'spike', 'post_run_hook']

# These are the options that should be inherited from base configs (if not
# explicitly provided)
configInherit = ['runSpec', 'files', 'outputs', 'linux-src', 'linux-config', 'builder', 'distro', 'spike', 'launch', 'bin']
configInherit = ['runSpec', 'files', 'outputs', 'linux-src', 'linux-config', 'builder', 'distro', 'spike', 'launch', 'bin', 'post_run_hook']

# These are the permissible base-distributions to use (they get treated special)
distros = {
Expand Down
1 change: 1 addition & 0 deletions wlutil/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def installWorkload(cfgName, cfgs):
}

if 'post_run_hook' in targetCfg:
print("post_run_hook: " + targetCfg['post_run_hook'])
fsCfg["post_run_hook"] = fullRel(fsTargetDir, targetCfg['post_run_hook'])

if 'jobs' in targetCfg:
Expand Down
3 changes: 1 addition & 2 deletions wlutil/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def launchWorkload(cfgName, cfgs, job='all', spike=False):
try:
run(config['post_run_hook'] + " " + baseResDir, cwd=config['workdir'], shell=True)
except sp.CalledProcessError as e:
log.error("Post run hook failed:")
log.error(e.output)
raise RuntimeError("Post run hook failed:\n" + e.output)

log.info("\nRun output available in: " + os.path.dirname(runResDir))
else:
Expand Down

0 comments on commit 964cd37

Please sign in to comment.