コード例 #1
0
ファイル: Program.cs プロジェクト: samieze/aMuSE
        static void Main(string[] args)
        {
            Parser.Default.ParseArguments <AmbrosiaDCEPSettings>(args)
            .WithParsed <AmbrosiaDCEPSettings>(settings =>
            {
                if (settings.directorNodeName == null)
                {
                    throw new ArgumentException("directorNodeName must not be null");
                }
                // removing the prefix from the service name to only have numbers as node names in DCEP
                string dcepnodename = settings.serviceName;
                if (dcepnodename.Contains("adcep"))
                {
                    dcepnodename = dcepnodename.Substring("adcep".Length);
                }

                if (!dcepnodename.All(char.IsDigit) || dcepnodename.Length == 0)
                {
                    throw new ArgumentException("The -serviceName must be numeric and can be prefixed with 'adcep'.");
                }


                Console.WriteLine("Reading input from " + settings.InputFilePath);
                string[] lines = File.ReadAllLines(settings.InputFilePath, Encoding.UTF8);

                AmbrosiaNode ambrosiaNode = new AmbrosiaNode(dcepnodename, lines, settings);

                using (AmbrosiaFactory.Deploy <IAmbrosiaNode>(settings.serviceName, ambrosiaNode, settings.receivePort, settings.sendPort))
                {
                    Thread.Sleep(14 * 24 * 3600 * 1000);
                }
            });
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ScriptBox21/MS-AMBROSIA
        static void Main(string[] args)
        {
            finishedTokenQ = new AsyncQueue <int>();

            int    coordinatorPort    = 1500;
            string clientInstanceName = "client";
            string serverInstanceName = "server";

            if (args.Length >= 1)
            {
                clientInstanceName = args[0];
            }

            if (args.Length == 2)
            {
                serverInstanceName = args[1];
            }

            using (var coordinatorOutput = new StreamWriter("CoordOut.txt", false))
            {
                var iCListener = new TextWriterTraceListener(coordinatorOutput);
                Trace.Listeners.Add(iCListener);
                GenericLogsInterface.SetToGenericLogs();
                using (AmbrosiaFactory.Deploy <IClient3>(clientInstanceName, new Client3(serverInstanceName, clientInstanceName), coordinatorPort))
                {
                    finishedTokenQ.DequeueAsync().Wait();
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: kant/AMBROSIA
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            finishedTokenQ = new AsyncQueue <int>();

            // for debugging don't want to auto continue but for test automation want this to auto continue
            if (!_autoContinue)
            {
                Console.WriteLine("Pausing execution of " + _perfJob + ". Press enter to deploy and continue.");
                Console.ReadLine();
            }

#if DEBUG
            Console.WriteLine("*X* Connecting to: " + _perfServer + "....");
#endif

            var myClient = new Job(_perfServer, _numRounds);

            // Use "Empty" as the type parameter because this container doesn't run a service
            // that responds to any RPC calls.

            using (var c = AmbrosiaFactory.Deploy <IJob>(_perfJob, myClient, _receivePort, _sendPort))
            {
                finishedTokenQ.DequeueAsync().Wait();
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            // for debugging don't want to auto continue but for test automation want this to auto continue
            if (!_autoContinue)
            {
                Console.WriteLine("Pausing execution of " + _perfServer + ". Press enter to deploy and continue.");
                Console.ReadLine();
            }

            using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, new Server(), _receivePort, _sendPort))
            {
                // nothing to call on c, just doing this for calling Dispose.
                Console.WriteLine("*X* Press enter to terminate program.");
                Console.ReadLine();
            }

            // for upgrading

/*               using (var c = AmbrosiaFactory.Deploy<IServer, IServer, ServerUpgraded>(perfServer, new Server(), receivePort, sendPort))
 *                      {
 *                          // nothing to call on c, just doing this for calling Dispose.
 *                          Console.WriteLine("Press enter to terminate program.");
 *                          Console.ReadLine();
 *                      }
 */
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: stephensong/AMBROSIA
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            // for debugging don't want to auto continue but for test automation want this to auto continue
            if (!_autoContinue)
            {
                Console.WriteLine("Pausing execution of " + _perfServer + ". Press enter to deploy and continue.");
                Console.ReadLine();
            }

            if (!_isUpgrading)
            {
                using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed), _receivePort, _sendPort))
                {
                    // nothing to call on c, just doing this for calling Dispose.
                    //                Console.WriteLine("Press enter to terminate program.");
                    //                Console.ReadLine();
                    Thread.Sleep(14 * 24 * 3600 * 1000);
                }
            }
            else
            {
                using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed), _receivePort, _sendPort))
                {
                    // nothing to call on c, just doing this for calling Dispose.
                    Console.WriteLine("*X* Press enter to terminate program.");
                    Console.ReadLine();
                }
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            finishedTokenQ = new AsyncQueue <int>();

            int    receivePort        = 1001;
            int    sendPort           = 1000;
            string clientInstanceName = "client";
            string serverInstanceName = "server";

            if (args.Length >= 1)
            {
                clientInstanceName = args[0];
            }

            if (args.Length == 2)
            {
                serverInstanceName = args[1];
            }

            Client2 client = new Client2(serverInstanceName);

            using (var c = AmbrosiaFactory.Deploy <IClient2>(clientInstanceName, client, receivePort, sendPort))
            {
                while (finishedTokenQ.IsEmpty)
                {
                    finishedTokenQ.DequeueAsync().Wait();
                }
            }
        }
