public int GetContainersCount()
 {
     lock (CommunicationModule)
     {
         return(_containerTable.GetContainersCount());
     }
 }
Example #2
0
        private HostLoadInfo CarveHostLoadInfo(Load totalLoad)
        {
            if (totalLoad.CpuLoad < 0)
            {
                //throw new NotImplementedException("Carve Load host info");
            }
            var CPUUtil     = totalLoad.CpuLoad / _maxLoad.CpuLoad;
            var IOUtil      = totalLoad.IoSecond / _maxLoad.IoSecond;
            var MemoryUtil  = totalLoad.MemorySize / _maxLoad.MemorySize;
            var dataSizeOut = _networkCard.DataSizeOut;
            var dataSizeIn  = _networkCard.DataSizeIn;
            var load        = new HostLoadInfo(this.MachineId, totalLoad, _containerTable.GetContainersCount(), CPUUtil, MemoryUtil, IOUtil, dataSizeOut, dataSizeIn);

            return(load);
        }
Example #3
0
        protected override bool SendPushRequest()
        {
            BidLock = 0;
            var containerLoadInfo = GetToBeRemovedContainerLoadInfo();

            Console.WriteLine($"I'm Host #{MachineId} and I am Pushing container #{containerLoadInfo} and I have {ContainerTable.GetContainersCount()} contatiners");
            if (containerLoadInfo != null)
            {
                PushRequest m = new PushRequest(0, this.MachineId, LoadManager.GetPredictedHostLoadInfo(), containerLoadInfo);
                CommunicationModule.SendMessage(m);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        protected override void SendPullRequest()
        {
            Console.WriteLine($"I'm Host #{MachineId} and I am pulling a container and I have {ContainerTable.GetContainersCount()} contatiners");

            BidLock = 0;
            PullRequest pullRequest = new PullRequest(0, this.MachineId, LoadManager.GetPredictedHostLoadInfo());

            CommunicationModule.SendMessage(pullRequest);
        }