mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-30 22:54:18 +00:00 
			
		
		
		
	fix for leaked file descriptors in daq
This commit is contained in:
		| @@ -675,7 +675,7 @@ class RunConfiguration(object): | |||||||
|  |  | ||||||
|     def _finalize_device_config(self): |     def _finalize_device_config(self): | ||||||
|         self._load_default_config_if_necessary(self.device) |         self._load_default_config_if_necessary(self.device) | ||||||
|         config = _merge_config_dicts(self._raw_config.get(self.device), |         config = _merge_config_dicts(self._raw_config.get(self.device, {}), | ||||||
|                                      self._raw_config.get('device_config', {}), |                                      self._raw_config.get('device_config', {}), | ||||||
|                                      list_duplicates='all') |                                      list_duplicates='all') | ||||||
|         self.device_config = config |         self.device_config = config | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ import os | |||||||
| import sys | import sys | ||||||
| import csv | import csv | ||||||
| from collections import OrderedDict | from collections import OrderedDict | ||||||
|  | from multiprocessing import Process, Queue | ||||||
|  |  | ||||||
| from wlauto import Instrument, Parameter | from wlauto import Instrument, Parameter | ||||||
| from wlauto.exceptions import ConfigError, InstrumentError | from wlauto.exceptions import ConfigError, InstrumentError | ||||||
| @@ -209,7 +210,11 @@ class Daq(Instrument): | |||||||
|  |  | ||||||
|     def _execute_command(self, command, **kwargs): |     def _execute_command(self, command, **kwargs): | ||||||
|         # pylint: disable=E1101 |         # pylint: disable=E1101 | ||||||
|         result = daq.execute_command(self.server_config, command, **kwargs) |         q = Queue() | ||||||
|  |         p = Process(target=_send_daq_command, args=(q, self.server_config, command), kwargs=kwargs) | ||||||
|  |         p.start() | ||||||
|  |         result = q.get() | ||||||
|  |         p.join() | ||||||
|         if result.status == daq.Status.OK: |         if result.status == daq.Status.OK: | ||||||
|             pass  # all good |             pass  # all good | ||||||
|         elif result.status == daq.Status.OKISH: |         elif result.status == daq.Status.OKISH: | ||||||
| @@ -219,3 +224,8 @@ class Daq(Instrument): | |||||||
|         else: |         else: | ||||||
|             raise InstrumentError('DAQ: Unexpected result: {} - {}'.format(result.status, result.message)) |             raise InstrumentError('DAQ: Unexpected result: {} - {}'.format(result.status, result.message)) | ||||||
|         return result.data |         return result.data | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def _send_daq_command(q, *args, **kwargs): | ||||||
|  |     result = daq.execute_command(*args, **kwargs) | ||||||
|  |     q.put(result) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user