Example #1
0
    def testAppDestructionAllRemote(self):
        script = """
          src : std.CountTimer()
          sum : std.Sum()
          snk : io.StandardOut(store_tokens=1, quiet=1)
          src.integer > sum.integer
          sum.integer > snk.token
          """
        app_info, errors, warnings = compiler.compile(script, "simple")
        d = deployer.Deployer(self.rt1, app_info)
        d.deploy()
        time.sleep(1)
        src = d.actor_map['simple:src']
        csum = d.actor_map['simple:sum']
        snk = d.actor_map['simple:snk']

        utils.migrate(self.rt1, src, self.rt2.id)
        utils.migrate(self.rt1, csum, self.rt2.id)
        utils.migrate(self.rt1, snk, self.rt2.id)
        time.sleep(1)

        actual = utils.report(self.rt2, snk)
        expected = [sum(range(i + 1)) for i in range(1, 10)]
        self.assert_lists_equal(expected, actual)
        utils.delete_application(self.rt1, d.app_id)
        time.sleep(0.5)
        self.assertIsNone(utils.get_actor(self.rt1, src))
        self.assertIsNone(utils.get_actor(self.rt1, csum))
        self.assertIsNone(utils.get_actor(self.rt1, snk))
        self.assertIsNone(utils.get_application(self.rt1, d.app_id))
    def testAppDestructionAllRemote(self):
        script = """
          src : std.CountTimer()
          sum : std.Sum()
          snk : io.StandardOut(store_tokens=1, quiet=1)
          src.integer > sum.integer
          sum.integer > snk.token
          """
        app_info, errors, warnings = compiler.compile(script, "simple")
        d = deployer.Deployer(self.rt1, app_info)
        d.deploy()
        time.sleep(1)
        src = d.actor_map['simple:src']
        csum = d.actor_map['simple:sum']
        snk = d.actor_map['simple:snk']

        utils.migrate(self.rt1, src, self.rt2.id)
        utils.migrate(self.rt1, csum, self.rt2.id)
        utils.migrate(self.rt1, snk, self.rt2.id)
        time.sleep(1)

        actual = utils.report(self.rt2, snk)
        expected = [sum(range(i+1)) for i in range(1,10)]
        self.assert_lists_equal(expected, actual)
        utils.delete_application(self.rt1, d.app_id)
        time.sleep(0.5)
        self.assertIsNone(utils.get_actor(self.rt1, src))
        self.assertIsNone(utils.get_actor(self.rt1, csum))
        self.assertIsNone(utils.get_actor(self.rt1, snk))
        self.assertIsNone(utils.get_application(self.rt1, d.app_id))
Example #3
0
    def testAppDestructionAllRemote(self):
        _log.analyze("TESTRUN", "+", {})
        script = """
          src : std.CountTimer()
          sum : std.Sum()
          snk : io.StandardOut(store_tokens=1, quiet=1)
          src.integer > sum.integer
          sum.integer > snk.token
          """
        import sys
        from twisted.python import log
        log.startLogging(sys.stdout)

        app_info, errors, warnings = compiler.compile(script, "simple")
        d = deployer.Deployer(self.rt1, app_info)
        d.deploy()
        time.sleep(.2)
        src = d.actor_map['simple:src']
        csum = d.actor_map['simple:sum']
        snk = d.actor_map['simple:snk']

        utils.migrate(self.rt1, src, self.rt2.id)
        utils.migrate(self.rt1, csum, self.rt2.id)
        utils.migrate(self.rt1, snk, self.rt2.id)
        time.sleep(.5)

        actual = utils.report(self.rt2, snk)
        expected = [sum(range(i+1)) for i in range(1,10)]
        self.assert_lists_equal(expected, actual)
        utils.delete_application(self.rt1, d.app_id)

        for a in range(20):
            all_removed = None
            try:
                self.assertIsNone(utils.get_actor(self.rt1, csum))
                self.assertIsNone(utils.get_actor(self.rt1, snk))
                self.assertIsNone(utils.get_actor(self.rt2, src))
                self.assertIsNone(utils.get_actor(self.rt2, csum))
                self.assertIsNone(utils.get_actor(self.rt2, snk))
                self.assertIsNone(utils.get_actor(self.rt3, src))
                self.assertIsNone(utils.get_actor(self.rt3, csum))
                self.assertIsNone(utils.get_actor(self.rt3, snk))
            except AssertionError as e:
                print a, e
                all_removed = e
            if all_removed is None:
                break
            time.sleep(1)

        if all_removed:
            raise all_removed

        self.assertIsNone(utils.get_application(self.rt1, d.app_id))
        self.assertIsNone(utils.get_application(self.rt2, d.app_id))
        self.assertIsNone(utils.get_application(self.rt3, d.app_id))
Example #4
0
def control_actors(args):
    if args.cmd == "list":
        return utils.get_actors(args.node)
    if args.cmd == "info":
        if not args.id:
            raise Exception("No actor id given")
        return utils.get_actor(args.node, args.id)
    elif args.cmd == "delete":
        if not args.id:
            raise Exception("No actor id given")
        return utils.delete_actor(args.node, args.id)
    elif args.cmd == "migrate":
        if not args.id or not args.peer_node:
            raise Exception("No actor or peer given")
        return utils.migrate(args.node, args.id, args.peer_node)
Example #5
0
def control_actors(args):
    if args.cmd == 'list':
        return utils.get_actors(args.node)
    if args.cmd == 'info':
        if not args.id:
            raise Exception("No actor id given")
        return utils.get_actor(args.node, args.id)
    elif args.cmd == 'delete':
        if not args.id:
            raise Exception("No actor id given")
        return utils.delete_actor(args.node, args.id)
    elif args.cmd == 'migrate':
        if not args.id or not args.peer_node:
            raise Exception("No actor or peer given")
        return utils.migrate(args.node, args.id, args.peer_node)
Example #6
0
def control_actors(args):
    if args.cmd == 'list':
        return utils.get_actors(args.node)
    if args.cmd == 'info':
        if not args.id:
            raise Exception("No actor id given")
        return utils.get_actor(args.node, args.id)
    elif args.cmd == 'delete':
        if not args.id:
            raise Exception("No actor id given")
        return utils.delete_actor(args.node, args.id)
    elif args.cmd == 'migrate':
        if not args.id or not args.peer_node:
            raise Exception("No actor or peer given")
        return utils.migrate(args.node, args.id, args.peer_node)
    elif args.cmd == 'replicate':
        if not args.id:
            raise Exception("No actor id given")
        return utils.replicate(args.node, args.id, args.peer_node)
    elif args.cmd == 'lost':
        if not args.id:
            raise Exception("No actor id given")
        return utils.lost_actor(args.node, args.id)