public bool Process() { bool bRet = true; GalaxyJobBasicInfo[] projects = new GalaxyJobBasicInfo[m_cfg.m_procNodes.Count]; string[] projectDataRootDirs = new string[m_cfg.m_procNodes.Count]; JobAgentHelper[] jobAgentHelpers = new JobAgentHelper[m_cfg.m_procNodes.Count]; for (int idx = 0; idx < jobAgentHelpers.Length; idx++) { ProcessingNodeInfo pnInfo = m_cfg.m_procNodes[idx]; jobAgentHelpers[idx] = new JobAgentHelper(); bRet = jobAgentHelpers[idx].Initialize(pnInfo.m_strHostName, pnInfo.m_nPort); if (!bRet) { return(false); } projects[idx] = new GalaxyJobBasicInfo(); projects[idx].m_strProjectName = m_cfg.m_projectInfo.m_strName; projects[idx].m_strJobName = m_cfg.m_projectInfo.m_jobs[0].m_strName; int nRet = jobAgentHelpers[idx].ApplyForNewJob(projects[idx], out projectDataRootDirs[idx]); if (nRet != 0) { bRet = false; return(false); } projectDataRootDirs[idx] += ("\\" + m_cfg.m_projectInfo.m_strName); } for (int idx = 0; bRet && idx < jobAgentHelpers.Length; idx++) { bRet = TransProjectFiles(jobAgentHelpers[idx], idx, projectDataRootDirs[idx]); } for (int idx = 0; bRet && idx < jobAgentHelpers.Length; idx++) { int nRet = jobAgentHelpers[idx].RestartJob(projects[idx].m_jobId); if (nRet != 0) { bRet = false; return(false); } } return(bRet); }
public bool Load(string strCfgFile) { bool bRet = true; try { XmlDocument cfgDoc = new XmlDocument(); cfgDoc.Load(strCfgFile); XmlNode rootElement = cfgDoc.DocumentElement; if (!rootElement.LocalName.Equals("GalaxyProjectDeployment", StringComparison.OrdinalIgnoreCase)) { return(false); } // load project information XmlNode projectNode = rootElement.SelectSingleNode("Project"); XmlAttribute attrProjectName = projectNode.Attributes["Name"]; m_projectInfo.m_strName = attrProjectName.Value; XmlNodeList dirNodeList = projectNode.SelectNodes("Dirs/Dir"); foreach (XmlNode dirNode in dirNodeList) { m_projectInfo.m_dirs.Add(dirNode.InnerText); } XmlNodeList jobNodeList = projectNode.SelectNodes("Jobs/Job"); foreach (XmlNode jobNode in jobNodeList) { JobInfo jobInfo = new JobInfo(); jobInfo.m_strName = jobNode.SelectSingleNode("Name").InnerText; jobInfo.m_strAppPath = jobNode.SelectSingleNode("AppPath").InnerText; XmlNodeList jobDirNodeList = jobNode.SelectNodes("Dirs/Dir"); foreach (XmlNode jobDirNode in jobDirNodeList) { jobInfo.m_dirs.Add(jobDirNode.InnerText); } m_projectInfo.m_jobs.Add(jobInfo); } // load processing nodes m_nDefaultDeploymentServerPort = Int32.Parse(rootElement.SelectSingleNode("ProcessingNodes/DefaultDeploymentServerPort").InnerText); XmlNodeList procNodeList = rootElement.SelectNodes("ProcessingNodes/ProcessNode"); foreach (XmlNode xmlNodeProcNode in procNodeList) { ProcessingNodeInfo procNodeInfo = new ProcessingNodeInfo(); procNodeInfo.m_id = Int32.Parse(xmlNodeProcNode.Attributes["Id"].Value); procNodeInfo.m_strHostName = xmlNodeProcNode.Attributes["HostName"].Value; procNodeInfo.m_strIPAddress = xmlNodeProcNode.Attributes["IPAddress"].Value; procNodeInfo.m_nPort = Int32.Parse(xmlNodeProcNode.Attributes["PnPort"].Value); string strJobList = xmlNodeProcNode.Attributes["JobList"].Value; string separator = "+ "; string[] jobList = strJobList.Split(separator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string strJob in jobList) { procNodeInfo.m_jobList.Add(strJob); } m_procNodes.Add(procNodeInfo); } // load deployment options } catch (Exception e) { System.Console.WriteLine(e.Message); bRet = false; } return(bRet); }