def test_service(): (code, fatal, non_fatal) = service_tester.test_service() if code < 0: send_bot_email_to_maintainers("BigSemantics service connection failure", fatal) elif code != 200: send_bot_email_to_maintainers("BigSemantics service failure", fatal) else: if len(non_fatal) > 0: send_bot_email_to_maintainers("BigSemantics service issue(s)", non_fatal) else: print "BS service seems to be working fine."
def test_service(): (code, fatal, non_fatal) = service_tester.test_service() if code < 0: send_bot_email_to_maintainers( "BigSemantics service connection failure", fatal) elif code != 200: send_bot_email_to_maintainers("BigSemantics service failure", fatal) else: if len(non_fatal) > 0: send_bot_email_to_maintainers("BigSemantics service issue(s)", non_fatal) else: print "BS service seems to be working fine."
from bs_service_tester import ServiceTester from bot_email import send_bot_email_to_maintainers service_tester = ServiceTester() def test_service(): (code, fatal, non_fatal) = service_tester.test_service() if code < 0: send_bot_email_to_maintainers("BigSemantics service connection failure", fatal) elif code != 200: send_bot_email_to_maintainers("BigSemantics service failure", fatal) else: if len(non_fatal) > 0: send_bot_email_to_maintainers("BigSemantics service issue(s)", non_fatal) else: print "BS service seems to be working fine." if __name__ == '__main__': try: test_service() except Exception as e: err_msg = "Error testing the service: " + e.message print err_msg send_bot_email_to_maintainers("Error testing BigSemantics service", err_msg)
dest_static_html_dir = join(self.prod_webapps_dir, "root") dest_dir = "{0}@{1}:{2}".format(self.prod_user, self.prod_host, dest_static_html_dir) cmds = ["scp", "-i", self.prod_login_id, onto_vis_data_file, dest_dir] check_call(cmds, wd = onto_vis_dir) # generate and copy the example table data file example_table_script = "generate_domain_example_table.py" example_table_data_file = "domain_type_examples.json" cmds = ["python", example_table_script, "--out", example_table_data_file] check_call(cmds, wd = onto_vis_dir) cmds = ["scp", "-i", self.prod_login_id, example_table_data_file, dest_dir] check_call(cmds, wd = onto_vis_dir) if __name__ == "__main__": builder = ServiceBuilder() try: builder.pull_wrappers() builder.compile_wrappers_to_jars() builder.build_service_war() builder.start_local_service() builder.test_local_service_and_release() print "everything done." except Exception as e: import sys sys.stderr.write("dev build failed! see email notification.") send_bot_email_to_maintainers("Dev build failed.", str(e))
if code != 200 or len(fatal) > 0 or len(non_fatal) > 0: raise exceptions.RuntimeError( "Build broken:\n code: {}\n fatal: {}\n non_fatal: {}".format( code, fatal, non_fatal)) else: self.archive_local_service() print "tested and archived.\n" def release_to_prod(self): self.release_service(self.prod_deploy_dir, self.prod_host, self.prod_user, self.prod_login_id) if __name__ == "__main__": builder = ServiceBuilder() try: builder.update_projs() builder.compile_projs() builder.start_local_service() builder.test_local_service_and_archive() builder.release_to_prod() print "everything done." except Exception as e: msg = str(e) print "Error:", msg import sys sys.stderr.write("dev build failed! see email notification.") send_bot_email_to_maintainers("Dev build failed.", msg)
#!/usr/bin/python from downloaders import downloader_config, Downloaders from bot_email import send_bot_email_to_maintainers nodes = downloader_config["downloaders"] ds = Downloaders() i = 0 code_out_errs = ds.do("ps -C java -o command --no-headers") for (code, out, err) in code_out_errs: node = nodes[i] if code == 0 and out.startswith("java ") and out.find("Downloader.jar") >= 0: print "Running: " + node.host + ": " + out else: print "Not running: " + node.host run_on_host = lambda h: h == node.host (ncode, nout, nerr) = ds.run_downloaders(run_on_host)[0] if ncode != 0: print "Sending failure notification for " + node.host send_bot_email_to_maintainers( "Failed to relaunch downloader: " + node.host, "Output:\n" + nout + "\nError:\n" + nerr) i += 1
#!/usr/bin/python from downloaders import downloader_config, Downloaders from bot_email import send_bot_email_to_maintainers nodes = downloader_config["downloaders"] ds = Downloaders() i = 0 code_out_errs = ds.do("ps -C java -o command --no-headers") for (code, out, err) in code_out_errs: node = nodes[i] if code == 0 and out.startswith( "java ") and out.find("Downloader.jar") >= 0: print "Running: " + node.host + ": " + out else: print "Not running: " + node.host run_on_host = lambda h: h == node.host (ncode, nout, nerr) = ds.run_downloaders(run_on_host)[0] if ncode != 0: print "Sending failure notification for " + node.host send_bot_email_to_maintainers( "Failed to relaunch downloader: " + node.host, "Output:\n" + nout + "\nError:\n" + nerr) i += 1
dest_dir = "{0}@{1}:{2}".format(self.prod_user, self.prod_host, self.prod_webapps_dir) cmds = ["scp", "-i", self.prod_login_id, war_file, dest_dir] check_call(cmds, wd = self.webapps_dir) onto_vis_dir = join(self.wrapper_proj, "OntoViz") onto_vis_data_file = "mmd_repo.json" dest_static_html_dir = join(self.prod_webapps_dir, "root") dest_dir = "{0}@{1}:{2}".format(self.prod_user, self.prod_host, dest_static_html_dir) cmds = ["scp", "-i", self.prod_login_id, onto_vis_data_file, dest_dir] check_call(cmds, wd = onto_vis_dir) if __name__ == "__main__": builder = ServiceBuilder() try: builder.pull_wrappers() builder.compile_wrappers_to_jars() builder.build_service_war() builder.start_local_service() builder.test_local_service_and_release() print "everything done." except Exception as e: import sys sys.stderr.write("dev build failed! see email notification.") send_bot_email_to_maintainers("Dev build failed.", str(e))