コード例 #1
0
        public ForsmanAuction(HostLoadInfo predictedOwnerHostLoadInfo, int candidates)
        {
            PredictedOwnerHostLoadInfo = predictedOwnerHostLoadInfo;
            HostsLoads = new Dictionary <int, HostLoadInfo>();

            _candidates = candidates;
        }
コード例 #2
0
 public ForsmanBid(int host, bool valid, HostLoadInfo load, int targetAuction,
                   int containerId, BidReasons reason,
                   ContainerLoadInfo containerLoadInfo = null)
     : base(host, valid, load, targetAuction, containerId, reason)
 {
     ContainerLoadInfo = containerLoadInfo;
 }
コード例 #3
0
 public ForsmanPushAuction(HostLoadInfo predictedOwnerHostLoadInfo, List <ContainerLoadInfo> containers, int candidates)
     : base(predictedOwnerHostLoadInfo, candidates)
 {
     foreach (var con in containers)
     {
         Containers.Add(con.ContainerId, con);
     }
 }
コード例 #4
0
 //This is the Bid
 public ForsmanLoadAvailabilityResponce(int target, int sender, HostLoadInfo oldInfo, bool valid, List <ForsmanBid> bids)
     : base(target, sender, MessageTypes.LoadAvailabilityResponse)
 {
     //Console.WriteLine($"LoadAvailabilityResponce for {auctionId} Created to host #{sender}");
     OldLoadInfo = oldInfo;
     Valid       = valid;
     Bids        = bids;
 }
コード例 #5
0
        //public abstract AuctionFailureAction GetAction();

        public void EndWaitFor(int senderId, HostLoadInfo currentHostLoadInfo)
        {
            HostsLoads.Add(senderId, currentHostLoadInfo);
            //HostsLoads.AddOrUpdate(senderId,currentHostLoadInfo);
            if (HostsLoads.Count == _candidates)
            {
                OpenSession = false;
            }
        }
コード例 #6
0
ファイル: Bid.cs プロジェクト: washraf/.NetContainerSimulator
 public Bid(int host, bool valid, HostLoadInfo load,
            int targetAuction, int containerId, BidReasons reason)
 {
     BiddingHost = host;
     Valid       = valid;
     NewLoadInfo = load;
     AuctionId   = targetAuction;
     ContainerId = containerId;
     Reason      = reason;
 }
コード例 #7
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);
        }
コード例 #8
0
        public void UpdateHostLoadInfo(HostLoadInfo info)
        {
            lock (_lock)
            {
                _accountingModule.RequestCreated(MessageTypes.CommonLoadManager, 0);

                if (_currentHostLoadInfos.ContainsKey(info.HostId))
                {
                    _currentHostLoadInfos[info.HostId] = info;
                }
                else
                {
                    _currentHostLoadInfos.Add(info.HostId, info);
                }
            }
        }
コード例 #9
0
        protected List <HostLoadInfo> ToBeHostLoadInfos(int hId, HostLoadInfo loadInfo)
        {
            List <HostLoadInfo> hostLoadInfos = new List <HostLoadInfo>();

            foreach (var hostLoad in HostsLoads.Values.Where(x => x != null))
            {
                if (hostLoad.HostId == hId)
                {
                    hostLoadInfos.Add(loadInfo);
                }
                else
                {
                    hostLoadInfos.Add(hostLoad);
                }
            }
            return(hostLoadInfos);
        }
コード例 #10
0
 public PushRequest(int target, int sender, HostLoadInfo hostLoad, ContainerLoadInfo containerLoad) :
     base(target, sender, hostLoad, MessageTypes.PushRequest)
 {
     SelectedContainerLoadInfo = containerLoad;
 }
コード例 #11
0
 public ForsmanPushRequest(int target, int sender, HostLoadInfo hostLoad, int auctionId, List <ContainerLoadInfo> containerLoads) : base(target, sender, hostLoad, MessageTypes.PushRequest)
 {
     AuctionId      = auctionId;
     ContainerLoads = containerLoads;
 }
コード例 #12
0
 public Request(int target, int sender, HostLoadInfo hostLoad, MessageTypes requestType) :
     base(target, sender, requestType)
 {
     CurrentHostLoadInfo = hostLoad;
 }
