def set_sampling_strategies(self, filter, strategy_and_parms):
        """Set sampling strategies for filtered sensors - these sensors have to exsist"""
        result_list = yield self.list_sensors(filter=filter)
        sensor_dict = {}
        for result in result_list:
            sensor_name = result.object.normalised_name
            resource_name = result.object.parent_name
            if resource_name not in sensor_dict:
                sensor_dict[resource_name] = {}
            try:
                resource_obj = self.children[resource_name]
                yield resource_obj.set_sampling_strategy(sensor_name, strategy_and_parms)
                sensor_dict[resource_name][sensor_name] = strategy_and_parms
                self._logger.debug(
                    'Set sampling strategy on resource %s for %s'
                    % (resource_name, sensor_name))
            except Exception as exc:
                self._logger.error(
                    'Cannot set sampling strategy on resource %s for %s (%s)'
                    % (resource_name, sensor_name, exc))
                sensor_dict[resource_name][sensor_name] = None
        raise tornado.gen.Return(sensor_dict)
def set_sampling_strategies ( self , filter , strategy_and_parms ) : result_list = yield self . list_sensors ( filter = filter ) sensor_dict = { } for result in result_list : sensor_name = result . object . normalised_name resource_name = result . object . parent_name if resource_name not in sensor_dict : sensor_dict [ resource_name ] = { } try : resource_obj = self . children [ resource_name ] yield resource_obj . set_sampling_strategy ( sensor_name , strategy_and_parms ) sensor_dict [ resource_name ] [ sensor_name ] = strategy_and_parms self . _logger . debug ( 'Set sampling strategy on resource %s for %s' % ( resource_name , sensor_name ) ) except Exception as exc : self . _logger . error ( 'Cannot set sampling strategy on resource %s for %s (%s)' % ( resource_name , sensor_name , exc ) ) sensor_dict [ resource_name ] [ sensor_name ] = None raise tornado . gen . Return ( sensor_dict )
Set sampling strategies for filtered sensors - these sensors have to exsist