def _parse_data_point_metadata_as_filters(self, data_point):
     if not data_point:
         return ''
     dpc = DataPointController(data_point)
     metadata_filters = dpc.get_metadata_filters()
     if not metadata_filters:
         return ''
     data_point_metadata_filters = '&'.join(['facet.field=%s&f.%s.facet.mincount=1' % (f['name'], f['name']) for f in metadata_filters if f['type'] != 'float'])
     data_point_metadata_stats = '&'.join(['stats.field=%s' % f['name'] for f in metadata_filters if f['type'] == 'float'])
     return '&'.join([data_point_metadata_filters, data_point_metadata_stats])
def run_aggregator_for_data_point(data_point, actions=None):
    Logger.Info('%s - run_aggregator_for_data_point - started' % __name__)
    Logger.Debug('%s - run_aggregator_for_data_point - started with data_point:%s and actions:%s' % (__name__, data_point, actions))
    if not actions:
        actions = []
    dpc = DataPointController(data_point)
    content = dpc.run_data_point()
    content = _filter_content_by_last_successful_run(actions, content, data_point)
    apply_actions_and_post_to_solr(actions, content)
    Logger.Info('%s - run_aggregator_for_data_point - finished' % __name__)
 def AggregateMultipleDataPointHistoryWithAction(cls, action, data_points, historic_limit):
     Logger.Info('%s - AggregationController.AggregateMultipleDataPointHistoryWithAction - started' % __name__)
     Logger.Debug('%s - AggregationController.AggregateMultipleDataPointHistoryWithAction - started with action:%s and data_point:%s and historic_limit:%s' % (__name__, action, data_points, historic_limit))
     for data_point in data_points:
         dpc = DataPointController(data_point)
         solr_url = settings.SOLR_CONFIG['solr_url']
         solr_url = '%s/select/?q=*:*&wt=json&sort=time+desc&rows=%i&fq=source_id:%s' % (solr_url, historic_limit, dpc.generate_configured_guid())
         try:
             request = urllib2.Request(solr_url)
             response = urllib2.urlopen(request)
             response = json.loads(response.read())
         except Exception, e:
             Logger.Error('%s - AggregationController.AggregateMultipleDataPointHistoryWithAction - error:%s' % (__name__, e))
             Logger.Info('%s - AggregationController.AggregateMultipleDataPointHistoryWithAction - finished' % __name__)
             return
         content_from_solr = response['response']['docs']
         content_with_action_applied = apply_actions_to_content_with_historical_check(content_from_solr, [action])
         post_content_to_solr(content_with_action_applied)
 def _parse_data_point_as_sources(self, data_point):
     Logger.Info('%s - SearchDataPointParser._parse_data_point - started' % __name__)
     dpc = DataPointController(data_point)
     data_point_query = 'source_id:%s' % dpc.generate_configured_guid()
     Logger.Info('%s - SearchDataPointParser._parse_data_point - finished' % __name__)
     return data_point_query