Example #1
0
 def get_deque(self, instance):
     try:
         _id = self.receivers.index(instance)
         return self.rec_queue[_id]
     except Exception:
         if id(instance) in self.buf:
             return self.buf[id(instance)]
         else:
             self.buf[id(instance)] = deque()
             return self.buf[id(instance)]
Example #2
0
 def get_deque(self, instance):
     try:
         _id = self.receivers.index(instance)
         return self.rec_queue[_id]
     except Exception:
         if id(instance) in self.buf:
             return self.buf[id(instance)]
         else:
             self.buf[id(instance)] = deque()
             return self.buf[id(instance)]
Example #3
0
    def __init__(self, instance_type, id=None, availzone=None, state='pending', is_spot=False,
                 public_dns_name=None, launch_time=None):
        self.instance_type = instance_type
        self.placement = availzone
        if launch_time:
            self.launch_time = launch_time
        else:
            self.launch_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
        if not id:
            id = __builtin__.id(self)
        self._id = id

        self.public_dns_name = public_dns_name
        if is_spot:
            self.instanceLifecycle = 'spot'
        self.state = state
Example #4
0
 def add_receiver(self, receiver):
     self.receivers.append(receiver)
     if id(receiver) in self.buf:
         self.rec_queue.append(self.buf[id(receiver)])
     else:
         self.rec_queue.append(deque())
Example #5
0
 def add_receiver(self, receiver):
     self.receivers.append(receiver)
     if id(receiver) in self.buf:
         self.rec_queue.append(self.buf[id(receiver)])
     else:
         self.rec_queue.append(deque())