Dynamically choose correct port for LevelDB in script

pull/136/head
= 2017-08-22 17:52:15 +02:00
parent 66d60a1f01
commit 64ec44085d
4 changed files with 7 additions and 5 deletions

View File

@ -28,9 +28,11 @@ if __name__ == "__main__":
p = Process(config_section) p = Process(config_section)
# port generated automatically depending on the date
curYear = datetime.now().year
server = redis.StrictRedis( server = redis.StrictRedis(
host=p.config.get("Redis_Level_DB", "host"), 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")) db=p.config.get("Redis_Level_DB", "db"))
# FUNCTIONS # # FUNCTIONS #

View File

@ -66,7 +66,6 @@ function launching_redis {
function launching_lvldb { function launching_lvldb {
#Want to launch more level_db? #Want to launch more level_db?
#FIXME update the date in config.cfg
lvdbhost='127.0.0.1' lvdbhost='127.0.0.1'
lvdbdir="${AIL_HOME}/LEVEL_DB_DATA/" lvdbdir="${AIL_HOME}/LEVEL_DB_DATA/"
db1_y='2016' db1_y='2016'

View File

@ -4,6 +4,7 @@
import redis import redis
import argparse import argparse
import ConfigParser import ConfigParser
from datetime import datetime
from pubsublogger import publisher from pubsublogger import publisher
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -28,9 +29,11 @@ def main():
args = parser.parse_args() args = parser.parse_args()
# REDIS # # REDIS #
# port generated automatically depending on the date
curYear = datetime.now().year
r_serv = redis.StrictRedis( r_serv = redis.StrictRedis(
host=cfg.get("Redis_Level_DB_Hashs", "host"), 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")) db=cfg.getint("Redis_Level_DB_Hashs", "db"))
# LOGGING # # LOGGING #

View File

@ -104,7 +104,6 @@ db = 5
[Redis_Level_DB] [Redis_Level_DB]
host = localhost host = localhost
port = 2016
db = 0 db = 0
[Redis_Level_DB_Trending] [Redis_Level_DB_Trending]
@ -114,7 +113,6 @@ db = 3
[Redis_Level_DB_Hashs] [Redis_Level_DB_Hashs]
host = localhost host = localhost
port = 2016
db = 1 db = 1
[Url] [Url]