mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
Small fixes to make the refactoring production ready
* the port for the logging is 6380 * use os.environ properly * fix typos
This commit is contained in:
parent
4f2575723a
commit
3886d1b834
32 changed files with 40 additions and 13 deletions
|
@ -38,6 +38,7 @@ def main():
|
|||
port=cfg.getint("Redis_Queues", "port"),
|
||||
db=cfg.getint("Redis_Queues", "db"))
|
||||
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
create_dirfile(r_serv, args.directory, args.ow)
|
||||
|
|
|
@ -20,7 +20,8 @@ import zmq
|
|||
class Redis_Queues(object):
|
||||
|
||||
def __init__(self, conf_section, conf_channel, subscriber_name):
|
||||
configfile = os.path.join(os.environ('AIL_BIN'), 'packages/config.cfg')
|
||||
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
||||
print configfile
|
||||
if not os.path.exists(configfile):
|
||||
raise Exception('Unable to find the configuration file. \
|
||||
Did you set environment variables? \
|
||||
|
|
|
@ -33,6 +33,7 @@ def main():
|
|||
db=cfg.getint("Redis_Queues", "db"))
|
||||
|
||||
# LOGGING #
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
# ZMQ #
|
||||
|
|
|
@ -34,6 +34,7 @@ def main():
|
|||
db=cfg.getint("Redis_Level_DB_Hashs", "db"))
|
||||
|
||||
# LOGGING #
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Graph"
|
||||
|
||||
# FUNCTIONS #
|
||||
|
|
|
@ -24,7 +24,7 @@ import redis
|
|||
import ConfigParser
|
||||
import os
|
||||
|
||||
configfile = os.path.join(os.environ('AIL_BIN'), './packages/config.cfg')
|
||||
configfile = os.path.join(os.environ['AIL_BIN'], './packages/config.cfg')
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -29,6 +29,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'Feed'
|
||||
|
@ -67,7 +68,7 @@ if __name__ == "__main__":
|
|||
time.sleep(10)
|
||||
continue
|
||||
# Creating the full filepath
|
||||
filename = os.path.join(os.environ('AIL_HOME'),
|
||||
filename = os.path.join(os.environ['AIL_HOME'],
|
||||
h.config.get("Directories", "pastes"), paste)
|
||||
dirname = os.path.dirname(filename)
|
||||
if not os.path.exists(dirname):
|
||||
|
|
|
@ -33,6 +33,6 @@ if __name__ == "__main__":
|
|||
config_channel = 'topicfilter'
|
||||
subscriber_name = 'feed'
|
||||
|
||||
h = Helper.Redis_Queues(subscriber_name)
|
||||
h = Helper.Redis_Queues(config_section, config_channel, subscriber_name)
|
||||
h.zmq_sub(config_section)
|
||||
h.redis_queue_subscribe(publisher)
|
||||
|
|
|
@ -36,7 +36,6 @@ Requirements
|
|||
*Need the ZMQ_PubSub_Tokenize_Q Module running to be able to work properly.
|
||||
|
||||
"""
|
||||
import glob
|
||||
import os
|
||||
import argparse
|
||||
import time
|
||||
|
@ -46,6 +45,7 @@ from packages import Paste
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Words'
|
||||
|
@ -75,10 +75,10 @@ if __name__ == "__main__":
|
|||
"Script Categ subscribed to channel {}".format(h.sub_channel))
|
||||
|
||||
tmp_dict = {}
|
||||
for filename in glob.glob(args.d):
|
||||
for filename in os.listdir(args.d):
|
||||
bname = os.path.basename(filename)
|
||||
tmp_dict[bname] = []
|
||||
with open(filename, 'r') as f:
|
||||
with open(os.path.join(args.d, filename), 'r') as f:
|
||||
for l in f:
|
||||
tmp_dict[bname].append(l.strip())
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = 'Queuing'
|
||||
|
||||
config_section = 'PubSub_Words'
|
||||
|
|
|
@ -35,6 +35,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -23,6 +23,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = "PubSub_Global"
|
||||
|
|
|
@ -30,6 +30,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Longlines'
|
||||
|
|
|
@ -24,6 +24,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Longlines'
|
||||
|
|
|
@ -27,6 +27,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Global"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -33,6 +33,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -24,6 +24,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -9,6 +9,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -7,6 +7,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -32,6 +32,7 @@ import os
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Words'
|
||||
|
@ -53,9 +54,9 @@ if __name__ == "__main__":
|
|||
publisher.info("Script Curve subscribed to {}".format(h.sub_channel))
|
||||
|
||||
# FILE CURVE SECTION #
|
||||
csv_path = os.path.join(os.environ('AIL_HOME'),
|
||||
csv_path = os.path.join(os.environ['AIL_HOME'],
|
||||
h.config.get("Directories", "wordtrending_csv"))
|
||||
wordfile_path = os.path.join(os.environ('AIL_HOME'),
|
||||
wordfile_path = os.path.join(os.environ['AIL_HOME'],
|
||||
h.config.get("Directories", "wordsfile"))
|
||||
|
||||
message = h.redis_rpop()
|
||||
|
|
|
@ -24,6 +24,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Words'
|
||||
|
|
|
@ -22,6 +22,7 @@ from pybloomfilter import BloomFilter
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
@ -48,7 +49,7 @@ if __name__ == "__main__":
|
|||
h.config.get("PubSub_Global", "channel")))
|
||||
|
||||
set_limit = 100
|
||||
bloompath = os.path.join(os.environ('AIL_HOME'),
|
||||
bloompath = os.path.join(os.environ['AIL_HOME'],
|
||||
h.config.get("Directories", "bloomfilters"))
|
||||
|
||||
bloop_path_set = set()
|
||||
|
|
|
@ -6,6 +6,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = 'Queuing'
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -21,6 +21,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
# Subscriber
|
||||
|
|
|
@ -18,6 +18,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Global'
|
||||
|
|
|
@ -12,6 +12,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -6,6 +6,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -30,6 +30,7 @@ from pubsublogger import publisher
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -23,6 +23,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -17,6 +17,7 @@ import ipaddress
|
|||
import Helper
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Script"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -7,6 +7,7 @@ import Helper
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
publisher.port = 6380
|
||||
publisher.channel = "Queuing"
|
||||
|
||||
config_section = 'PubSub_Categ'
|
||||
|
|
|
@ -22,12 +22,12 @@ def readdoc(path=None):
|
|||
f = gzip.open(path, 'r')
|
||||
return f.read()
|
||||
|
||||
configfile = os.path.join(os.environ('AIL_BIN'), 'packages/config.cfg')
|
||||
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
||||
cfg = ConfigParser.ConfigParser()
|
||||
cfg.read(configfile)
|
||||
|
||||
# Indexer configuration - index dir and schema setup
|
||||
indexpath = os.path.join(os.environ('AIL_HOME'), cfg.get("Indexer", "path"))
|
||||
indexpath = os.path.join(os.environ['AIL_HOME'], cfg.get("Indexer", "path"))
|
||||
indexertype = cfg.get("Indexer", "type")
|
||||
|
||||
argParser = argparse.ArgumentParser(description='Fulltext search for AIL')
|
||||
|
|
|
@ -56,7 +56,7 @@ class Paste(object):
|
|||
|
||||
def __init__(self, p_path):
|
||||
|
||||
configfile = os.path.join(os.environ('AIL_BIN'), 'packages/config.cfg')
|
||||
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
|
||||
if not os.path.exists(configfile):
|
||||
raise Exception('Unable to find the configuration file. \
|
||||
Did you set environment variables? \
|
||||
|
|
Loading…
Reference in a new issue