def submit(self, report_path, config, ts_name=None): """Submit the results file to the server. If no server was specified, use a local mock server. report_path is the location of the json report file. config holds options for submission url, and verbosity. Returns the report from the server. """ assert os.path.exists(report_path), "Failed report should have" \ " never gotten here!" assert ts_name is not None server_report = None if config.submit_url is not None: self.log("submitting result to %r" % (config.submit_url, )) server_report = ServerUtil.submitFile( config.submit_url, report_path, config.verbose, select_machine=config.select_machine, merge_run=config.merge) else: server_report = ImportData.no_submit() if server_report: ImportData.print_report_result(server_report, sys.stdout, sys.stderr, config.verbose) return server_report
def submit_helper(self, parsed_args): """Submit the report to the server. If no server was specified, use a local mock server. """ result = None if parsed_args.submit_url: from lnt.util import ServerUtil for server in parsed_args.submit_url: self.log("submitting result to %r" % (server,)) try: result = ServerUtil.submitFile( server, parsed_args.report_path, parsed_args.commit, parsed_args.verbose) except (urllib2.HTTPError, urllib2.URLError) as e: warning("submitting to {} failed with {}".format(server, e)) else: # Simulate a submission to retrieve the results report. # Construct a temporary database and import the result. self.log("submitting result to dummy instance") import lnt.server.db.v4db import lnt.server.config db = lnt.server.db.v4db.V4DB("sqlite:///:memory:", lnt.server.config.Config.dummyInstance()) result = lnt.util.ImportData.import_and_report( None, None, db, parsed_args.report_path, 'json', True) if result is None: fatal("results were not obtained from submission.") return result
def submit(self, report_path, config, ts_name=None): """Submit the results file to the server. If no server was specified, use a local mock server. report_path is the location of the json report file. config holds options for submission url, and verbosity. Returns the report from the server. """ assert os.path.exists(report_path), "Failed report should have" \ " never gotten here!" assert ts_name is not None server_report = None if config.submit_url is not None: self.log("submitting result to %r" % (config.submit_url,)) server_report = ServerUtil.submitFile( config.submit_url, report_path, config.verbose, select_machine=config.select_machine, merge_run=config.merge) else: server_report = ImportData.no_submit() if server_report: ImportData.print_report_result(server_report, sys.stdout, sys.stderr, config.verbose) return server_report
def submit_helper(self, parsed_args): """Submit the report to the server. If no server was specified, use a local mock server. """ result = None if parsed_args.submit_url: from lnt.util import ServerUtil for server in parsed_args.submit_url: self.log("submitting result to %r" % (server, )) try: result = ServerUtil.submitFile(server, parsed_args.report_path, parsed_args.commit, parsed_args.verbose) except (urllib2.HTTPError, urllib2.URLError) as e: warning("submitting to {} failed with {}".format( server, e)) else: # Simulate a submission to retrieve the results report. # Construct a temporary database and import the result. self.log("submitting result to dummy instance") import lnt.server.db.v4db import lnt.server.config db = lnt.server.db.v4db.V4DB( "sqlite:///:memory:", lnt.server.config.Config.dummyInstance()) result = lnt.util.ImportData.import_and_report( None, None, db, parsed_args.report_path, 'json', True) if result is None: fatal("results were not obtained from submission.") return result
def submit(self, report_path, config, commit=True): """Submit the results file to the server. If no server was specified, use a local mock server. report_path is the location of the json report file. config holds options for submission url, and verbosity. When commit is true, results will be saved in the server, otherwise you will just get back a report but server state is not altered. Returns the report from the server. """ assert os.path.exists(report_path), "Failed report should have" \ " never gotten here!" server_report = None if config.submit_url is not None: self.log("submitting result to %r" % (config.submit_url,)) server_report = ServerUtil.submitFile(config.submit_url, report_path, commit, config.verbose) else: # Simulate a submission to retrieve the results report. # Construct a temporary database and import the result. self.log("submitting result to dummy instance") db = lnt.server.db.v4db.V4DB("sqlite:///:memory:", server_config.Config.dummyInstance()) server_report = ImportData.import_and_report( None, None, db, report_path, 'json', commit) assert server_report is not None, "Results were not submitted." ImportData.print_report_result(server_report, sys.stdout, sys.stderr, config.verbose) return server_report
def submit(self, report_path, config, commit=True): """Submit the results file to the server. If no server was specified, use a local mock server. report_path is the location of the json report file. config holds options for submission url, and verbosity. When commit is true, results will be saved in the server, otherwise you will just get back a report but server state is not altered. Returns the report from the server. """ assert os.path.exists(report_path), "Failed report should have" \ " never gotten here!" server_report = None if config.submit_url is not None: self.log("submitting result to %r" % (config.submit_url, )) server_report = ServerUtil.submitFile(config.submit_url, report_path, commit, config.verbose) else: # Simulate a submission to retrieve the results report. # Construct a temporary database and import the result. self.log("submitting result to dummy instance") db = lnt.server.db.v4db.V4DB("sqlite:///:memory:", server_config.Config.dummy_instance()) server_report = ImportData.import_and_report( None, None, db, report_path, 'json', commit) assert server_report is not None, "Results were not submitted." ImportData.print_report_result(server_report, sys.stdout, sys.stderr, config.verbose) return server_report