Exemple #1
0
        /// <returns>
        ///     -1 - something wrong
        ///     0 - successfully
        ///     1 - job agent is offline
        /// </returns>
        public int ApplyForNewJob(GalaxyJobBasicInfo jobBasicInfo, out string strDataRootDir)
        {
            int iRet = 0;

            jobBasicInfo.m_jobId = Guid.Empty;
            strDataRootDir       = null;
            if (m_jobAgent == null)
            {
                return(-1);
            }
            try
            {
                iRet = m_jobAgent.ApplyForNewJob(jobBasicInfo, out strDataRootDir);
                if (iRet != 0)
                {
                    iRet = -1;
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                iRet = 1;
            }
            catch (Exception)
            {
                iRet = -1;
            }

            return(iRet);
        }
Exemple #2
0
        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);
        }