def _publish(self, files): "Publishes files to the target device" runner = RemoteRunner(cluster=self.cluster, ipaddress=self.ipaddress, username=self.username, password=self.password, source_files=files, target_dir=self.target_dir, verbose=True, cleanup=False) runner.run_command()
def run_test(self): """Runs the test""" try: if not self.test: self.get_model() self.make_project() self.get_bash_files() start_time = time.time() runner = RemoteRunner(cluster=self.cluster, ipaddress=self.ipaddress, username=self.username, password=self.password, source_dir=self.output_dir, target_dir=self.target_dir, command="runtest.sh", verbose=self.verbose, start_clean=not self.test, timeout=self.timeout, cleanup=False) output = runner.run_command() self.verify_remote_test(output) end_time = time.time() print("Remote test time: %f seconds" % (end_time - start_time)) except: errorType, value, traceback = sys.exc_info() print("### Exception: " + str(errorType) + ": " + str(value)) raise Exception("### Test Failed")
def run(self): """Main run method""" self._configure_script(os.path.join(self.output_dir, "validate.sh")) # Other files are copied by drivetest.py for f in [ os.path.join(_current_script_directory, "..", "procmon.py"), os.path.join(_current_script_directory, "..", "dependency_installer.py"), os.path.join(_current_script_directory, "validate.py") ]: copyfile(f, os.path.join(self.output_dir, os.path.basename(f))) runner = RemoteRunner( cluster=self.cluster, ipaddress=self.ipaddress, username=self.username, password=self.password, source_dir=self.output_dir, target_dir=self.target_dir, command="validate.sh", verbose=True, copyback_files=[ 'validation.json', 'validation.log', 'procmon.json' ], copyback_dir=self.output_dir, start_clean=False, # reuse what drivetest.py already setup cleanup=False) output = runner.run_command()
def run_test(self): """Runs the test""" try: if self.compile: self.get_model() self.wrap_project() self.get_bash_files() self.remove_bitcode() if self.test: start_time = time.time() print("source={}".format(self.output_dir)) # do not pass cluster to remote runner because we've already locked the machine. runner = RemoteRunner(cluster=None, ipaddress=self.ipaddress, username=self.username, password=self.password, source_dir=self.output_dir, target_dir=self.target_dir, command="runtest.sh", verbose=self.verbose, start_clean=not self.test, timeout=self.timeout, cleanup=False) output = runner.run_command() self.verify_remote_test(output) end_time = time.time() self.logger.info("Remote test time: %f seconds" % (end_time - start_time)) except: errorType, value, traceback = sys.exc_info() self.logger.error("### Exception: " + str(errorType) + ": " + str(value) + "\n" + str(traceback)) raise Exception("### Test Failed")
def run_test(self): """Runs the test""" try: if self.compile: self.get_model() self.wrap_project() if self.target != "host": self.get_bash_files() self.remove_bitcode() if self.test: start_time = time.time() if self.target != "host": # do not pass cluster to remote runner because we've already locked the machine. runner = RemoteRunner(cluster=None, ipaddress=self.ipaddress, username=self.username, password=self.password, source_dir=self.output_dir, target_dir=self.target_dir, command="runtest.sh", verbose=self.verbose, start_clean=not self.test, timeout=self.timeout, cleanup=False) output = runner.run_command() else: sys.path.append(os.path.join(current_path, "..", "..", "wrap", "test")) mpp = __import__("wrap_test") mpp.make_project(self.output_dir) cmd = [ "python", os.path.join(current_path, "..", "pythonlibs", "vision", "demo.py"), self.labels_file, "--compiled_model", self.output_dir, "--model_name", self.model_name, "--image", os.path.join(current_path, "coffeemug.jpg"), "--nogui", "--iterations", str(self.iterations)] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) output = [] while True: line = proc.stdout.readline() if line != b"": output.append(line.decode("utf-8").rstrip()) else: break end_time = time.time() total_time = end_time - start_time self.verify_remote_test(output) self.logger.info("Remote test time: %f seconds" % (end_time - start_time)) return total_time except: errorType, value, traceback = sys.exc_info() self.logger.error("### Exception: " + str(errorType) + ": " + str(value) + "\n" + str(traceback)) raise Exception("### Test Failed")
"--all", help="run the command on all machines in the cluster (default False)", action="store_true") args = arg_parser.parse_args() command = ' '.join(args.command) if args.password: password = args.password else: password = getpass.getpass() runner = RemoteRunner(cluster=args.cluster, ipaddress=args.ipaddress, username=args.username, password=password, source_dir=args.source_dir, target_dir=args.target_dir, copyback_files=args.copyback_files, copyback_dir=args.copyback_dir, command=command, logfile=args.logfile, verbose=args.verbose, cleanup=args.cleanup, timeout=args.timeout) if args.all: runner.run_all() else: runner.run_command()