Beispiel #1
0
 def gather_result(cell_uuid, fn, *args, **kwargs):
     try:
         result = fn(*args, **kwargs)
     except Exception:
         LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = raised_exception_sentinel
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #2
0
 def gather_result(cell_uuid, fn, *args, **kwargs):
     try:
         result = fn(*args, **kwargs)
     except Exception:
         LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = raised_exception_sentinel
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #3
0
 def parallel_task(i, *ars, **kwars):
     try:
         result = func(*ars, **kwars)
         if not isinstance(result, Iterable):
             result = [result]
         queue.put((i, result))
     except Exception:
         pass
Beispiel #4
0
 def gather_result(cell_uuid, fn, *args, **kwargs):
     try:
         result = fn(*args, **kwargs)
     except Exception as e:
         # Only log the exception traceback for non-nova exceptions.
         if not isinstance(e, exception.NovaException):
             LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = e.__class__(e.args)
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #5
0
 def gather_result(cell_mapping, fn, context, *args, **kwargs):
     cell_uuid = cell_mapping.uuid
     try:
         with target_cell(context, cell_mapping) as cctxt:
             result = fn(cctxt, *args, **kwargs)
     except Exception:
         LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = raised_exception_sentinel
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #6
0
 def gather_result(cell_mapping, fn, context, *args, **kwargs):
     cell_uuid = cell_mapping.uuid
     try:
         with target_cell(context, cell_mapping) as cctxt:
             result = fn(cctxt, *args, **kwargs)
     except Exception:
         LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = raised_exception_sentinel
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #7
0
 def gather_result(cell_uuid, fn, *args, **kwargs):
     try:
         result = fn(*args, **kwargs)
     except Exception as e:
         # Only log the exception traceback for non-nova exceptions.
         if not isinstance(e, exception.NovaException):
             LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = e.__class__(e.args)
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #8
0
 def gather_result(cell_mapping, fn, context, *args, **kwargs):
     cell_uuid = cell_mapping.uuid
     try:
         with target_cell(context, cell_mapping) as cctxt:
             result = fn(cctxt, *args, **kwargs)
     except Exception as e:
         # Only log the exception traceback for non-nova exceptions.
         if not isinstance(e, exception.NovaException):
             LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = e.__class__(e.args)
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #9
0
 def gather_result(cell_mapping, fn, context, *args, **kwargs):
     cell_uuid = cell_mapping.uuid
     try:
         with target_cell(context, cell_mapping) as cctxt:
             result = fn(cctxt, *args, **kwargs)
     except Exception as e:
         # Only log the exception traceback for non-nova exceptions.
         if not isinstance(e, exception.NovaException):
             LOG.exception('Error gathering result from cell %s', cell_uuid)
         result = e.__class__(e.args)
     # The queue is already synchronized.
     queue.put((cell_uuid, result))
Beispiel #10
0
    def test_zero_length_queue_nonblocking_put(self):
        hub = hubs.get_hub()
        queue = eventlet.Queue(0)
        got = []

        def fetch_item():
            got.append(queue.get())

        for _ in range(10):
            good_getter = eventlet.spawn(fetch_item)
            bad_getter = eventlet.spawn(fetch_item)
            hub.schedule_call_global(0, bad_getter.throw, Exception("kaboom"))
        eventlet.sleep(0)

        for i in range(10):
            queue.put(i)

        self.assertEqual(got, list(range(10)))
Beispiel #11
0
    def test_zero_length_queue_nonblocking_put(self):
        hub = hubs.get_hub()
        queue = eventlet.Queue(0)
        got = []

        def fetch_item():
            got.append(queue.get())

        for _ in range(10):
            good_getter = eventlet.spawn(fetch_item)
            bad_getter = eventlet.spawn(fetch_item)
            hub.schedule_call_global(0, bad_getter.throw, Exception("kaboom"))
        eventlet.sleep(0)

        for i in range(10):
            queue.put(i)

        self.assertEqual(got, list(range(10)))
Beispiel #12
0
 def _read(self, stream, queue):
     data = stream.readline()
     if data:
         data = helpers.safe_decode_utf8(data.strip())
         queue.put(data)
         return data
Beispiel #13
0
 def test__iter_queue_returns_queued_data(self):
     queue = eventlet.queue.LightQueue()
     queue.put('foo')
     result = list(self.proc._iter_queue(queue, False))
     self.assertEqual(result, ['foo'])
Beispiel #14
0
 def _read(self, stream, queue):
     data = stream.readline()
     if data:
         data = data.strip()
         queue.put(data)
         return data
Beispiel #15
0
 def test__iter_queue_returns_queued_data(self):
     queue = eventlet.queue.LightQueue()
     queue.put('foo')
     result = list(self.proc._iter_queue(queue))
     self.assertEqual(result, ['foo'])
 def _read(self, stream, queue):
     data = stream.readline()
     if data:
         data = data.strip()
         queue.put(data)
         return data
Beispiel #17
0
 def _read(self, stream, queue):
     data = stream.readline()
     if data:
         data = common_utils.safe_decode_utf8(data.strip())
         queue.put(data)
         return data