Example #1
0
    def test_retries(self):
        add_engines(3)
        view = self.view
        view.timeout = 1 # prevent hang if this doesn't behave
        def fail():
            assert False
        for r in range(len(self.client)-1):
            with view.temp_flags(retries=r):
                self.assertRaisesRemote(AssertionError, view.apply_sync, fail)

        with view.temp_flags(retries=len(self.client), timeout=0.25):
            self.assertRaisesRemote(error.TaskTimeout, view.apply_sync, fail)
Example #2
0
    def test_impossible_dependency(self):
        if len(self.client) < 2:
            add_engines(2)
        view = self.client.load_balanced_view()
        ar1 = view.apply_async(lambda : 1)
        ar1.get()
        e1 = ar1.engine_id
        e2 = e1
        while e2 == e1:
            ar2 = view.apply_async(lambda : 1)
            ar2.get()
            e2 = ar2.engine_id

        with view.temp_flags(follow=[ar1, ar2]):
            self.assertRaisesRemote(error.ImpossibleDependency, view.apply_sync, lambda : 1)
def setup():
    add_engines(3, total=True)
Example #4
0
 def minimum_engines(self, n=1, block=True):
     """add engines until there are at least n connected"""
     self.engines.extend(add_engines(n, total=True))
     if block:
         self.wait_on_engines()
Example #5
0
 def add_engines(self, n=1, block=True):
     """add multiple engines to our cluster"""
     self.engines.extend(add_engines(n))
     if block:
         self.wait_on_engines()
Example #6
0
def setup():
    add_engines(1)