Beispiel #1
0
def _build_redis_phases(by_aei_data: List[str], in_key: str,
                        orbital_elem_set: ResonanceOrbitalElementSetFacade) \
        -> List[Dict[str, float]]:
    pipe = REDIS.pipeline()
    serialized_phases = []
    for year, value in orbital_elem_set.get_resonant_phases(by_aei_data):
        serialized_phase = dict(year=year, value=value)
        pipe = pipe.rpush(in_key, '%s' % serialized_phase)
        serialized_phases.append(serialized_phase)
    pipe.execute()
    return serialized_phases
Beispiel #2
0
def _save_redis(serialized_phases: List[Dict[str, float]], in_key: str):
    pipe = REDIS.pipeline()
    for phase in serialized_phases:
        pipe = pipe.rpush(in_key, '%s' % phase)
    pipe.execute()