Пример #1
0
 private IEnumerable <string> GetDownHosts(GetHostStatusResponse hoststatusresponse)
 {
     return(hoststatusresponse.HostStatus
            .Where(IsHostDead)
            .Select(status => status.host)
            .OrderBy(h => h));
 }
Пример #2
0
 private IEnumerable <string> GetActiveHosts(GetHostStatusResponse hoststatusresponse)
 {
     return((hoststatusresponse.HostStatus)
            .Where(IsHostActive)
            .Select(status => status.host)
            .OrderBy(h => h));
 }
Пример #3
0
        protected override void OnLoad(EventArgs e)
        {
            if (Request.QueryString ["username"] != null)
            {
                try {
                    if (!Authentication.Login(Request.QueryString ["username"], Request.QueryString ["pw"], Request, Response))
                    {
                        return;
                    }
                } catch (Exception) {
                    return;
                }
            }

            base.OnLoad(e);

            web_service_login  = Utilities.CreateWebServiceLogin(Context.Request);
            hoststatusresponse = Utils.WebService.GetHostStatus(web_service_login);


            var node_information = new Dictionary <string, object> {
                { "inactiveNodes", GetInactiveNodes(web_service_login, hoststatusresponse) },
                { "activeNodes", GetActiveNodes(web_service_login, hoststatusresponse) },
                { "downNodes", GetDownNodes(web_service_login, hoststatusresponse) },
                // { "pendingJobs", "asdf" }
            };

            Response.Write(JsonConvert.SerializeObject(node_information, Formatting.Indented));
        }
Пример #4
0
        private List <string> GetDownNodes(WebServiceLogin web_service_login, GetHostStatusResponse hoststatusresponse)
        {
            var down = new List <string> ();

            for (int i = 0; i < hoststatusresponse.HostStatus.Count; i++)
            {
                var status = hoststatusresponse.HostStatus [i];

                if (NodeIsDead(status))
                {
                    down.Add(status.host);
                }
            }
            return(down);
        }
Пример #5
0
        private List <string> GetInactiveNodes(WebServiceLogin web_service_login, GetHostStatusResponse hoststatusresponse)
        {
            var idles = new List <string> ();

            for (int i = 0; i < hoststatusresponse.HostStatus.Count; i++)
            {
                var status = hoststatusresponse.HostStatus [i];
                var idle   = string.IsNullOrEmpty(status.lane);

                if (idle && !NodeIsDead(status))
                {
                    idles.Add(status.host);
                }
            }
            return(idles);
        }