Changeset 11053 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ExceptionDataController.cs
- Timestamp:
- 06/27/14 16:39:43 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ExceptionDataController.cs
r11030 r11053 9 9 public class ExceptionDataController : Controller { 10 10 11 public JsonResult TaskExceptions(string userName, string limit, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState = null) { 11 public JsonResult TaskExceptions(string limit, string userName, DateTime? start = null, DateTime? end = null, string jobId = null, string taskState = null) 12 { 12 13 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) { 13 14 TaskState state = GetTaskState(taskState); 14 15 var data = 15 (from errors in db.StateLogs 16 join tasks in db.FactTasks 17 on errors.TaskId equals tasks.TaskId 16 (from tasks in db.FactTasks 18 17 join jobs in db.DimJobs 19 18 on tasks.JobId equals jobs.JobId 20 where jobs.UserName == userName &&21 errors.Exception != null &&22 !errors.Exception.Equals(string.Empty) &&19 where tasks.Exception != null && 20 !tasks.Exception.Equals(string.Empty) && 21 (string.IsNullOrEmpty(userName) || jobs.UserName == userName) && 23 22 (!start.HasValue || tasks.StartTime >= start) && 24 23 (!end.HasValue || tasks.EndTime < end) && … … 27 26 select new 28 27 { 29 TaskID = errors.TaskId,30 ErrorMessage = errors.Exception,28 TaskID = tasks.TaskId, 29 ErrorMessage = tasks.Exception, 31 30 StartDate = tasks.StartTime 32 31 }).OrderByDescending(s => s.StartDate).Take(Convert.ToInt32(limit)).ToList(); … … 38 37 39 38 return Json(new KeyValuePair<List<string>, List<string>>(Task, Error), JsonRequestBehavior.AllowGet); 39 } 40 } 41 42 public JsonResult SlaveExceptions(string limit, DateTime? start = null, DateTime? end = null, string clientId = null) { 43 using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString)) { 44 var data = 45 (from tasks in db.FactTasks 46 join jobs in db.DimJobs 47 on tasks.JobId equals jobs.JobId 48 where tasks.Exception != null && 49 !tasks.Exception.Equals(string.Empty) && 50 (!start.HasValue || tasks.StartTime >= start) && 51 (!end.HasValue || tasks.EndTime < end) && 52 (string.IsNullOrEmpty(clientId) || tasks.LastClientId.ToString() == clientId) 53 select new { 54 TaskID = tasks.TaskId, 55 ErrorMessage = tasks.Exception, 56 ClientID = tasks.LastClientId, 57 UserName = jobs.UserName, 58 StartDate = tasks.StartTime 59 }).OrderByDescending(s => s.StartDate).Take(Convert.ToInt32(limit)).ToList(); 60 61 List<List<string>> results = new List<List<string>>(); 62 63 for (int i = 0; i < data.Count; i++) { 64 results.Add( 65 new List<string> { data[i].TaskID.ToString(), data[i].ErrorMessage, data[i].ClientID.ToString(), data[i].UserName, 66 data[i].StartDate.ToString("dd/MM/yyyy HH:mm")} 67 ); 68 } 69 return Json(results, JsonRequestBehavior.AllowGet); 40 70 } 41 71 }
Note: See TracChangeset
for help on using the changeset viewer.