static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Error: Wrong number of parameters"); Console.WriteLine(args[0]); Console.WriteLine("Expected: [impressions] [clicked] [out]"); return; } var impressionFileName = args[0]; var clickFileName = args[1]; var outFileName = args[2]; var tSpace = new TreeSpace(); var clickRateCalculator = new ClickRateCalculator(tSpace, clickFileName, impressionFileName, outFileName); clickRateCalculator.Start(); for (var i = 0; i < WORKERS_COUNT; i++) { var impressionLogAgent = new ImpressionEntryParser(i.ToString(), tSpace, impressionFileName); impressionLogAgent.Start(); } var clickLogAgent = new ClickEntryParser("click", tSpace, clickFileName); clickLogAgent.Start(); }
static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Error: Wrong number of parameters"); Console.WriteLine("Expected: [calc|imp1|imp2|click] [IP address] ([impressions] [clicked] [out])"); } var address = args[1]; if (args[0] == "calc") { if (args.Length < 5) { Console.WriteLine("Error: Wrong number of parameters"); Console.WriteLine(args[0]); Console.WriteLine("Expected for calculator: [calc] [IP address] [impressions] [clicked] [out]"); return; } var impressionFileName = args[2]; var clickFileName = args[3]; var outFileName = args[4]; // Instantiate a new Space repository. SpaceRepository repository = new SpaceRepository(); // Add a gate, such that we can connect to it. repository.AddGate("tcp://" + address + ":" + IMP_PORT1 + "?KEEP"); repository.AddGate("tcp://" + address + ":" + IMP_PORT2 + "?KEEP"); repository.AddGate("tcp://" + address + ":" + CLICK_PORT + "?KEEP"); repository.AddGate("tcp://" + address + ":" + CALC_PORT + "?KEEP"); // Add a new tree space. repository.AddSpace("tSpace", new TreeSpace()); // Instantiate a remotespace (a networked space) thereby connecting to the spacerepository. ISpace remoteSpace = new RemoteSpace("tcp://" + address + ":" + CALC_PORT + "/tSpace?KEEP"); var clickRateCalculator = new ClickRateCalculator(remoteSpace, clickFileName, impressionFileName, outFileName); clickRateCalculator.Start(); } else if (args[0] == "imp1") { ISpace remoteSpace = new RemoteSpace("tcp://" + address + ":" + IMP_PORT1 + "/tSpace?KEEP"); var impressionLogAgent = new ImpressionEntryParser("1", remoteSpace, Program.IMP_FILE); impressionLogAgent.Start(); } else if (args[0] == "imp2") { ISpace remoteSpace = new RemoteSpace("tcp://" + address + ":" + IMP_PORT2 + "/tSpace?KEEP"); var impressionLogAgent = new ImpressionEntryParser("2", remoteSpace, Program.IMP_FILE); impressionLogAgent.Start(); } else if (args[0] == "click") { ISpace remoteSpace = new RemoteSpace("tcp://" + address + ":" + CLICK_PORT + "/tSpace?KEEP"); var clickLogAgent = new ClickEntryParser("click", remoteSpace, Program.CLICK_FILE); clickLogAgent.Start(); } else { Console.WriteLine("Please specify [calc|imp1|imp2|click]"); } }