def _detach_device(self, device): try: self.parent.server.stop_work(self.excavator_algorithm, device) except (socket.error, socket.timeout): raise miner.MinerNotRunning('could not connect to excavator') else: self.devices.remove(device)
def current_speeds(self): try: workers = [self.parent.server.device_speeds(device) for device in self.devices] except (socket.error, socket.timeout): raise miner.MinerNotRunning('could not connect to excavator') else: total_speed = lambda algorithm: sum([w[algorithm] for w in workers if algorithm in w]) return [total_speed(algorithm) for algorithm in self.excavator_algorithm.split('_')]