コード例 #7
0
 public MockDataStore()
 {
     AzureBlobsLogsInterface.SetToAzureBlobsLogs();
     new Thread(new ThreadStart(() => _container = AmbrosiaFactory.Deploy <IXamarinSampleComm>("MockDataStore", new AmbrosiaMockDataStore(), 2500))).Start();
     while (AmbrosiaMockDataStore.myDataStore == null)
     {
         ;
     }
 }
コード例 #8
0
        private void RunImmortal(Object obj)
        {
            ImmortalThreadStartParams threadParams = (ImmortalThreadStartParams)obj;

            immortal = new GraphicalImmortal(threadParams._remoteName);
            using (var c = AmbrosiaFactory.Deploy <IGraphicalImmortal>(threadParams._thisName, immortal, threadParams._receivePort, threadParams._sendPort))
            {
                Thread.Sleep(14 * 24 * 3600 * 1000);
            }
        }
コード例 #9
0
        public Dashboard()
        {
            dash = this;
            InitializeComponent();
            int receivePort = 3001;
            int sendPort    = 3000;
            var myClient    = new TwitterDashboard(this);

            new Thread(new ThreadStart(() => _container = AmbrosiaFactory.Deploy <IDashboard>(DashboardServiceName, myClient, receivePort, sendPort))).Start();
        }
コード例 #10
0
        static void Main(string[] args)
        {
            int    receivePort = 2001;
            int    sendPort    = 2000;
            string serviceName = "server1";

            using (var c = AmbrosiaFactory.Deploy <IServer.IServer>(serviceName, new Server(), receivePort, sendPort))
            {
                Thread.Sleep(14 * 24 * 3600 * 1000);
            }
        }
コード例 #11
0
ファイル: App.xaml.cs プロジェクト: ScriptBox21/MS-AMBROSIA
        public App(IOSCommands inCommands)
        {
            GenericLogsInterface.SetToGenericLogs();
//            AzureBlobsLogsInterface.SetToAzureBlobsLogs();
            new Thread(new ThreadStart(() => _immortalHandle = AmbrosiaFactory.Deploy <ICommandShellImmortal>("CommandShell", new CommandShellImmortal(), 2500))).Start();
            while (CommandShellImmortal.myCommandShellImmortal == null)
            {
                ;
            }
            InitializeComponent();
            MainPage = new MainPage(inCommands);
        }
