How to use _get_platform_information method in lisa

Best Python code snippet using lisa_python

work_load.py

Source:work_load.py Github

copy

Full Screen

...13 def __init__(self, config=None, component='backend'):14 self.config = config15 self.component = component16 self.db = StatisticDbUpdater(config=self.config)17 self.platform_information = self._get_platform_information()18 logging.debug('{}: Online'.format(self.component))19 def shutdown(self):20 logging.debug('{}: shutting down -> set offline message'.format(self.component))21 self.db.update_statistic(self.component, {'status': 'offline', 'last_update': time()})22 self.db.shutdown()23 def update(self, unpacking_workload=None, analysis_workload=None, compare_workload=None):24 stats = {25 'name': self.component,26 'status': 'online',27 'last_update': time(),28 'system': self._get_system_information(),29 'platform': self.platform_information,30 }31 if unpacking_workload:32 stats['unpacking'] = unpacking_workload33 if analysis_workload:34 stats['analysis'] = analysis_workload35 if compare_workload:36 stats['compare'] = compare_workload37 self.db.update_statistic(self.component, stats)38 def _get_system_information(self):39 memory_usage = psutil.virtual_memory()40 try:41 disk_usage = psutil.disk_usage(self.config['data_storage']['firmware_file_storage_directory'])42 except Exception:43 disk_usage = psutil.disk_usage('/')44 try:45 cpu_freq = psutil.cpu_freq().current46 except Exception:47 cpu_freq = 'unknown'48 result = {49 'cpu_cores': psutil.cpu_count(logical=False),50 'virtual_cpu_cores': psutil.cpu_count(),51 'cpu_freq': cpu_freq,52 'load_average': ', '.join(str(x) for x in os.getloadavg()),53 'memory_total': memory_usage.total,54 'memory_used': memory_usage.used,55 'memory_percent': memory_usage.percent,56 'disk_total': disk_usage.total,57 'disk_used': disk_usage.used,58 'disk_percent': disk_usage.percent59 }60 return result61 @staticmethod62 def _get_platform_information():63 operating_system = ' '.join(distro.linux_distribution()[0:2])64 python_version = '.'.join(str(x) for x in sys.version_info[0:3])65 fact_version = __VERSION__66 return {67 'os': operating_system,68 'python': python_version,69 'fact_version': fact_version...

Full Screen

Full Screen

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 lisa 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