public void run() { log.InfoFormat("Running with machineId={0}, masterIp={1}, masterPort={2}", ac.machineId, ac.masterIP, ac.masterPort); using (var client = new Dirigent.Net.AutoconClient(ac.machineId, ac.masterIP, ac.masterPort)) { string rootForRelativePaths = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(ac.sharedCfgFileName)); var agent = new Dirigent.Agent.Core.Agent(ac.machineId, client, true, rootForRelativePaths); IEnumerable <ILaunchPlan> planRepo = (ac.scfg != null) ? ac.scfg.Plans : null; // if there is some local plan repo defined, use it for local operations if (planRepo != null) { agent.LocalOps.SetPlanRepo(planRepo); } // start given plan if provided if (planRepo != null) { agent.LocalOps.SelectPlan(ac.startupPlanName); } // tick forever while (true) { agent.tick(); Thread.Sleep(500); } } }
public void run() { log.InfoFormat("Running with machineId={0}, masterIp={1}, masterPort={2}", ac.machineId, ac.masterIP, ac.masterPort); using (var client = new Dirigent.Net.AutoconClient(ac.machineId, ac.masterIP, ac.masterPort)) { var agent = new Dirigent.Agent.Core.Agent(ac.machineId, client, true); IEnumerable<ILaunchPlan> planRepo = (ac.scfg != null) ? ac.scfg.Plans : null; // if there is some local plan repo defined, use it for local operations if (planRepo != null) { agent.LocalOps.SetPlanRepo(planRepo); } // start given plan if provided if (planRepo != null) { ILaunchPlan startupPlan = AppHelper.GetPlanByName(planRepo, ac.startupPlanName); if (startupPlan != null) { agent.LocalOps.SelectPlan(startupPlan); } } // tick forever while (true) { agent.tick(); Thread.Sleep(500); } } }
static void Run() { Console.WriteLine("Press Ctr+C to stop the server."); // run forever while (true) { agent.tick(); cliServer.Tick(); Thread.Sleep(500); } }
static int consoleAppMain() { try { var ac = getAppConfig(); if (ac.logFileName != "") { SetLogFileName(Path.GetFullPath(ac.logFileName)); } //var planRepo = getPlanRepo(ac); log.InfoFormat("Running with masterIp={0}, masterPort={1}", ac.masterIP, ac.masterPort); // use unique client id to avoid conflict with any other possible client string machineId = Guid.NewGuid().ToString(); var client = new Dirigent.Net.Client(machineId, ac.masterIP, ac.masterPort); // first connect client.Connect(); // use network-only agent (never local) string rootForRelativePaths = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(ac.sharedCfgFileName)); var agent = new Dirigent.Agent.Core.Agent(machineId, client, false, rootForRelativePaths); // let the agent receive the plan repository from master agent.tick(); // process the console command MyCommandRepo cmdRepo = new MyCommandRepo(agent.Control); cmdRepo.ParseAndExecute(ac.nonOptionArgs); return(0); // everything OK } catch (Exception ex) { log.Error(ex); //Console.WriteLine(string.Format("Error: {0} [{1}]", ex.Message, ex.GetType().ToString())); Console.WriteLine(string.Format("Error: {0}", ex.Message)); //ExceptionDialog.showException(ex, "Dirigent Exception", ""); return(-1); } }
static int consoleAppMain() { try { var ac = getAppConfig(); if (ac.logFileName != "") { SetLogFileName(Path.GetFullPath(ac.logFileName)); } //var planRepo = getPlanRepo(ac); log.InfoFormat("Running with masterIp={0}, masterPort={1}", ac.masterIP, ac.masterPort); // use unique client id to avoid conflict with any other possible client string machineId = Guid.NewGuid().ToString(); var client = new Dirigent.Net.Client(machineId, ac.masterIP, ac.masterPort); // first connect client.Connect(); // use network-only agent (never local) var agent = new Dirigent.Agent.Core.Agent(machineId, client, false); // let the agent receive the plan repository from master agent.tick(); // process the console command MyCommandRepo cmdRepo = new MyCommandRepo(agent.Control); cmdRepo.ParseAndExecute(ac.nonOptionArgs); return 0; // everything OK } catch (Exception ex) { log.Error(ex); //Console.WriteLine(string.Format("Error: {0} [{1}]", ex.Message, ex.GetType().ToString())); Console.WriteLine(string.Format("Error: {0}", ex.Message)); //ExceptionDialog.showException(ex, "Dirigent Exception", ""); return -1; } }