def testDestroyAppWithLocalActors(self): rt = self.runtime script = """ src : std.CountTimer() snk : io.StandardOut(store_tokens=1) src.integer > snk.token """ app_info, errors, warnings = compiler.compile(script, "simple") d = deployer.Deployer(rt, app_info) app_id = d.deploy() time.sleep(0.2) src = d.actor_map['simple:src'] snk = d.actor_map['simple:snk'] applications = utils.get_applications(rt) assert app_id in applications assert d.destroy()['result'] == 'OK' applications = utils.get_applications(rt) assert app_id not in applications actors = utils.get_actors(rt) assert src not in actors assert snk not in actors
def testDestroyAppWithLocalActors(self): rt = self.runtime script = """ src : std.CountTimer() snk : io.StandardOut(store_tokens=1) src.integer > snk.token """ app_info, errors, warnings = compiler.compile(script, "simple") d = deployer.Deployer(rt, app_info) app_id = d.deploy() time.sleep(0.2) src = d.actor_map['simple:src'] snk = d.actor_map['simple:snk'] applications = utils.get_applications(rt) assert app_id in applications d.destroy() applications = utils.get_applications(rt) assert app_id not in applications actors = utils.get_actors(rt) assert src not in actors assert snk not in actors
def testDestroyAppWithMigratedActors(self): rt = self.runtime rt1 = self.runtimes[0] rt2 = self.runtimes[1] script = """ src : std.CountTimer() snk : io.StandardOut(store_tokens=1) src.integer > snk.token """ app_info, errors, warnings = compiler.compile(script, "simple") d = deployer.Deployer(rt, app_info) app_id = d.deploy() time.sleep(1.0) src = d.actor_map['simple:src'] snk = d.actor_map['simple:snk'] # FIXME --> remove when operating on closed pending connections during migration is fixed utils.disable(rt, src) utils.disable(rt, snk) # <-- utils.migrate(rt, snk, rt1.id) utils.migrate(rt, src, rt2.id) applications = utils.get_applications(rt) assert app_id in applications d.destroy() for retry in range(1, 5): applications = utils.get_applications(rt) if app_id in applications: print("Retrying in %s" % (retry * 0.2, )) time.sleep(0.2 * retry) else : break assert app_id not in applications for retry in range(1, 5): actors = [] actors.extend(utils.get_actors(rt)) actors.extend(utils.get_actors(rt1)) actors.extend(utils.get_actors(rt2)) intersection = [a for a in actors if a in d.actor_map.values()] if len(intersection) > 0: print("Retrying in %s" % (retry * 0.2, )) time.sleep(0.2 * retry) else: break for actor in d.actor_map.values(): assert actor not in actors
def control_applications(args): if args.cmd == "list": return utils.get_applications(args.node) elif args.cmd == "delete": if not args.id: raise Exception("No application id given") return utils.delete_application(args.node, args.id)
def control_applications(args): if args.cmd == 'list': return utils.get_applications(args.node) elif args.cmd == 'delete': if not args.id: raise Exception("No application id given") return utils.delete_application(args.node, args.id)
def control_applications(args): if args.cmd == 'info': if not args.id: raise Exception("No application id given") return utils.get_application(args.node, args.id) elif args.cmd == 'list': return utils.get_applications(args.node) elif args.cmd == 'delete': if not args.id: raise Exception("No application id given") return utils.delete_application(args.node, args.id)