Ejemplo n.º 1
0
 def __init__(self):
     lang.init()
     self._ = lang.getGettext()
     signal.signal(signal.SIGINT, self.clean)
     helper.connect()
     logger.init()
     self.loop()
Ejemplo n.º 2
0
def main():
    #config
    config = ConfigParser.RawConfigParser(allow_no_value=True)
    config.read('config')
    host = config.get('client', 'hostAddr')
    port = config.getint('client', 'hostPort')
    logPath = config.get('common', 'logPath')
    verbose = config.get('common', 'verbose')

    if verbose == "True" or verbose == "true":
        verbose = True
    else:
        verbose = False

    #setup
    logger.init(logPath, "client-" + str(datetime.datetime.now()))
    logger.debugFlag = verbose

    node = WorkingNode()
    node.connect(host, port)
    node.readConfig()
    node.run()

    while node.isActive:
        time.sleep(0.5)

    node.disconnect()
    logger.log(logging.INFO, "Exiting. ByeBye")
Ejemplo n.º 3
0
def main():
    signal.signal(signal.SIGINT, handler)
    logger.printAsciiLogo()
    config = ConfigParser.RawConfigParser(allow_no_value=True)
    config.read('config')
    host = config.get('server', 'listeningAddr')
    port = config.getint('server', 'listeningPort')
    logPath = config.get('common', 'logPath')
    verbose = config.get('common', 'verbose')
    if verbose == "True" or verbose == "true":
        verbose = True
    else:
        verbose = False

    #logging
    logger.init(logPath, "server-" + str(datetime.datetime.now()))
    logger.debugFlag = verbose

    #server
    server = Server(host, port)
    server.setup()
    #server.listen()
    thread.start_new_thread(server.listen, ()) #testing

    while server.isActive:
        time.sleep(0.5)

    #time.sleep(9) #testing
    #server.isActive = False
    #server.disconnectAllClient()
    logger.log(logging.INFO, "Exiting. ByeBye")
Ejemplo n.º 4
0
def main():
    signal.signal(signal.SIGINT, handler)
    logger.printAsciiLogo()

    #parse config file
    config = configuration.configParser()

    #logging
    logger.init(config.logPath, "server-" + str(datetime.datetime.now()))
    logger.debugFlag = config.verbose

    #node configration
    if config.crawling == 'dynamic':
        nodeConfig = protocol.ConfigurationPayload(
            protocol.ConfigurationPayload.DYNAMIC_CRAWLING, config)
    else:
        nodeConfig = protocol.ConfigurationPayload(
            protocol.ConfigurationPayload.STATIC_CRAWLING, config)

    #server
    server = Server(config.host, config.port)
    server.setup(nodeConfig)
    thread.start_new_thread(server.listen, ())  #testing

    while server.isActive:
        time.sleep(0.5)

    server.disconnectAllClient()
    ending()
Ejemplo n.º 5
0
 def __init__(self):
     lang.init()
     self._ = lang.getGettext()
     signal.signal(signal.SIGINT, self.clean)
     helper.connect()
     logger.init()
     self.loop()
Ejemplo n.º 6
0
def main():
    signal.signal(signal.SIGINT, handler)
    logger.printAsciiLogo()

    #parse config file
    config = configuration.configParser()

    #logging
    logger.init(config.logPath, "server-" + str(datetime.datetime.now()))
    logger.debugFlag = config.verbose

    #node configration
    if config.crawling == 'dynamic':
        nodeConfig = protocol.ConfigurationPayload(protocol.ConfigurationPayload.DYNAMIC_CRAWLING, config)
    else:
        nodeConfig = protocol.ConfigurationPayload(protocol.ConfigurationPayload.STATIC_CRAWLING, config)

    #server
    server = Server(config.host, config.port)
    server.setup(nodeConfig)
    thread.start_new_thread(server.listen, ()) #testing

    while server.isActive:
        time.sleep(0.5)

    server.disconnectAllClient()
    ending()
Ejemplo n.º 7
0
def main():
    path = os.path.dirname(sys.argv[0])
    if path:
        path = path + "/"

    #config
    config = ConfigParser.RawConfigParser(allow_no_value=True)
    config.read(path + 'config')
    host = config.get('client', 'hostAddr')
    port = config.getint('client', 'hostPort')
    logPath = config.get('common', 'logPath')
    verbose = config.get('common', 'verbose')
    if verbose == "True" or verbose == "true":
        verbose = True
    else:
        verbose = False

    #setup
    logger.init(logPath, "client-" + str(datetime.datetime.now()))
    logger.debugFlag = verbose

    node = WorkingNode()
    node.connect(host, port)
    node.readConfig()
    node.run()

    while node.isActive:
        time.sleep(0.5)

    node.disconnect()
Ejemplo n.º 8
0
import osgeo.ogr
import shutil
import geopandas as gp
import time

# when running app
try:
    from modules import config, logger

# when running InitSchema
except:
    import config
    import logger

DB = config.Database()
logger = logger.init()


class DbConnect:
    def __init__(self):
        try:
            self.pg_pool = pool.SimpleConnectionPool(1,
                                                     5,
                                                     user=DB.USER,
                                                     password=DB.PASSWORD,
                                                     host=DB.HOST,
                                                     database=DB.NAME)
            self.conn = self.pg_pool.getconn()
            self.cur = self.conn.cursor()
            logger.info('Connection to database succeeded')
        except Exception as e: