- Timestamp:
- 04/16/13 13:13:41 (11 years ago)
- Location:
- branches/OaaS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Services.Hive.Web/Hive-3.3/Status.aspx.cs
r7259 r9363 42 42 IEnumerable<DT.Slave> onlineSlaves = new List<DT.Slave>(); 43 43 int currentlyJobsWaiting = 0; 44 Dictionary<Guid, int> calculatingTasksByUser = new Dictionary<Guid,int>(); 45 Dictionary<Guid, int> waitingTasksByUser = new Dictionary<Guid, int>(); 46 List<DT.Resource> groups = new List<DT.Resource>(); 47 48 transactionManager.UseTransaction(() => { 49 groups = dao.GetResources(x => x.ResourceType == "GROUP").ToList(); 50 }, false, false); 44 51 45 52 if (!string.IsNullOrEmpty(resourceName)) { … … 48 55 var resId = dao.GetResources(x => x.Name == resourceName).Single().Id; 49 56 resourceIds = dao.GetChildResources(resId).Select(x => x.Id).Union(new List<Guid> { resId }); 57 calculatingTasksByUser = dao.GetCalculatingTasksByUserForResources(resourceIds.ToList()); 58 waitingTasksByUser = dao.GetWaitingTasksByUserForResources(resourceIds.ToList()); 50 59 }, false, false); 51 60 } else { … … 53 62 { 54 63 resourceIds = dao.GetResources(x => true).Select(y => y.Id); 64 calculatingTasksByUser = dao.GetCalculatingTasksByUser(); 65 waitingTasksByUser = dao.GetWaitingTasksByUser(); 55 66 }, false, false); 56 67 } … … 59 70 { 60 71 onlineSlaves = dao.GetSlaves(x => (x.SlaveState == DA.SlaveState.Calculating || x.SlaveState == DA.SlaveState.Idle) && resourceIds.Contains(x.ResourceId)); 61 currentlyJobsWaiting = dao.Get Tasks(x => x.State == DA.TaskState.Waiting).Count();72 currentlyJobsWaiting = dao.GetLightweightTasks(x => x.State == DA.TaskState.Waiting).Count(); 62 73 }, false, false); 63 74 64 int currentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue).Sum(s => s.Cores.Value); 65 int currentlyUsedCores = currentlyAvailableCores - onlineSlaves.Where(s => s.FreeCores.HasValue).Sum(s => s.FreeCores.Value); 75 int overallCurrentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue).Sum(s => s.Cores.Value); 76 int currentlyAvailableCores = onlineSlaves.Where(s => s.Cores.HasValue && s.IsAllowedToCalculate).Sum(s => s.Cores.Value); 77 int currentlyUsedCores = overallCurrentlyAvailableCores - onlineSlaves.Where(s => s.FreeCores.HasValue).Sum(s => s.FreeCores.Value); 66 78 79 this.overallAvailableCoresLabel.Text = overallCurrentlyAvailableCores.ToString(); 67 80 this.availableCoresLabel.Text = currentlyAvailableCores.ToString(); 68 81 this.usedCoresLabel.Text = currentlyUsedCores.ToString(); … … 70 83 71 84 slavesLabel.Text = string.Join(", ", onlineSlaves.Select(x => string.Format("<a href=\"?resource={0}\">{0}</a> ({1} %)", x.Name, Math.Round(x.CpuUtilization, 2)))); 85 groupsLabel.Text = "<a href=\"Status.aspx\">All</a>, "; 86 groupsLabel.Text += string.Join(", ", groups.Select(x => string.Format("<a href=\"?resource={0}\">{0}</a>", x.Name))); 72 87 73 cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %"; 88 overallCpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 ? Math.Round(onlineSlaves.Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %"; 89 cpuUtilizationLabel.Text = (onlineSlaves.Count() > 0 && onlineSlaves.Where(x => x.IsAllowedToCalculate).Count() > 0 ? Math.Round(onlineSlaves.Where(x => x.IsAllowedToCalculate).Average(s => s.CpuUtilization), 2).ToString() : "0.0") + " %"; 74 90 75 91 DT.Statistics[] stats = new DT.Statistics[0]; … … 101 117 memoryChart.Series[1].Points.AddXY(s.TimeStamp.ToOADate(), usedMemory / 1024.0); 102 118 } 119 120 GenerateTasksByUserTable(waitingTasksByUser, waitingTasksByUserTable); 121 GenerateTasksByUserTable(calculatingTasksByUser, calculatingTasksByUserTable); 103 122 } 123 124 private void GenerateTasksByUserTable(Dictionary<Guid, int> tasksByUser, Table table) { 125 foreach (var kvp in tasksByUser) { 126 TableRow curRow = new TableRow(); 127 TableCell cellUser = new TableCell(); 128 cellUser.Text = ServiceLocator.Instance.UserManager.GetUserById(kvp.Key).UserName; 129 TableCell cellCnt = new TableCell(); 130 cellCnt.Text = kvp.Value.ToString(); 131 132 curRow.Cells.Add(cellUser); 133 curRow.Cells.Add(cellCnt); 134 table.Rows.Add(curRow); 135 } 136 if (tasksByUser.Count() > 0) { 137 TableRow sumRow = new TableRow(); 138 TableCell sumCell = new TableCell(); 139 sumCell.BorderWidth = Unit.Pixel(3); 140 sumCell.Text = tasksByUser.Sum(x => x.Value).ToString(); 141 sumRow.Cells.Add(new TableCell()); 142 sumRow.Cells.Add(sumCell); 143 table.Rows.Add(sumRow); 144 } 145 } 104 146 }
Note: See TracChangeset
for help on using the changeset viewer.