public void testTimeOutDetector() { var appDefs = new List<AppDef>() { ads["a"], ads["b"], ads["c"], ads["d"], }; asr.init( appDefs ); var waves = LaunchWavePlanner.build( appDefs ); var ls = new LaunchDepsChecker("m1", asr.appsState, waves ); List<AppDef> atl; // first goes "b" as it does not depends on anything else atl = new List<AppDef>( ls.getAppsToLaunch() ); Assert.AreEqual( new List<AppDef>() { ads["b"] }, atl ); // now we initialize "b" which in turn yields "a" and "c" asr.makeInitialized( ads["b"].AppIdTuple ); atl = new List<AppDef>( ls.getAppsToLaunch() ); Assert.AreEqual( new List<AppDef>() { ads["a"], ads["c"] }, atl ); // we launch "a" and "c" which yields nothing (no other app to launch) asr.makeLaunched( ads["a"].AppIdTuple ); asr.makeLaunched( ads["c"].AppIdTuple ); atl = new List<AppDef>( ls.getAppsToLaunch() ); Assert.AreEqual( new List<AppDef>(), atl ); // now we initize "a" which in turn yields "d" asr.makeInitialized( ads["a"].AppIdTuple ); atl = new List<AppDef>( ls.getAppsToLaunch() ); Assert.AreEqual( new List<AppDef>() { ads["d"] }, atl ); }
/// <summary> /// Stops executing a launch plan (stop starting next applications) /// </summary> public void StopPlan() { if (currentPlan == null) return; currentPlan.Running = false; launchDepChecker = null; foreach (var a in currentPlan.getAppDefs()) { appsState[a.AppIdTuple].PlanApplied = false; } }
/// <summary> /// Starts launching local apps according to current plan. /// </summary> public void StartPlan() { if (currentPlan == null) return; if (!currentPlan.Running) { // trigger the launch sequencer currentPlan.Running = true; List<AppWave> waves = LaunchWavePlanner.build(currentPlan.getAppDefs()); launchDepChecker = new LaunchDepsChecker(machineId, appsState, waves); } }