コード例 #1
0
ファイル: Launcher.cs プロジェクト: nikimar1/cloneofg4g2019
        public void ProcessCommand(ClusterCommandType Cmd, object[] Args = null)
        {
            Configuration Config = Parser.Parse(SelectedConfig);

            if (Config == null)
            {
                AppLogger.Log("Couldn't parse the config file. Please make sure it's correct.");
                return;
            }

            if (Config.ClusterNodes.Count < 1)
            {
                AppLogger.Log("No cluster nodes found in the config file");
                return;
            }

            try
            {
                switch (Cmd)
                {
                case ClusterCommandType.RunApp:
                    ProcessCommandStartApp(Config);
                    break;

                case ClusterCommandType.KillApp:
                    ProcessCommandKillApp(Config);
                    break;

                case ClusterCommandType.RestartComputers:
                    ProcessCommandRestartComputers(Config);
                    break;

                case ClusterCommandType.SendEvent:
                    ProcessCommandSendClusterEvent(Config, Args[0] as List <ClusterEvent>);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                AppLogger.Log(ex.Message);
            }
        }
コード例 #2
0
ファイル: Runner.cs プロジェクト: ragnarula/ActionRPGEngine
        public void ProcessCommand(ClusterCommandType Cmd)
        {
            List <ClusterNode> ClusterNodes = GetClusterNodes();

            if (ClusterNodes.Count < 1)
            {
                AppLogger.Add("No cluster nodes found in the config file");
                return;
            }

            switch (Cmd)
            {
            case ClusterCommandType.RunApp:
                ProcessCommandStartApp(ClusterNodes);
                break;

            case ClusterCommandType.KillApp:
                ProcessCommandKillApp(ClusterNodes);
                break;

            case ClusterCommandType.StartListeners:
                ProcessCommandStopListeners(ClusterNodes, true);
                ProcessCommandStartListeners(ClusterNodes);
                break;

            case ClusterCommandType.StopListeners:
                ProcessCommandStopListeners(ClusterNodes);
                break;

            case ClusterCommandType.ListenersStatus:
                ProcessCommandStatusListeners(ClusterNodes);
                break;

            case ClusterCommandType.DeployApp:
                ProcessCommandDeployApp(ClusterNodes);
                break;

            default:
                break;
            }
        }
コード例 #3
0
        private void ClusterCommand(ClusterCommandType ccType, List <ClusterNode> nodes)
        {
            // get all nodes address

            if (nodes.Count == 0)
            {
                return;
            }

            // gen.command for cluster nodes
            string commandCmd = "";

            switch (ccType)
            {
            case ClusterCommandType.Run:
                commandCmd = cCmdStart + selectedApplication;
                break;

            case ClusterCommandType.Kill:
                commandCmd = cCmdKill + selectedApplication;
                break;

            case ClusterCommandType.Status:
                commandCmd = cCmdStatus;
                break;
            }

            // send cmd for each node
            string cl = string.Empty;

            foreach (ClusterNode node in nodes)
            {
                if (ccType == ClusterCommandType.Run)
                {
                    cl = " uvr_node=" + node.id + cmd;
                }
                string clusterCmd = commandCmd + cl;
                SendDaemonCommand(node.address, clusterCmd);
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: therealironman/vrCluster
        private void ClusterCommand(ClusterCommandType ccType)
        {
            // get all nodes address
            List <string> nodes = GetNodes();

            if (nodes.Count == 0)
            {
                return;
            }

            // gen.command for cluster nodes
            string clusterCmd = "";

            switch (ccType)
            {
            case ClusterCommandType.Run:
                clusterCmd = cCmdStart + GenerateCmdStartApp();
                break;

            case ClusterCommandType.Kill:
                clusterCmd = cCmdKill + GetSelectedAppPath();
                break;

            case ClusterCommandType.Status:
                clusterCmd = cCmdStatus;
                break;
            }

            // send cmd for each node
            LogInfo("Command for client is :  " + clusterCmd);

            foreach (string node in nodes)
            {
                SendDaemonCommand(node, clusterCmd);
            }
        }