コード例 #12
0
        static void Main(string[] args)
        {
            finishedTokenQ = new AsyncQueue <int>();

            int    receivePort        = 1001;
            int    sendPort           = 1000;
            string clientInstanceName = "client1";
            string serverInstanceName = "server1";

            using (var c = AmbrosiaFactory.Deploy <IClient1.IClient1>(clientInstanceName, new Client1(serverInstanceName), receivePort, sendPort))
            {
                finishedTokenQ.DequeueAsync().Wait();
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: ScriptBox21/MS-AMBROSIA
        static void Main(string[] args)
        {
            int    coordinatorPort = 2500;
            int    receivePort     = 2001;
            int    sendPort        = 2000;
            string serviceName     = "server";

            if (args.Length >= 1)
            {
                serviceName = args[0];
            }
            var twoProc = false;

            if (args.Length >= 2)
            {
                twoProc = true;
            }
            if (args.Length >= 3)
            {
                receivePort = int.Parse(args[2]);
            }
            if (args.Length >= 4)
            {
                sendPort = int.Parse(args[3]);
            }

            GenericLogsInterface.SetToGenericLogs();
            if (!twoProc)
            {
                using (var coordinatorOutput = new StreamWriter("CoordOut.txt", false))
                {
                    var iCListener = new TextWriterTraceListener(coordinatorOutput);
                    Trace.Listeners.Add(iCListener);
                    using (AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), coordinatorPort))
                    {
                        Thread.Sleep(14 * 24 * 3600 * 1000);
                    }
                }
            }
            else
            {
                using (AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), receivePort, sendPort))
                {
                    Thread.Sleep(14 * 24 * 3600 * 1000);
                }
            }
        }
コード例 #14
0
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            //Console.WriteLine("Pausing execution. Press enter to deploy and continue.");
            //Console.ReadLine();

            var myImmortal = new Analytics();

            using (var c = AmbrosiaFactory.Deploy <IAnalytics>(AnalyticsServiceName, myImmortal, _receivePort, _sendPort))
            {
                // nothing to call on c, just doing this for calling Dispose.
                //Console.WriteLine("Press enter to terminate program.");
                //Console.ReadLine();
                Thread.Sleep(TimeSpan.FromDays(10));
            }
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: rrnewton/AMBROSIA
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            //Console.WriteLine("Pausing execution. Press enter to deploy and continue.");
            //Console.ReadLine();

            var myClient = new TwitterSubscription();

            // Use "Empty" as the type parameter because this container doesn't run a service that responds to any RPC calls.
            using (var c = AmbrosiaFactory.Deploy <Empty>(_serviceName, myClient, _receivePort, _sendPort))
            {
                // nothing to call on c, just doing this for calling Dispose.
                //Console.WriteLine("Press enter to terminate program.");
                //Console.ReadLine();
                Thread.Sleep(TimeSpan.FromDays(10));
            }
        }
コード例 #16
0
        public App(IOSCommands inCommands)
        {
            GenericLogsInterface.SetToGenericLogs();
            // Store the logs in Azure by default. Comment the line below and uncomment the line above to store them in the file system.

            //AzureBlobsLogsInterface.SetToAzureBlobsLogs();

            // Deploy the immortal on another thread as part of startup.
            new Thread(new ThreadStart(() => _immortalHandle = AmbrosiaFactory.Deploy <ICommandShellImmortal>("CommandShell", new CommandShellImmortal(), 2500))).Start();

            // Wait for the immortal to finish recovery
            while (CommandShellImmortal.myCommandShellImmortal == null)
            {
                ;
            }
            InitializeComponent();

            // Pass along the instantiated operating system specific part of the code to the main page initializer.
            MainPage = new MainPage(inCommands);
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: rrnewton/AMBROSIA
        static void Main(string[] args)
        {
            finishedTokenQ = new AsyncQueue <int>();

            int    receivePort        = 1001;
            int    sendPort           = 1000;
            string clientInstanceName = "client2";
            string serverInstanceName = "server1";

            Client2 client = new Client2(serverInstanceName);

            using (var c = AmbrosiaFactory.Deploy <IClient2.IClient2>(clientInstanceName, client, receivePort, sendPort))
            {
                while (finishedTokenQ.IsEmpty)
                {
                    Console.Write("Enter a message (hit ENTER to send): ");
                    string input = Console.ReadLine();
                    client.IngressKeyboardInput(input);
                    Thread.Sleep(1000);
                }
                finishedTokenQ.DequeueAsync().Wait();
            }
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: pcshrosbree/AMBROSIA
        static void Main(string[] args)
        {
            int    receivePort = 2001;
            int    sendPort    = 2000;
            string serviceName = "server";

            if (args.Length >= 1)
            {
                receivePort = int.Parse(args[0]);
            }
            if (args.Length >= 2)
            {
                sendPort = int.Parse(args[1]);
            }
            if (args.Length == 3)
            {
                serviceName = args[2];
            }

            using (var c = AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), receivePort, sendPort))
            {
                Thread.Sleep(14 * 24 * 3600 * 1000);
            }
        }
コード例 #19
0
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            if (_ICDeploymentMode == ICDeploymentMode.InProcDeploy || _ICDeploymentMode == ICDeploymentMode.InProcManual)
            {
                GenericLogsInterface.SetToGenericLogs();
                _iCWriter   = new FileStream("ICOutput_" + _perfServer.ToString() + "_" + _icPort.ToString() + ".txt", FileMode.Create);
                _iCListener = new TextWriterTraceListener(_iCWriter);
                Trace.Listeners.Add(_iCListener);
            }

            try
            {
                // for debugging don't want to auto continue but for test automation want this to auto continue
                if (!_autoContinue)
                {
                    Console.WriteLine("Pausing execution of " + _perfServer + ". Press enter to deploy and continue.");
                    Console.ReadLine();
                }

                if (!_isUpgrading)
                {
                    var myServer = new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed);
                    switch (_ICDeploymentMode)
                    {
                    case ICDeploymentMode.SecondProc:
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            // Doing this wait to make the bash script happy, which automatically move past the Readline.
                            Thread.Sleep(1000 * 60 * 60 * 24);
                            Console.ReadLine();
                        }
                        break;

                    case ICDeploymentMode.InProcDeploy:
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _icPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            Console.ReadLine();
                            Thread.Sleep(3000);
                            Trace.Flush();
                            _iCListener.Flush();
                            _iCWriter.Flush();
                            _iCWriter.Flush();
                        }
                        break;

                    case ICDeploymentMode.InProcManual:
                        var myName       = _perfServer;
                        var myPort       = _icPort;
                        var ambrosiaArgs = new string[2];
                        ambrosiaArgs[0] = "-i=" + myName;
                        ambrosiaArgs[1] = "-p=" + myPort;
                        Console.WriteLine("*X* ImmortalCoordinator -i=" + myName + " -p=" + myPort.ToString());
                        _iCThread = new Thread(() => CRA.Worker.Program.main(ambrosiaArgs))
                        {
                            IsBackground = true
                        };
                        _iCThread.Start();
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            Console.ReadLine();
                            Thread.Sleep(3000);
                            Trace.Flush();
                            _iCListener.Flush();
                            _iCWriter.Flush();
                            _iCWriter.Flush();
                        }
                        break;
                    }
                }
                else
                {
                    var myServer = new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed);
                    switch (_ICDeploymentMode)
                    {
                    case ICDeploymentMode.SecondProc:
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            // Doing this wait to make the bash script happy, which automatically move past the Readline.
                            Thread.Sleep(1000 * 60 * 60 * 24);
                            Console.ReadLine();
                        }
                        break;

                    case ICDeploymentMode.InProcDeploy:
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _icPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            Console.ReadLine();
                            Thread.Sleep(3000);
                            Trace.Flush();
                            _iCListener.Flush();
                            _iCWriter.Flush();
                            _iCWriter.Flush();
                        }
                        break;

                    case ICDeploymentMode.InProcManual:
                        var myName       = _perfServer;
                        var myPort       = _icPort;
                        var ambrosiaArgs = new string[2];
                        ambrosiaArgs[0] = "-i=" + myName;
                        ambrosiaArgs[1] = "-p=" + myPort;
                        Console.WriteLine("*X* ImmortalCoordinator -i=" + myName + " -p=" + myPort.ToString());
                        _iCThread = new Thread(() => CRA.Worker.Program.main(ambrosiaArgs))
                        {
                            IsBackground = true
                        };
                        _iCThread.Start();
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            // nothing to call on c, just doing this for calling Dispose.
                            Console.WriteLine("*X* Press enter to terminate program.");
                            Console.ReadLine();
                            Thread.Sleep(3000);
                            Trace.Flush();
                            _iCListener.Flush();
                            _iCWriter.Flush();
                            _iCWriter.Flush();
                        }
                        break;
                    }
                }
            }
            catch (Exception e) { Console.WriteLine(e.Message); }
            Console.WriteLine("*X* Terminating.");
            System.Environment.Exit(0);
        }