コード例 #13
0
        public MeasureValueHolder ReadDataFromDisk(string mainFile)
        {
            var                     config         = mainFile.Split('\\');
            SimulationSize          simulationSize = (SimulationSize)Convert.ToInt32(config[3]);
            StartUtilizationPercent perecent       =
                (StartUtilizationPercent)Enum.Parse(typeof(StartUtilizationPercent), config[4].Split('_')[0]);
            LoadChangeAction changeAction =
                (LoadChangeAction)Enum.Parse(typeof(LoadChangeAction), config[4].Split('_')[1]);

            LoadPrediction      loadPrediction      = (LoadPrediction)Enum.Parse(typeof(LoadPrediction), config[5]);
            SchedulingAlgorithm schedulingAlgorithm = (SchedulingAlgorithm)Enum.Parse(typeof(SchedulingAlgorithm), config[6]);
            Strategies          strategy            = (Strategies)Enum.Parse(typeof(Strategies), config[7].Split('_')[0]);
            ContainersType      containerType       = (ContainersType)Enum.Parse(typeof(ContainersType), config[7].Split('_')[1]);
            AuctionTypes        pushAuctionType     = (AuctionTypes)Enum.Parse(typeof(AuctionTypes), config[8].Split('_')[0]);
            AuctionTypes        pullAuctionType     = (AuctionTypes)Enum.Parse(typeof(AuctionTypes), config[8].Split('_')[1]);
            TestedHosts         testedHosts         = (TestedHosts)Enum.Parse(typeof(TestedHosts), config[9]);
            bool delay = bool.Parse(config[10]);

            int TrialId = int.Parse(config[11]);
            var conf    = new RunConfiguration(simulationSize, perecent, changeAction, loadPrediction, strategy, pushAuctionType, pullAuctionType, schedulingAlgorithm, testedHosts, containerType, delay, TrialId);
            MeasureValueHolder holder =
                new MeasureValueHolder(conf);

            using (StreamReader reader = new StreamReader(mainFile))
            {
                reader.ReadLine();
                while (!reader.EndOfStream)
                {
                    var    line                        = reader.ReadLine().Split(',');
                    int    i                           = Convert.ToInt32(line[0]);
                    double entropy                     = Convert.ToDouble(line[1]);
                    double predictedEntropy            = Convert.ToDouble(line[2]);
                    double avgRealVolume               = Convert.ToDouble(line[3]);
                    double avgPredictedVolume          = Convert.ToDouble(line[4]);
                    double idealHostCount              = Convert.ToDouble(line[5]);
                    double noHosts                     = Convert.ToDouble(line[6]);
                    double underHosts                  = Convert.ToDouble(line[7]);
                    double overHosts                   = Convert.ToDouble(line[8]);
                    double normalHosts                 = Convert.ToDouble(line[9]);
                    double evacuatingHosts             = Convert.ToDouble(line[10]);
                    double migrations                  = Convert.ToDouble(line[11]);
                    double pushRequests                = Convert.ToDouble(line[12]);
                    double pushLoadAvailabilityRequest = Convert.ToDouble(line[13]);
                    double pullRequests                = Convert.ToDouble(line[14]);
                    double pullLoadAvailabilityRequest = Convert.ToDouble(line[15]);
                    double totalMessages               = Convert.ToDouble(line[16]);
                    double slaViolationsCount          = Convert.ToDouble(line[17]);
                    double slaViolationsPercent        = Convert.ToDouble(line[18]);

                    double         minNeeded        = Convert.ToDouble(line[19]);
                    double         maxNeeded        = Convert.ToDouble(line[20]);
                    double         power            = Convert.ToDouble(line[21]);
                    double         stdDev           = Convert.ToDouble(line[22]);
                    double         imagePulls       = Convert.ToDouble(line[23]);
                    double         communicatedSize = Convert.ToDouble(line[24]);
                    MeasuresValues m = new MeasuresValues(pushRequests, pullRequests, idealHostCount, noHosts,
                                                          migrations,
                                                          totalMessages, entropy, predictedEntropy, pushLoadAvailabilityRequest,
                                                          pullLoadAvailabilityRequest,
                                                          avgRealVolume, avgPredictedVolume, minNeeded, maxNeeded,
                                                          underHosts, overHosts, normalHosts, evacuatingHosts,
                                                          slaViolationsCount, slaViolationsPercent,
                                                          power, stdDev, imagePulls, communicatedSize);
                    holder.MeasuredValuesList.Add(m);
                }
            }

            var nfile = mainFile.Replace("All", "ConMig");

            using (StreamReader reader = new StreamReader(new FileStream(nfile, FileMode.Open)))
            {
                reader.ReadLine();
                while (!reader.EndOfStream)
                {
                    var    line  = reader.ReadLine().Split(',');
                    int    conId = Convert.ToInt32(line[0]);
                    double count = Convert.ToDouble(line[1]);
                    double time  = Convert.ToDouble(line[2]);
                    holder.ContainerMeasureValuesList.Add(conId, new ContainerMeasureValue(conId, count, time));
                }
            }

            nfile = mainFile.Replace("All", "Hosts");
            using (StreamReader reader = new StreamReader(new FileStream(nfile, FileMode.Open)))
            {
                List <HostLoadInfo> list = new List <HostLoadInfo>();
                int current = 0;
                reader.ReadLine();
                while (!reader.EndOfStream)
                {
                    //iteration,Id,cpu,mem,io,concount,cpuutil,memutil,ioutil,
                    var    line        = reader.ReadLine().Split(',');
                    int    it          = Convert.ToInt32(line[0]);
                    int    hostId      = Convert.ToInt32(line[1]);
                    double cpu         = Convert.ToDouble(line[2]);
                    double mem         = Convert.ToDouble(line[3]);
                    double io          = Convert.ToDouble(line[4]);
                    int    concount    = Convert.ToInt32(line[5]);
                    double cpuutil     = Convert.ToDouble(line[6]);
                    double memutil     = Convert.ToDouble(line[7]);
                    double ioutil      = Convert.ToDouble(line[8]);
                    double dataSizeOut = Convert.ToDouble(line[9]);
                    double dataSizeIn  = Convert.ToDouble(line[10]);

                    var linfo = new HostLoadInfo(hostId, new Load(cpu, mem, io), concount, cpuutil, memutil, ioutil, dataSizeOut, dataSizeIn);
                    if (it == current)
                    {
                        list.Add(linfo);
                    }
                    else
                    {
                        holder.HostMeasureValuesList.Add(new HostMeasureValues(list));
                        list.Clear();
                        list.Add(linfo);
                        current++;
                    }
                }
            }
            if (containerType == ContainersType.D)
            {
                nfile = mainFile.Replace("All", "PullsPerImage");
                using (StreamReader reader = new StreamReader(new FileStream(nfile, FileMode.Open)))
                {
                    reader.ReadLine();
                    while (!reader.EndOfStream)
                    {
                        var line    = reader.ReadLine().Split(',');
                        int ImageId = Convert.ToInt32(line[0]);
                        int Pulls   = Convert.ToInt32(line[1]);
                        holder.PullsPerImage.Add(ImageId, Pulls);
                    }
                }
            }

            return(holder);
        }
コード例 #14
0
 public ForsmanPullRequest(int target, int sender, HostLoadInfo hostLoad, int auctionId) : base(target, sender, hostLoad, MessageTypes.PullRequest)
 {
     AuctionId = auctionId;
 }
コード例 #15
0
 public AuctionBid(int host, bool valid, HostLoadInfo load,
                   int targetAuction, int containerId, BidReasons reason, int imagePulls)
     : base(host, valid, load, targetAuction, containerId, reason)
 {
     ImagePulls = imagePulls;
 }
コード例 #16
0
 public ForsmanPullAuction(HostLoadInfo predictedOwnerHostLoadInfo, int candidates)
     : base(predictedOwnerHostLoadInfo, candidates)
 {
 }
コード例 #17
0
 public PullRequest(int target, int sender, HostLoadInfo hostLoad) :
     base(target, sender, hostLoad, MessageTypes.PullRequest)
 {
 }