private IEnumerable<NodeStateResponse> GenerateResourecMockData(Resource resource)
            {
                List<NodeStateResponse> list = new List<NodeStateResponse>();
                foreach (var node in resource.Nodes)
                {
                    var response = new NodeStateResponse(node.NodeName);

                    var coeff = Math.Sin(t);
                    t += 4;

                    response.Consumption = new List<NodeInfo>();
                    response.Consumption.Add(new NodeInfo()
                    {
                        DiskAvailableFreeSpace = (long)(100000 * (coeff + 1)/2),
                        DiskUsage = (100 * (coeff + 1) / 2),
                        MemAvailable = (100 * (coeff + 1) / 2),
                        MemUsage = (100 * (coeff + 1) / 2),
                        Net = (100 * (coeff + 1) / 2),
                        Offline = false,
                        ProcUsage = (100 * (coeff + 1) / 2),
                        SandBoxTotalSize = 1000000,
                        TimeSnapshot = DateTime.Now,
                    });

                    list.Add(response);
                }

                return list;
            }
示例#2
0
 public void ApplyState(NodeStateResponse otherState)
 {
     State                 = otherState.State;
     CoresUsed             = otherState.CoresUsed;
     DynamicHardwareParams = new Dictionary <string, string>(otherState.DynamicHardwareParams);
 }
示例#3
0
 public void ApplyState(NodeStateResponse otherState)
 {
     State = otherState.State;
     CoresUsed = otherState.CoresUsed;
     DynamicHardwareParams = new Dictionary<string, string>(otherState.DynamicHardwareParams);
 }