コード例 #20
0
        static void Main(string[] args)
        {
            int    coordinatorPort = 2500;
            int    receivePort     = 2001;
            int    sendPort        = 2000;
            string serviceName     = "server";

            if (args.Length >= 1)
            {
                serviceName = args[0];
            }
            var    iCExecutionStyle = ICExecutionStyle.InProc;
            string logPath          = null;
            int    checkpointToLoad = 0;

            if (args.Length >= 2)
            {
                if (args[1].ToUpper().Equals("TTD"))
                {
                    iCExecutionStyle = ICExecutionStyle.TimeTravelDebugging;
                    logPath          = args[2];
                    checkpointToLoad = int.Parse(args[3]);
                }
                else if (args[1].ToUpper().Equals("TWOPROC"))
                {
                    iCExecutionStyle = ICExecutionStyle.TwoProc;
                    if (args.Length >= 3)
                    {
                        receivePort = int.Parse(args[2]);
                    }
                    if (args.Length >= 4)
                    {
                        sendPort = int.Parse(args[3]);
                    }
                }
            }
            GenericLogsInterface.SetToGenericLogs();
            switch (iCExecutionStyle)
            {
            case ICExecutionStyle.InProc:
                using (var coordinatorOutput = new StreamWriter("CoordOut.txt", false))
                {
                    var iCListener = new TextWriterTraceListener(coordinatorOutput);
                    Trace.Listeners.Add(iCListener);
                    using (AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), coordinatorPort))
                    {
                        Thread.Sleep(14 * 24 * 3600 * 1000);
                    }
                }
                break;

            case ICExecutionStyle.TwoProc:
                using (AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), receivePort, sendPort))
                {
                    Thread.Sleep(14 * 24 * 3600 * 1000);
                }
                break;

            case ICExecutionStyle.TimeTravelDebugging:
                using (var coordinatorOutput = new StreamWriter("CoordOut.txt", false))
                {
                    var iCListener = new TextWriterTraceListener(coordinatorOutput);
                    Trace.Listeners.Add(iCListener);
                    using (AmbrosiaFactory.Deploy <IServer>(serviceName, new Server(), logPath, checkpointToLoad))
                    {
                        Thread.Sleep(14 * 24 * 3600 * 1000);
                    }
                }
                break;
            }
        }
コード例 #21
0
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            if (_ICDeploymentMode == ICDeploymentMode.InProcDeploy || _ICDeploymentMode == ICDeploymentMode.InProcManual || _ICDeploymentMode == ICDeploymentMode.InProcTimeTravel)
            {
                GenericLogsInterface.SetToGenericLogs();
                _iCWriter   = new FileStream("ICOutput_" + _perfJob.ToString() + "_" + _icPort.ToString() + ".txt", FileMode.Create);
                _iCListener = new TextWriterTraceListener(_iCWriter);
                Trace.Listeners.Add(_iCListener);
            }

            try
            {
                finishedTokenQ = new AsyncQueue <int>();

                // for debugging don't want to auto continue but for test automation want this to auto continue
                if (!_autoContinue)
                {
                    Console.WriteLine("Pausing execution of " + _perfJob + ". Press enter to deploy and continue.");
                    Console.ReadLine();
                }

#if DEBUG
                Console.WriteLine("*X* Connecting to: " + _perfServer + "....");
#endif
                var myClient = new Job(_perfServer, _maxMessageSize, _numRounds, _descendingSize);

//                new Thread(() => ConsoleListen()) { IsBackground = true }.Start();

                switch (_ICDeploymentMode)
                {
                case ICDeploymentMode.SecondProc:
                    using (var c = AmbrosiaFactory.Deploy <IJob>(_perfJob, myClient, _receivePort, _sendPort))
                    {
                        WaitForJobToFinishAsync().Wait();
                    }
                    break;

                case ICDeploymentMode.InProcDeploy:
                    using (var c = AmbrosiaFactory.Deploy <IJob>(_perfJob, myClient, _icPort))
                    {
                        WaitForJobToFinishAsync().Wait();
                    }
                    break;

                case ICDeploymentMode.InProcTimeTravel:
                    using (var c = AmbrosiaFactory.Deploy <IJob>(_perfJob, myClient, _serviceLogPath, _checkpointToLoad))
                    {
                        WaitForJobToFinishAsync().Wait();
                    }
                    break;

                case ICDeploymentMode.InProcManual:
                    var myName       = _perfJob;
                    var myPort       = _icPort;
                    var ambrosiaArgs = new string[2];
                    ambrosiaArgs[0] = "-i=" + myName;
                    ambrosiaArgs[1] = "-p=" + myPort;
                    Console.WriteLine("*X* ImmortalCoordinator -i=" + myName + " -p=" + myPort.ToString());
                    _iCThread = new Thread(() => CRA.Worker.Program.main(ambrosiaArgs))
                    {
                        IsBackground = true
                    };
                    _iCThread.Start();
                    using (var c = AmbrosiaFactory.Deploy <IJob>(_perfJob, myClient, _receivePort, _sendPort))
                    {
                        WaitForJobToFinishAsync().Wait();
                    }
                    break;
                }
            }
            catch { /* Swallowing errors to make Darren's testing framework happy. */ }
            Console.Out.Flush();
            Console.Out.Flush();
            System.Environment.Exit(0);
        }
