How to use find_repository_host method in autotest

Best Python code snippet using autotest_python

retrieve_logs.py

Source: retrieve_logs.py Github

copy

Full Screen

...37 _retrieve_dummy)38site_find_repository_host = utils.import_site_function(__file__,39 "autotest.tko.site_retrieve_logs", "site_find_repository_host",40 _retrieve_dummy)41def find_repository_host(job_path):42 '''43 Find the machine holding the given logs and return a URL to the logs44 :param job_path: when this was a CGI script, this value came from the45 'job' variable, which was usually composed of '/​results/​' +46 a path such as '1-autotest' or '1-autotest/​status.log'47 :type job_path: str48 :returns: a tuple with three members: protocol (such as "http"), host49 (such as "foo.bar.com") and a path such as "/​results/​1-autotest"50 :rtype: tuple or None51 '''52 site_repo_info = site_find_repository_host(job_path)53 if site_repo_info is not None:54 return site_repo_info55 results_repos = [RESULTS_HOST]56 for drone in DRONES.split(','):57 drone = drone.strip()58 if drone not in results_repos:59 results_repos.append(drone)60 if ARCHIVE_HOST and ARCHIVE_HOST not in results_repos:61 results_repos.append(ARCHIVE_HOST)62 for drone in results_repos:63 if drone == 'localhost':64 continue65 http_path = 'http:/​/​%s%s' % (drone, job_path)66 try:67 logging.info('Attempting to access the selected results URL: "%s"',68 http_path)69 utils.urlopen(http_path)70 return 'http', utils.normalize_hostname(drone), job_path71 except urllib2.URLError:72 logging.error('Failed to access the selected results URL. '73 'Reverting to usual results location')74 pass75def get_full_url(info, log_path):76 '''77 Returns the full URL of the requested log path78 :param info: a 3 element tuple such with protocol, host and path, usually79 the output from the find_repository_host function.80 :type info: tuple81 :param log_path: when this was a CGI script, this value came from the82 'job' variable, which was usually composed of '/​results/​' +83 a path such as '1-autotest' or '1-autotest/​status.log'84 :type log_path: str85 :returns: the full url of the log file or directory request86 :rtype: str87 '''88 if info is not None:89 protocol, host, path = info90 prefix = '%s:/​/​%s' % (protocol, host)91 else:92 prefix = ''93 path = log_path94 return prefix + path95def retrieve_logs(path):96 host = find_repository_host(path)97 if host is None:98 logging.info('No special host was found holding the results')99 # It's not clear what was intended here. Maybe some custom action to100 # fetch/​unpack the logs?101 site_retrieve_logs(path)102 results_url = get_full_url(host, path)103 logging.info('Results url: %s', results_url)104 return results_url105if __name__ == '__main__':106 logging_manager.configure_logging(LoggingConfig(), verbose=True)107 if len(sys.argv) <= 1:108 logging.error('Usage: %s [log_path]', sys.argv[0])109 raise SystemExit110 path = sys.argv[1]...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

June ‘21 Updates: Live With Cypress Testing, LT Browser Made Free Forever, YouTrack Integration &#038; More!

Howdy testers! June has ended, and it’s time to give you a refresher on everything that happened at LambdaTest over the last month. We are thrilled to share that we are live with Cypress testing and that our very own LT Browser is free for all LambdaTest users. That’s not all, folks! We have also added a whole new range of browsers, devices & features to make testing more effortless than ever.

Migrating Test Automation Suite To Cypress 10

There are times when developers get stuck with a problem that has to do with version changes. Trying to run the code or test without upgrading the package can result in unexpected errors.

Getting Rid of Technical Debt in Agile Projects

Technical debt was originally defined as code restructuring, but in today’s fast-paced software delivery environment, it has evolved. Technical debt may be anything that the software development team puts off for later, such as ineffective code, unfixed defects, lacking unit tests, excessive manual tests, or missing automated tests. And, like financial debt, it is challenging to pay back.

Introducing LambdaTest Analytics: Test Reporting Made Awesome ????

Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful