Changeset 11036 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers
- Timestamp:
- 06/24/14 16:20:29 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs
r11030 r11036 156 156 { 157 157 TaskID = tasks.TaskId, 158 TotalWaiting = tasks.TotalWaitingTime,159 TotalTransfer = tasks.TotalTransferTime,160 TotalRuntime = tasks.TotalRuntime,161 158 StartDate = tasks.StartTime 162 159 }).OrderByDescending(s => s.StartDate).ToList().Count; … … 170 167 } 171 168 172 public JsonResult GetUserTask(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState=null, string currentPage=null)169 public JsonResult UserTask(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState=null) 173 170 { 174 171 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) … … 193 190 }).OrderByDescending(s => s.StartDate).ToList(); 194 191 195 if (currentPage != null) { 196 data.RemoveRange(0, (Convert.ToInt32(currentPage) - 1) * Convert.ToInt32(limit)); 197 if (data.Count > Convert.ToInt32(limit)) { 198 data.RemoveRange(Convert.ToInt32(limit), data.Count - Convert.ToInt32(limit)); 199 } 200 } 201 else if (data.Count > Convert.ToInt32(limit)) 202 { 203 data.RemoveRange(Convert.ToInt32(limit), data.Count - Convert.ToInt32(limit)); 204 } 192 List<KeyValuePair<string, List<double>>> results = new List<KeyValuePair<string, List<double>>>(); 205 193 206 194 List<string> id = new List<string>(); … … 208 196 List<double> transfer = new List<double>(); 209 197 List<double> run = new List<double>(); 198 List<double> times = new List<double>(); 210 199 data.ForEach(i => id.Add(i.TaskID.ToString())); 211 200 data.ForEach(w => wait.Add(w.TotalWaiting)); … … 213 202 data.ForEach(r => run.Add(r.TotalRuntime)); 214 203 215 List<List<double>> taskStats = new List<List<double>>(); 216 taskStats.Add(wait); 217 taskStats.Add(transfer); 218 taskStats.Add(run); 219 220 return Json(new KeyValuePair<List<string>, List<List<double>>>(id, taskStats), JsonRequestBehavior.AllowGet); 204 for (int i = 0; i < id.Count; i++) { 205 results.Add(new KeyValuePair<string, List<double>>(id[i],new List<double>{wait[i],transfer[i],run[i]})); 206 } 207 208 return Json(results, JsonRequestBehavior.AllowGet); 209 } 210 } 211 212 public JsonResult SlaveInfo(string limit, DateTime? start = null, DateTime? end = null, string userName = null) 213 { 214 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) 215 { 216 var data = 217 (from slaves in db.FactClientInfos 218 join users in db.DimUsers 219 on slaves.UserId equals users.UserId 220 where (!start.HasValue || slaves.Time >= start) && 221 (!end.HasValue || slaves.Time < end) && 222 (string.IsNullOrEmpty(userName) || users.Name == userName) 223 select new 224 { 225 SlaveID = slaves.ClientId, 226 Time = slaves.Time, 227 UsedCores = slaves.NumUsedCores, 228 TotalCores = slaves.NumTotalCores, 229 UsedMemory = slaves.UsedMemory, 230 TotalMemory = slaves.TotalMemory, 231 CPUUtilization = slaves.CpuUtilization 232 }).OrderByDescending(s => s.Time).GroupBy(s => s.SlaveID).ToList(); 233 234 return Json(data, JsonRequestBehavior.AllowGet); 221 235 } 222 236 }
Note: See TracChangeset
for help on using the changeset viewer.