예제 #1
0
 def cache_queries(self) -> bool:
     return self.env.read(BoolVar('CACHE_QUERIES', False))
예제 #2
0
 def use_geocoding(self) -> bool:
     return self.env.read(BoolVar('USE_GEOCODING', False))
예제 #3
0
 def cache_geocoding(self) -> bool:
     return self.env.read(BoolVar('CACHE_GEOCODING', False))
예제 #4
0
 def use_geocoding(self) -> bool:
     return self.env.read(BoolVar(USE_GEOCODING_ENV_VAR, False))
예제 #5
0
 def cache_queries(self) -> bool:
     return self.env.read(BoolVar(CACHE_QUERIES_ENV_VAR, False))
예제 #6
0
def use_flask() -> bool:
    env_var = BoolVar('USE_FLASK', False)
    return EnvReader().safe_read(env_var)
예제 #7
0
 def keep_raw_entity(self) -> bool:
     var = BoolVar(KEEP_RAW_ENTITY_VAR, False)
     return self.store.safe_read(var)
예제 #8
0
from cache.factory import CacheEnvReader
from utils.cfgreader import EnvReader, BoolVar, IntVar, StrVar


def redis_connection() -> Redis:
    """
    :return: A pooled connection to the configured QuantumLeap Redis cache.
    """
    reader = CacheEnvReader()
    host = reader.redis_host() or 'localhost'
    port = reader.redis_port()
    return Redis(host=host, port=port)


OFFLOAD_WORK_VAR = BoolVar('WQ_OFFLOAD_WORK', False)


def offload_to_work_queue() -> bool:
    """
    Offload task execution to the work queue?

    :return: `True` to offload tasks to the work queue; `False` to execute
        them synchronously within the calling thread.
    """
    return EnvReader().safe_read(OFFLOAD_WORK_VAR)


RECOVER_FROM_ENQUEUEING_FAILURE_VAR = \
    BoolVar('WQ_RECOVER_FROM_ENQUEUEING_FAILURE', False)