[dvsim] Remove "status" from Deploy items
Before this patch, the scheduler code in dvsim had two notions of
the status of a job:
- Deploy.status (stored in each job)
- TargetStatus.counters (a count of passes/fails)
This patch removes the first of the two, to more cleanly split "run
some stuff and collect the results" (done by the scheduler) from "how
do I run this job?" (done by the Deploy object).
There are some extra changes we have to make to get this to work.
Firstly, we move the SIGINT handling code into Runner.py: this belongs
around the code that actually runs something, not at the top of
dvsim.py. That means that the "kill some stuff" logic can now be
triggered in the main thread via a threading.Event, which avoids lots
of code running in the signal handler and is probably a bit safer.
Secondly, we have to explicitly return the results of running jobs
from Scheduler.run() and thread them through FlowCfg.gen_results(). As
it turns out, most of the subclasses of FlowCfg figure out
success/failure by loading generated hjson files, so this actually
only needs updating in SimCfg.py.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/util/dvsim/dvsim.py b/util/dvsim/dvsim.py
index 869f23b..7f2fdea 100755
--- a/util/dvsim/dvsim.py
+++ b/util/dvsim/dvsim.py
@@ -28,7 +28,6 @@
import subprocess
import sys
import textwrap
-from signal import SIGINT, signal
import Deploy
from Scheduler import Scheduler
@@ -186,14 +185,6 @@
return proj_root_src, proj_root_dest
-def sigint_handler(signal_received, frame):
- # Kill processes and background jobs.
- log.debug('SIGINT or CTRL-C detected. Exiting gracefully')
- cfg.kill()
- log.info('Exit due to SIGINT or CTRL-C ')
- exit(1)
-
-
def copy_repo(src, dest, dry_run):
'''Copy over the repo to a new location.
@@ -647,9 +638,6 @@
global cfg
cfg = make_cfg(args.cfg, args, proj_root)
- # Handle Ctrl-C exit.
- signal(SIGINT, sigint_handler)
-
# List items available for run if --list switch is passed, and exit.
if args.list is not None:
cfg.print_list()
@@ -677,10 +665,10 @@
if args.items != []:
# Create deploy objects.
cfg.create_deploy_objects()
- cfg.deploy_objects()
+ results = cfg.deploy_objects()
# Generate results.
- cfg.gen_results()
+ cfg.gen_results(results)
# Publish results
if args.publish: