Esempio n. 1
0
 def __init__(self, name, size=100, frequency=1, sanitize_hostname=False):
     Actor.__init__(self, name, size, frequency)
     self.regex = re.compile('(.*?)(\D+)$')
     self.sanitize_hostname = sanitize_hostname
     self.pool.createQueue("inbox")
     self.pool.createQueue("outbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 2
0
    def __init__(self, actor_config, colorize=True, ident=None):
        Actor.__init__(self, actor_config)
        self.levels = {
            0: "emergency",
            1: "alert",
            2: "critical",
            3: "error",
            4: "warning",
            5: "notice",
            6: "informational",
            7: "debug"
        }
        self.colors = {
            0: "\x1B[0;35m",
            1: "\x1B[1;35m",
            2: "\x1B[0;31m",
            3: "\x1B[1;31m",
            4: "\x1B[1;33m",
            5: "\x1B[1;30m",
            6: "\x1B[1;37m",
            7: "\x1B[1;37m"
        }

        if self.kwargs.colorize:
            self.colorize = self.doColorize
        else:
            self.colorize = self.doNoColorize

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")

        if self.kwargs.ident is None:
            self.kwargs.ident = os.path.basename(sys.argv[0])
Esempio n. 3
0
 def __init__(self, name, size=100, frequency=1, meta=False):
     Actor.__init__(self, name, size, frequency)
     self.name = name
     self.meta = meta
     self.pool.createQueue("inbox")
     self.pool.createQueue("outbox")
     self.registerConsumer(self.consume, "inbox")
    def __init__(self, actor_config, complete=False):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")

        self.registerConsumer(self.consume, "inbox")
Esempio n. 5
0
    def __init__(self, name, host="localhost", port=19283, timeout=10, delimiter="\n", success=False, failed=False):
        Actor.__init__(self, name, setupbasic=False)
        self.createQueue("inbox")
        self.queuepool.inbox.putLock()
        self.registerConsumer(self.consume, self.queuepool.inbox)

        self.name=name
        self.host=host
        self.port=port
        self.timeout=timeout
        self.delimiter=delimiter

        self.__reconnect=Event()
        self.__reconnect.set()

        if success == True:
            self.createQueue("successful")
            self.submitSuccess=self.__submitSuccess
        else:
            self.submitSuccess=self.__noSubmitSuccess
        if failed == True:
            self.createQueue("failed")
            self.submitFailed=self.__submitFailed
            self.disableConsuming=self.noDisableConsuming
        else:
            self.submitFailed=self.__noSubmitFailed
Esempio n. 6
0
 def __init__(self, name, size, frequency, url="http://localhost", username=None, password=None, interval=60):
     Actor.__init__(self, name, size, frequency)
     self.pool.createQueue("outbox")
     self.url = url
     self.username = username
     self.password = password
     self.interval = interval
Esempio n. 7
0
    def __init__(self, actor_config):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
        self.tags = {}
Esempio n. 8
0
    def __init__(self, name, size=100, frequency=1, capitalize=False):
        Actor.__init__(self, name, size, frequency)
        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")

        self.capitalize = capitalize
Esempio n. 9
0
 def __init__(self, name, path="/tmp/%s.namedpipe"%(os.getpid())):
     Actor.__init__(self, name, setupbasic=False)
     self.createQueue("outbox")
     self.name=name
     self.path = path
     self.__data = event.Event()
     self.__data.clear()
Esempio n. 10
0
    def __init__(self,
                 name,
                 size=100,
                 frequency=1,
                 prefix='',
                 script=True,
                 pid=False,
                 source=True):
        Actor.__init__(self, name, size, frequency)
        self.name = name
        self.prefix = prefix
        if script:
            self.script_name = '.%s' % (basename(argv[0]).replace(".py", ""))
        else:
            self.script_name = ''
        if pid:
            self.pid = "-%s" % (getpid())
        else:
            self.pid = ''

        self.source = source

        if self.source:
            self.doConsume = self.__consumeSource
        else:
            self.doConsume = self.__consumeNoSource

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 11
0
 def __init__(self, name, size=100, frequency=1, mode="server", interface="0.0.0.0", port=19283, servers=[]):
     Actor.__init__(self, name, size, frequency)
     self.mode = mode
     self.interface = interface
     self.port = port
     self.servers = servers
     self.pool.createQueue("outbox")
Esempio n. 12
0
    def __init__(self, name, size, frequency, complete=False):
        Actor.__init__(self, name, size, frequency)

        self.complete = complete
        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 13
0
 def __init__(self, name, size=100, frequency=1, port=19283, timeout=10, topic=""):
     Actor.__init__(self, name, size, frequency)
     self.port = port
     self.timeout = timeout
     self.topic = topic
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 14
0
    def __init__(self, name, size=1, frequency=1, host="localhost", port=5672, vhost="/", user="******", password="******",
                 exchange="", exchange_type="direct", exchange_durable=False,
                 queue="wishbone", queue_durable=False, queue_exclusive=False, queue_auto_delete=True, queue_declare=True,
                 routing_key="", prefetch_count=1, no_ack=False):
        Actor.__init__(self, name, size, frequency)
        self.name = name
        self.size = size
        self.host = host
        self.port = port
        self.vhost = vhost
        self.user = user
        self.password = password
        self.exchange = exchange
        self.exchange_type = exchange_type
        self.exchange_durable = exchange_durable
        self.queue = queue
        self.queue_durable = queue_durable
        self.queue_exclusive = queue_exclusive
        self.queue_auto_delete = queue_auto_delete
        self.queue_declare = queue_declare
        self.routing_key = routing_key
        self.prefetch_count = prefetch_count
        self.no_ack = no_ack

        self.pool.createQueue("outbox")
        self.pool.createQueue("ack")
        self.pool.queue.ack.disableFallThrough()
Esempio n. 15
0
 def __init__(self, name, size=100, frequency=1, source="rabbitmq"):
     Actor.__init__(self, name, size, frequency)
     self.logging.info("Initialized")
     self.source = source
     self.pool.createQueue("inbox")
     self.pool.createQueue("outbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 16
0
    def __init__(self, actor_config, source="@data", destination="@data", str=True, strict=True):

        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
    def __init__(self, name, filename=None, randomize_keys=True, num_values=False, num_values_min=0, num_values_max=1, min_elements=1, max_elements=1, sleep=0 ):
        Actor.__init__(self, name, setupbasic=False)
        self.createQueue("outbox")
        self.name = name
        self.filename=filename
        self.randomize_keys=randomize_keys
        self.num_values=num_values
        self.num_values_min=num_values_min
        self.num_values_max=num_values_max
        self.min_elements=min_elements
        self.max_elements=max_elements
        self.wordlist=self.readWordList(self.filename)
        self.sleep=sleep

        self.key_number=-1

        if self.randomize_keys == True:
            self.generateKey = self.pickWord
        else:
            self.generateKey = self.generateKeyNumber

        if self.num_values == True:
            self.generateValue = self.generateValueNumber
        else:
            self.generateValue = self.pickWord
Esempio n. 18
0
    def __init__(self, actor_config, selection='@data', min=1, max=100):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("inside")
        self.pool.createQueue("outside")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 19
0
    def __init__(self, actor_config, colorize=True, ident=None):
        Actor.__init__(self, actor_config)
        self.levels = {
            0: "emergency",
            1: "alert",
            2: "critical",
            3: "error",
            4: "warning",
            5: "notice",
            6: "informational",
            7: "debug"
        }
        self.colors = {
            0: "\x1B[0;35m",
            1: "\x1B[1;35m",
            2: "\x1B[0;31m",
            3: "\x1B[1;31m",
            4: "\x1B[1;33m",
            5: "\x1B[1;30m",
            6: "\x1B[1;37m",
            7: "\x1B[1;37m"
        }

        if self.kwargs.colorize:
            self.colorize = self.doColorize
        else:
            self.colorize = self.doNoColorize

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")

        if self.kwargs.ident is None:
            self.kwargs.ident = os.path.basename(sys.argv[0])
Esempio n. 20
0
    def __init__(self, actor_config, selection="@data", bind="0.0.0.0", port=19283, show_last=False, keepalive=False, keepalive_interval=5, destination=""):

        Actor.__init__(self, actor_config)
        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
        self.session_queues = {}
        self.template = self.__getTemplate()
Esempio n. 21
0
    def __init__(self, name, size=100, frequency=1, path="/tmp/wishbone", delimiter=""):
        Actor.__init__(self, name, size, frequency)

        self.path = path
        self.delimiter = delimiter
        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 22
0
    def __init__(self, actor_config, source='@data', destination='@data'):

        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 23
0
    def __init__(self, name, size, frequency, keys=[], randomize_keys=True, num_values=False, num_values_min=0, num_values_max=1, min_elements=1, max_elements=1, interval=1):
        Actor.__init__(self, name, size, frequency)
        self.pool.createQueue("outbox")
        self.name = name
        self.keys = keys
        self.randomize_keys = randomize_keys
        self.num_values = num_values
        self.num_values_min = num_values_min
        self.num_values_max = num_values_max
        self.min_elements = min_elements
        self.max_elements = max_elements
        self.wordlist = self.readWordlist()
        self.interval = interval
        self._total = 0

        self.key_number = -1

        if self.randomize_keys:
            self.generateKey = self.pickWord
        else:
            self.generateKey = self.generateKeyNumber

        if self.num_values:
            self.generateValue = self.generateValueNumber
        else:
            self.generateValue = self.pickWord
Esempio n. 24
0
    def __init__(self, actor_config, source='@data', destination='@data'):

        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 25
0
    def __init__(self,
                 name,
                 size=100,
                 frequency=1,
                 interval=1,
                 message="test",
                 numbered=False):
        Actor.__init__(self, name, size, frequency)
        self.name = name
        self.interval = interval
        self.message = message
        self.numbered = numbered

        self.pool.createQueue("outbox")

        if interval == 0:
            self.sleep = self.__doNoSleep
        else:
            self.sleep = self.__doSleep

        if numbered:
            self.number = self.__doNumber
            self.n = 0
        else:
            self.number = self.__doNoNumber
Esempio n. 26
0
 def __init__(self, name, complete=False, counter=False, prefix="", pid=False):
     Actor.__init__(self, name)
     self.deleteQueue("outbox")
     self.complete=complete
     self.counter=counter
     self.prefix=prefix
     self.format=Format(complete, counter, pid)
    def __init__(self, actor_config, schema=None):

        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 28
0
    def __init__(self, actor_config, host="127.0.0.1", port=19283, delimiter=""):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")

        self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Esempio n. 29
0
    def __init__(self, actor_config, min=1, max=100):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("inside")
        self.pool.createQueue("outside")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 30
0
    def __init__(self, name, size, frequency):

        Actor.__init__(self, name)
        self.name = name

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
 def __init__(self, name, mode="pack"):
     Actor.__init__(self, name)
     if mode == "pack":
         self.do = self.pack
     elif mode == "unpack":
         self.do = self.unpack
     else:
         raise Exception("mode should either be 'pack' or 'unpack'")
Esempio n. 32
0
    def __init__(self, actor_config, template="{prefix}.{source}.{script}.{type}.{name} {value} {time}", prefix='wishbone'):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
        self.script = basename(argv[0]).replace(".py", "")
        self.pid = getpid()
Esempio n. 33
0
    def __init__(self, name, size, frequency, location="./wishbone.out"):

        Actor.__init__(self, name)
        self.name = name
        self.location = location

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 34
0
 def __init__(self, actor_config, ident=None):
     Actor.__init__(self, actor_config)
     if ident is None:
         self.kwargs.ident = os.path.basename(sys.argv[0])
     else:
         self.kwargs.ident = ident
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 35
0
 def __init__(self, name, size=100, frequency=1, mode="server", interface="0.0.0.0", port=19283, clients=[]):
     Actor.__init__(self, name, size, frequency)
     self.mode = mode
     self.interface = interface
     self.port = port
     self.clients = clients
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 36
0
 def __init__(self,
              actor_config,
              interval=1,
              message="test",
              numbered=False,
              additional_values={}):
     Actor.__init__(self, actor_config)
     self.pool.createQueue("outbox")
Esempio n. 37
0
 def __init__(self, name, size=100, frequency=1, location=None, rules={}):
     Actor.__init__(self, name, size, frequency)
     self.location = location
     self.rules = rules
     self.__active_rules = {}
     self.match = MatchRules()
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 38
0
    def __init__(self, name, size, frequency, location="./wishbone.out"):

        Actor.__init__(self, name)
        self.name = name
        self.location = location

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 39
0
 def __init__(self, name, path="/tmp/%s.socket"%(getpid()), delimiter=None, max_connections=0):
     Actor.__init__(self, name, setupbasic=False)
     self.createQueue("outbox")
     self.name=name
     self.path=path
     self.delimiter=delimiter
     self.max_connections=max_connections
     self.logging.info("Initialiazed")
Esempio n. 40
0
 def __init__(self, name, size=100, frequency=1, location=None, rules={}):
     Actor.__init__(self, name, size, frequency)
     self.location = location
     self.rules = rules
     self.__active_rules = {}
     self.match = MatchRules()
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 41
0
 def __init__(self, name, server="http://127.0.0.1:9200", ):
     Actor.__init__(self, name, setupbasic=True)
     self.createQueue("rescue")
     self.server=server
     self.logging.info("Initialized")
     self.queuepool.inbox.putLock()
     self.conn=self.getConnection()
     self.__connecting=False
Esempio n. 42
0
 def __init__(self, name, size=100, frequency=1, source="elasticsearch", indices=[]):
     Actor.__init__(self, name, size, frequency)
     self.pool.createQueue("inbox")
     self.pool.createQueue("outbox")
     self.registerConsumer(self.consume, "inbox")
     self.logging.info("Initialized")
     self.source = source
     self.indices = indices
Esempio n. 43
0
    def __init__(self, name, size, frequency):

        Actor.__init__(self, name)
        self.name = name

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 44
0
    def __init__(self, actor_config, selection="@data", counter=False, prefix="", pid=False, foreground_color="WHITE", background_color="RESET", color_style="NORMAL"):
        Actor.__init__(self, actor_config)

        self.__validateInput(foreground_color, background_color, color_style)
        self.format = Format(self.kwargs.selection, self.kwargs.counter, self.kwargs.pid)
        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")

        init(autoreset=True)
Esempio n. 45
0
    def __init__(self,
                 actor_config,
                 selection="@data",
                 level=5,
                 ident=os.path.basename(sys.argv[0])):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 46
0
    def __init__(self,
                 actor_config,
                 selection='@data',
                 location="./wishbone.out",
                 timestamp=False):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 47
0
    def __init__(self, actor_config, ttl=1):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
        self.pool.createQueue("outbox")
        self.pool.createQueue("ttl_exceeded")

        self.__flush_lock = False
Esempio n. 48
0
 def __init__(self, name, size=100, frequency=1, ident=None):
     Actor.__init__(self, name, size, frequency)
     self.name = name
     if ident is None:
         self.ident = os.path.basename(sys.argv[0])
     else:
         self.ident = ident
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")
Esempio n. 49
0
    def __init__(self,
                 actor_config,
                 cron="*/10 * * * *",
                 payload="wishbone",
                 field="@data"):

        Actor.__init__(self, actor_config)
        self.pool.createQueue("outbox")
        self.cron = CronExpression("%s wishbone" % self.kwargs.cron)
Esempio n. 50
0
    def __init__(self, name, size=100, frequency=1, complete=False, counter=False, prefix="", pid=False, flush=1):
        Actor.__init__(self, name, size, frequency)

        self.complete = complete
        self.counter = counter
        self.prefix = prefix
        self.format = Format(complete, counter, pid)

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 51
0
    def __init__(self,
                 actor_config,
                 convert_dots=False,
                 source="@data",
                 destination="@data",
                 prefix=None):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("outbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 52
0
    def __init__(self, actor_config, outgoing="outbox"):

        Actor.__init__(self, actor_config)
        self.pool.createQueue("inbox")
        self.pool.createQueue("switch")
        self.pool.createQueue("outbox")
        self.pool.queue.switch.disableFallThrough()
        self.registerConsumer(self.consume, "inbox")
        self.registerConsumer(self.switch, "switch")

        self.forbidden = ["inbox", "switch"]
Esempio n. 53
0
    def __init__(self,
                 actor_config,
                 selection="@data",
                 conditions=[],
                 location=""):
        Actor.__init__(self, actor_config)

        self.pool.createQueue("inbox")
        self.pool.createQueue("no_match")
        self.registerConsumer(self.consume, "inbox")
        self.disk_conditions = []
        self.condition_read_lock = Semaphore()
Esempio n. 54
0
    def __init__(self,
                 name,
                 size=100,
                 frequency=1,
                 path="/tmp/wishbone",
                 delimiter=""):
        Actor.__init__(self, name, size, frequency)

        self.path = path
        self.delimiter = delimiter
        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")
Esempio n. 55
0
    def __init__(self, name, size, frequency, mta="localhost:25", key=None):

        Actor.__init__(self, name)
        self.name = name
        self.mta = mta

        self.pool.createQueue("inbox")
        self.registerConsumer(self.consume, "inbox")

        if key is None:
            self.key = self.name
        else:
            self.key = key
Esempio n. 56
0
    def __init__(self,
                 name,
                 size=100,
                 frequency=1,
                 address="0.0.0.0",
                 port=19283):
        Actor.__init__(self, name, size, frequency)
        self.pool.createQueue("outbox")
        self.name = name
        self._address = address
        self.port = port

        self.server = DatagramServer("%s:%s" % (address, port), self.handle)
Esempio n. 57
0
 def __init__(self,
              name,
              size=100,
              frequency=1,
              port=19283,
              timeout=10,
              topic=""):
     Actor.__init__(self, name, size, frequency)
     self.port = port
     self.timeout = timeout
     self.topic = topic
     self.pool.createQueue("inbox")
     self.registerConsumer(self.consume, "inbox")