fix server to work without any data
This commit is contained in:
parent
c1a4f7eb3b
commit
cade421402
@ -38,14 +38,15 @@ print("Getting cache from redis")
|
|||||||
r = redis.Redis(host=os.environ.get("REDIS_HOST", "localhost"), port=6379, db=0)
|
r = redis.Redis(host=os.environ.get("REDIS_HOST", "localhost"), port=6379, db=0)
|
||||||
json_data = r.get('compressed_catalog')
|
json_data = r.get('compressed_catalog')
|
||||||
if not json_data:
|
if not json_data:
|
||||||
raise ValueError("No compressed catalog found in Redis")
|
print("Didn't find compressed tree in redis using empty tree")
|
||||||
|
c_tree = CompressedTree({})
|
||||||
else:
|
else:
|
||||||
print("Found compressed catalog in Redis")
|
|
||||||
|
|
||||||
print("Loading tree to json")
|
print("Loading tree to json")
|
||||||
compressed_tree_json = json.loads(json_data)
|
compressed_tree_json = json.loads(json_data)
|
||||||
c_tree = CompressedTree.from_json(compressed_tree_json)
|
c_tree = CompressedTree.from_json(compressed_tree_json)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print("Partialy decompressing tree, shoud be able to skip this step in future.")
|
print("Partialy decompressing tree, shoud be able to skip this step in future.")
|
||||||
tree = c_tree.reconstruct_compressed_ecmwf_style()
|
tree = c_tree.reconstruct_compressed_ecmwf_style()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user