From 64ec44085d9d26fbd80284be7ba42572d802d47d Mon Sep 17 00:00:00 2001 From: = Date: Tue, 22 Aug 2017 17:52:15 +0200 Subject: [PATCH] Dynamically choose correct port for LevelDB in script --- bin/BrowseWarningPaste.py | 4 +++- bin/LAUNCH.sh | 1 - bin/Repartition_graph.py | 5 ++++- bin/packages/config.cfg.sample | 2 -- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/BrowseWarningPaste.py b/bin/BrowseWarningPaste.py index 01704902..4f49f56b 100755 --- a/bin/BrowseWarningPaste.py +++ b/bin/BrowseWarningPaste.py @@ -28,9 +28,11 @@ if __name__ == "__main__": p = Process(config_section) + # port generated automatically depending on the date + curYear = datetime.now().year server = redis.StrictRedis( host=p.config.get("Redis_Level_DB", "host"), - port=p.config.get("Redis_Level_DB", "port"), + port=curYear, db=p.config.get("Redis_Level_DB", "db")) # FUNCTIONS # diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index f33af903..05c408b0 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -66,7 +66,6 @@ function launching_redis { function launching_lvldb { #Want to launch more level_db? - #FIXME update the date in config.cfg lvdbhost='127.0.0.1' lvdbdir="${AIL_HOME}/LEVEL_DB_DATA/" db1_y='2016' diff --git a/bin/Repartition_graph.py b/bin/Repartition_graph.py index f1955a0e..a8094bb0 100755 --- a/bin/Repartition_graph.py +++ b/bin/Repartition_graph.py @@ -4,6 +4,7 @@ import redis import argparse import ConfigParser +from datetime import datetime from pubsublogger import publisher import matplotlib.pyplot as plt @@ -28,9 +29,11 @@ def main(): args = parser.parse_args() # REDIS # + # port generated automatically depending on the date + curYear = datetime.now().year r_serv = redis.StrictRedis( host=cfg.get("Redis_Level_DB_Hashs", "host"), - port=cfg.getint("Redis_Level_DB_Hashs", "port"), + port=curYear, db=cfg.getint("Redis_Level_DB_Hashs", "db")) # LOGGING # diff --git a/bin/packages/config.cfg.sample b/bin/packages/config.cfg.sample index 2e2d246d..1adaf04d 100644 --- a/bin/packages/config.cfg.sample +++ b/bin/packages/config.cfg.sample @@ -104,7 +104,6 @@ db = 5 [Redis_Level_DB] host = localhost -port = 2016 db = 0 [Redis_Level_DB_Trending] @@ -114,7 +113,6 @@ db = 3 [Redis_Level_DB_Hashs] host = localhost -port = 2016 db = 1 [Url]