Example #1
0
 def __init__(self, sender=None, origin=None):
     #assert sender, "Seneder must be defined."
     self._sender = sender or DefaultSender()
     self._id = os.getenv('BEAH_TID')
     self._origin = origin or {}
     if not self._id:
         self._id = new_id()
         self._origin.setdefault('id', self._id)
         os.environ['BEAH_TID'] = self._id
         self.log(LOG_LEVEL.WARNING, "Task ID (BEAH_TID) is not defined. Making new one.")
     else:
         self._origin.setdefault('id', self._id)
     self.introduce()
Example #2
0
 def __init__(self, cmd, id=None, **kwargs):
     if isinstance(cmd, list):
         list.__init__(self, cmd)
         self[self.ARGS] = dict(cmd[self.ARGS])  # make a copy
         if isinstance(cmd, Command):
             return
     else:
         list.__init__(self, ['Command', None, None, None])
         self[self.COMMAND] = str(cmd)
         self[self.ID] = id
         self[self.ARGS] = dict(kwargs)
     if self[self.ID] is None:
         self[self.ID] = new_id()
     self.check()
Example #3
0
 def __init__(self, cmd, id=None, **kwargs):
     if isinstance(cmd, list):
         list.__init__(self, cmd)
         self[self.ARGS] = dict(cmd[self.ARGS]) # make a copy
         if isinstance(cmd, Command):
             return
     else:
         list.__init__(self, ['Command', None, None, None])
         self[self.COMMAND] = str(cmd)
         self[self.ID] = id
         self[self.ARGS] = dict(kwargs)
     if self[self.ID] is None:
         self[self.ID] = new_id()
     self.check()
Example #4
0
 def __init__(self, sender=None, origin=None):
     #assert sender, "Seneder must be defined."
     self._sender = sender or DefaultSender()
     self._id = os.getenv('BEAH_TID')
     self._origin = origin or {}
     if not self._id:
         self._id = new_id()
         self._origin.setdefault('id', self._id)
         os.environ['BEAH_TID'] = self._id
         self.log(LOG_LEVEL.WARNING,
                  "Task ID (BEAH_TID) is not defined. Making new one.")
     else:
         self._origin.setdefault('id', self._id)
     self.introduce()
Example #5
0
    def __init__(self, evt, origin={}, timestamp=None, id=None, **kwargs):
        if isinstance(evt, list):
            list.__init__(self, evt)
            self[self.ORIGIN] = dict(evt[self.ORIGIN]) # make a copy
            self[self.ARGS] = dict(evt[self.ARGS]) # make a copy
            if isinstance(evt, Event):
                return
        else:
            list.__init__(self, ['Event', None, None, None, None, None])
            self[self.EVENT] = evt
            self[self.ID] = id
            self[self.ORIGIN] = dict(origin)
            self[self.TIMESTAMP] = timestamp
            self[self.ARGS] = dict(kwargs)

        if self[self.TIMESTAMP] == True:
            self[self.TIMESTAMP] = time.time()

        if self[self.ID] is None:
            self[self.ID] = new_id()

        self.check()
Example #6
0
    def __init__(self, evt, origin={}, timestamp=None, id=None, **kwargs):
        if isinstance(evt, list):
            list.__init__(self, evt)
            self[self.ORIGIN] = dict(evt[self.ORIGIN])  # make a copy
            self[self.ARGS] = dict(evt[self.ARGS])  # make a copy
            if isinstance(evt, Event):
                return
        else:
            list.__init__(self, ['Event', None, None, None, None, None])
            self[self.EVENT] = evt
            self[self.ID] = id
            self[self.ORIGIN] = dict(origin)
            self[self.TIMESTAMP] = timestamp
            self[self.ARGS] = dict(kwargs)

        if self[self.TIMESTAMP] == True:
            self[self.TIMESTAMP] = time.time()

        if self[self.ID] is None:
            self[self.ID] = new_id()

        self.check()