コード例 #22
0
        static void Main(string[] args)
        {
            ParseAndValidateOptions(args);

            if (_ICDeploymentMode == ICDeploymentMode.InProcDeploy || _ICDeploymentMode == ICDeploymentMode.InProcManual || _ICDeploymentMode == ICDeploymentMode.InProcTimeTravel)
            {
                GenericLogsInterface.SetToGenericLogs();
                _iCWriter   = new FileStream("ICOutput_" + _perfServer.ToString() + "_" + _icPort.ToString() + ".txt", FileMode.Create);
                _iCListener = new TextWriterTraceListener(_iCWriter);
                Trace.Listeners.Add(_iCListener);
            }

            try
            {
                finishedTokenQ = new AsyncQueue <int>();

                // for debugging don't want to auto continue but for test automation want this to auto continue
                if (!_autoContinue)
                {
                    Console.WriteLine("Pausing execution of " + _perfServer + ". Press enter to deploy and continue.");
                    Console.ReadLine();
                }

                if (!_isUpgrading)
                {
                    var myServer = new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed);
                    switch (_ICDeploymentMode)
                    {
                    case ICDeploymentMode.SecondProc:
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcDeploy:
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _icPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcTimeTravel:
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _serviceLogPath, _checkpointToLoad, _currentVersion))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcManual:
                        var myName       = _perfServer;
                        var myPort       = _icPort;
                        var ambrosiaArgs = new string[2];
                        ambrosiaArgs[0] = "-i=" + myName;
                        ambrosiaArgs[1] = "-p=" + myPort;
                        Console.WriteLine("*X* ImmortalCoordinator -i=" + myName + " -p=" + myPort.ToString());
                        _iCThread = new Thread(() => CRA.Worker.Program.main(ambrosiaArgs))
                        {
                            IsBackground = true
                        };
                        _iCThread.Start();
                        using (var c = AmbrosiaFactory.Deploy <IServer>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;
                    }
                }
                else
                {
                    var myServer = new Server(_perfJob, _isBidirectional, _numJobs, _memoryUsed);
                    switch (_ICDeploymentMode)
                    {
                    case ICDeploymentMode.SecondProc:
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcDeploy:
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _icPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcTimeTravel:
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _serviceLogPath, _checkpointToLoad, _currentVersion))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;

                    case ICDeploymentMode.InProcManual:
                        var myName       = _perfServer;
                        var myPort       = _icPort;
                        var ambrosiaArgs = new string[2];
                        ambrosiaArgs[0] = "-i=" + myName;
                        ambrosiaArgs[1] = "-p=" + myPort;
                        Console.WriteLine("*X* ImmortalCoordinator -i=" + myName + " -p=" + myPort.ToString());
                        _iCThread = new Thread(() => CRA.Worker.Program.main(ambrosiaArgs))
                        {
                            IsBackground = true
                        };
                        _iCThread.Start();
                        using (var c = AmbrosiaFactory.Deploy <IServer, IServer, ServerUpgraded>(_perfServer, myServer, _receivePort, _sendPort))
                        {
                            WaitForJobsToFinishAndThenWaitAsync().Wait();
                        }
                        break;
                    }
                }
            }
            catch (Exception e) { Console.WriteLine(e.Message); }
            Console.Out.Flush();
            Console.Out.Flush();
            System.Environment.Exit(0);
        }