Best Python code snippet using autotest_python
rpc_interface.py
Source:rpc_interface.py
...1085 Return interface version.1086 :return: Sequence with year, month number, day.1087 """1088 return INTERFACE_VERSION1089def _get_logs_used_space():1090 """1091 (Internal) Return disk usage (percentage) for the results directory.1092 :return: Usage in percents (integer value).1093 """1094 logs_dir = settings.get_value('COMMON', 'test_output_dir', default=None)1095 autodir = os.path.abspath(os.path.join(os.path.dirname(__file__),1096 '..', '..'))1097 if logs_dir is None:1098 logs_dir = os.path.join(autodir, 'results')1099 usage = psutil.disk_usage(logs_dir)1100 return int(usage.percent)1101def _process_running(process_name):1102 """1103 (Internal) Return whether a given process name is running.1104 :param process_name: The name of the process.1105 :return: True (running) or False (no).1106 """1107 process_running = False1108 for p in psutil.process_iter():1109 for args in p.cmdline:1110 if os.path.basename(args) == process_name and p.is_running:1111 process_running = True1112 return process_running1113def get_server_status():1114 """1115 Get autotest server system information.1116 :return: Dict with keys:1117 * 'disk_space_percentage' Autotest log directory disk usage1118 * 'scheduler_running' Whether the autotest scheduler is running1119 * 'sheduler_watcher_running' Whether the scheduler watcher is1120 running1121 * 'concerns' Global evaluation of whether there are problems to1122 be addressed1123 """1124 server_status = {}1125 concerns = False1126 disk_treshold = int(settings.get_value('SERVER', 'logs_disk_usage_treshold',1127 default="80"))1128 used_space_logs = _get_logs_used_space()1129 if used_space_logs > disk_treshold:1130 concerns = True1131 server_status['used_space_logs'] = used_space_logs1132 scheduler_running = _process_running('autotest-scheduler')1133 if not scheduler_running:1134 concerns = True1135 server_status['scheduler_running'] = scheduler_running1136 watcher_running = _process_running('autotest-scheduler-watcher')1137 if not watcher_running:1138 concerns = True1139 server_status['scheduler_watcher_running'] = watcher_running1140 if settings.get_value('INSTALL_SERVER', 'xmlrpc_url', default=''):1141 install_server_running = get_install_server_profiles() is not None1142 if not install_server_running:...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!