예제 #1
0
 def track_load(self, value):
     if not self._track_load:
         # make this lazy to avoid loading the config in __init__
         self._track_load = ucr_load_counter(self.config.engine_id,
                                             'ucr_report',
                                             self.config.domain)
     self._track_load(value)
예제 #2
0
def get_indicator_adapter(config, raise_errors=False, load_source="unknown"):
    from corehq.apps.userreports.sql.adapter import IndicatorSqlAdapter, ErrorRaisingIndicatorSqlAdapter
    if raise_errors:
        adapter = ErrorRaisingIndicatorSqlAdapter(config)
    else:
        adapter = IndicatorSqlAdapter(config)

    track_load = ucr_load_counter(config.engine_id, load_source, config.domain)
    return IndicatorAdapterLoadTracker(adapter, track_load)
예제 #3
0
def get_indicator_adapter(config, raise_errors=False, load_source="unknown"):
    from corehq.apps.userreports.sql.adapter import IndicatorSqlAdapter, ErrorRaisingIndicatorSqlAdapter, \
        MultiDBSqlAdapter, ErrorRaisingMultiDBAdapter
    requires_mirroring = config.mirrored_engine_ids
    if requires_mirroring and ENABLE_UCR_MIRRORS.enabled(config.domain):
        adapter_cls = ErrorRaisingMultiDBAdapter if raise_errors else MultiDBSqlAdapter
    else:
        adapter_cls = ErrorRaisingIndicatorSqlAdapter if raise_errors else IndicatorSqlAdapter
    adapter = adapter_cls(config)
    track_load = ucr_load_counter(config.engine_id, load_source, config.domain)
    return IndicatorAdapterLoadTracker(adapter, track_load)
예제 #4
0
 def track_load(self, value):
     if not self._track_load:
         # make this lazy to avoid loading the config in __init__
         self._track_load = ucr_load_counter(self.config.engine_id, 'ucr_report', self.config.domain)
     self._track_load(value)