예제 #1
0
        public static void Main(string[] args)
        {
            new MatrixLibrary.MatrixLibrary();
            // Initialize log instance
            XmlConfigurator.Configure(new FileInfo(ConfigurationManager.AppSettings["log4net.Config"]));

            // Loading agent information from configuration file
            try {
                MatrixLibrary.Configuration config = new MatrixLibrary.Configuration(ConstValues.DEFAULT_AGENT_CONFIG_PATH);
                agentInfo = config.GetAgentInfo();
            } catch (Exception ex) {
                Debug.WriteLine(ex.Message);
                log.Error(ex.Message);
                log.Debug(ex.StackTrace);
                return;
            }

            // verify if the agent's serial number has been registed
            if (!CheckAgentRegistration())
            {
                Debug.WriteLine("Unregisted Agent");
                log.Error("This agent didn't registed");
                return;
            }
            else
            {
                // Start Daemon service on the agent node
                Thread agentDaemonThread = new Thread(new ThreadStart(StartDaemon));
                agentDaemonThread.Start();

                // Load rCuda Runtime Configuration.
                if (LoadRcudaConfiguration())
                {
                    Debug.WriteLine("rCuda Configuration File Loaded!");
                    log.Info("rCuda Configuration File Loaded!");
                }
                else
                {
                    Debug.WriteLine("Load rCuda configuration failed!");
                    log.Error("Load rCuda configuration failed!");
                }

                // Update HWinfo GPU List and Interface
                if (UpdateHardwareInfo())
                {
                    Debug.WriteLine("Hardware Information Update Successful.");
                    log.Info("Hardware Information Update Successful.");
                }
                else
                {
                    Debug.WriteLine("Update Hardware information failed.");
                    log.Error("Update Hardware information failed.");
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: dhzhd1/Matrix
        public static void Main(string[] args)
        {
            new MatrixLibrary.MatrixLibrary();
            // Initiate the backend log
            XmlConfigurator.Configure(new FileInfo(ConfigurationManager.AppSettings["log4net.Config"]));


            // Load Server configuration and parse. Pass the database information into the variable.
            // [Configuration] will Detect Server side configuration file. Default path is /etc/matrix/server.conf
            try {
                MatrixLibrary.Configuration config = new MatrixLibrary.Configuration(ConstValues.DEFAULT_SERVER_CONFIG_PATH);
                dbInfo      = config.GetDbInfo();
                serviceInfo = config.GetServiceInfo();
            } catch (Exception ex) {
                log.Error(ex.Message);
                log.Debug(ex.StackTrace);
                return;
            }

            // Create database connection
            dbInst = new Database(dbInfo);
            dbInst.Connect();

            // Check if the server's UUID is registed in the database.
            if (!dbInst.IfServerRegisted(serviceInfo ["serial_number"]))
            {
                log.Error("This Matrix Server didn't registed or deployed successuful");
                log.Info("Exiting...");
                return;
            }


            Thread serverThread = new Thread(new ThreadStart(StartServer));

            serverThread.Start();
        }