示例#1
0
        if filepath is None:
            publisher.debug("Script Release is Idling 10s")
            print('Sleeping')
            time.sleep(10)
            continue

        paste = Paste.Paste(filepath)
        content = paste.get_p_content()

        #signal.alarm(max_execution_time)
        try:
            releases = set(re.findall(regex, content))
            if len(releases) == 0:
                continue

                to_print = 'Release;{};{};{};{} releases;{}'.format(
                    paste.p_source, paste.p_date, paste.p_name, len(releases),
                    paste.p_path)
                print(to_print)
                if len(releases) > 30:
                    publisher.warning(to_print)
                else:
                    publisher.info(to_print)

        except TimeoutException:
            p.incr_module_timeout_statistic()
            print("{0} processing timeout".format(paste.p_path))
            continue
        else:
            signal.alarm(0)
示例#2
0
        message = p.get_from_set()
        if message is None:

            publisher.debug("{} queue is empty, waiting".format(config_section))
            time.sleep(1)
            continue

        filename = message
        paste = Paste.Paste(filename)

        # Do something with the message from the queue
        content = paste.get_p_content()
        date = str(paste._get_p_date())

        for decoder in decoder_order: # add threshold and size limit

            # max execution time on regex
            signal.alarm(decoder['max_execution_time'])
            try:
                encoded_list = re.findall(decoder['regex'], content)
            except TimeoutException:
                encoded_list = []
                p.incr_module_timeout_statistic() # add encoder type
                print ("{0} processing timeout".format(paste.p_rel_path))
                continue
            else:
                signal.alarm(0)

                if(len(encoded_list) > 0):
                    content = decode_string(content, message, date, encoded_list, decoder['name'], decoder['encoded_min_size'])
    config_section = 'SentimentAnalysis'

    # Setup the I/O queues
    p = Process(config_section)

    # Sent to the logging a description of the module
    publisher.info("<description of the module>")

    # REDIS_LEVEL_DB #
    server = redis.StrictRedis(
        host=p.config.get("ARDB_Sentiment", "host"),
        port=p.config.get("ARDB_Sentiment", "port"),
        db=p.config.get("ARDB_Sentiment", "db"),
        decode_responses=True)

    while True:
        message = p.get_from_set()
        if message is None:
            publisher.debug("{} queue is empty, waiting".format(config_section))
            time.sleep(1)
            continue
        signal.alarm(60)
        try:
            Analyse(message, server)
        except TimeoutException:
            p.incr_module_timeout_statistic()
            print ("{0} processing timeout".format(message))
            continue
        else:
            signal.alarm(0)
示例#4
0
        message = p.get_from_set()
        if message is None:

            publisher.debug("{} queue is empty, waiting".format(config_section))
            time.sleep(1)
            continue

        filename = message
        paste = Paste.Paste(filename)

        # Do something with the message from the queue
        content = paste.get_p_content()
        date = str(paste._get_p_date())

        for decoder in decoder_order: # add threshold and size limit

            # max execution time on regex
            signal.alarm(decoder['max_execution_time'])
            try:
                encoded_list = re.findall(decoder['regex'], content)
            except TimeoutException:
                encoded_list = []
                p.incr_module_timeout_statistic() # add encoder type
                print ("{0} processing timeout".format(paste.p_rel_path))
                continue
            else:
                signal.alarm(0)

                if(len(encoded_list) > 0):
                    content = decode_string(content, message, date, encoded_list, decoder['name'], decoder['encoded_min_size'])