예제 #1
0
    def __init__(self, **kwargs):
        self.key = kwargs['key']
        self.logger = PrintManager('ValueHotspot', kwargs.get('verbose', 0))
        self.allow_wildcarding = kwargs.get('allow_wildcarding', False)
        self.find_supersets = kwargs.get('find_supersets', False)
        self.preempt = int(kwargs.get('preempt', 60))
        self.fields = kwargs.get('fields', None)
        self.instance = kwargs.get('instance', 'cms_dbs_prod_global')
        
        HotspotBase.__init__(self,
                             identifier="valuehotspot-%s" % \
                             (self.key.replace('.','-')),
                             **kwargs)
        
        # set fields if look-up key is present
        if  not self.fields and self.key:
            self.fields = [self.key.split('.')[0]]

        # finally if fields is not yet set, look-up all DAS keys allowed
        # for given query
        if  not self.fields:
            try:
                self.fields = set()
                self.das.mapping.init_presentationcache()
                plist = self.das.mapping.presentation(self.key.split('.', 1)[0])
                for item in plist:
                    if 'link' in item:
                        for link in item['link']:
                            if len(link['query'].split(' ')) == 2:
                                self.fields.add(link['query'].split(' ')[0])
                self.fields.add(self.key.split('.', 1)[0])
                self.fields = list(self.fields)
            except:
                self.fields = []
예제 #2
0
파일: key_hotspot.py 프로젝트: ktf/DAS
    def __init__(self, **kwargs):

        self.child_interval = kwargs.get('child_interval', 3600*4)
        self.child_preempt = kwargs.get('child_preempt', 300)
        HotspotBase.__init__(identifier="keyhotspot",
                             **kwargs)