Exemple #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)
Exemple #2
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)
Exemple #3
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)
Exemple #4
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)
Exemple #5
0
def setup():
    add_engines(3, total=True)
Exemple #6
0
def setup():
    add_engines(2)
Exemple #7
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()
def setup():
    add_engines(3, total=True)
Exemple #9
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()
Exemple #10
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()
Exemple #11
0
def setup():
    add_engines(1)