Changeset 9560
- Timestamp:
- 05/31/13 11:20:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
r9557 r9560 232 232 from lWithLf in tLfJoin.DefaultIfEmpty() 233 233 where !t.IsParentTask 234 select new { Task = t, LastFact = tLfJoin.FirstOrDefault() };234 select new { Task = t, TaskDataSize = t.JobData.DataSize, LastFact = tLfJoin.FirstOrDefault() }; 235 235 236 236 var tasksWithNewStateLogs = 237 237 from sl in db.StateLogs 238 238 join twlf in tasksWithLastFact on sl.TaskId equals twlf.Task.TaskId 239 where twlf.LastFact == null || (sl.DateTime > twlf.LastFact.EndTime && sl.DateTime < newTime.Time)239 where (twlf.LastFact == null || sl.DateTime > twlf.LastFact.EndTime) && sl.DateTime < newTime.Time 240 240 group sl by twlf.Task into factGroup 241 select new { Task = factGroup.Key, StateLogs = factGroup.OrderBy(x => x.DateTime) }; 241 select new { 242 Task = factGroup.Key, 243 StateLogs = factGroup.OrderBy(x => x.DateTime), 244 LastSlave = factGroup.OrderByDescending(x => x.DateTime).First(x => x.SlaveId != null).SlaveId 245 }; 242 246 243 247 var tasksWithLastFactsAndStateLogs = 244 248 from twsl in tasksWithNewStateLogs 245 249 join twlf in tasksWithLastFact on twsl.Task equals twlf.Task 246 select new { twlf.Task, twlf.LastFact, twsl.StateLogs }; 250 select new { twlf.Task, twlf.TaskDataSize, twlf.LastFact, twsl.StateLogs, twsl.LastSlave }; 251 252 var clients = 253 from cl in db.DimClients 254 //where cl.ExpirationTime == null 255 select cl; 256 257 var tasksWithLastFactsAndStateLogsAndLastResource = 258 from twlfasl in tasksWithLastFactsAndStateLogs 259 join cl in clients on twlfasl.LastSlave equals cl.ResourceId into clJoinGrp 260 from cl in clJoinGrp.DefaultIfEmpty() 261 select new { twlfasl.Task, twlfasl.TaskDataSize, twlfasl.LastFact, twlfasl.StateLogs, LastClient = cl }; 247 262 248 263 var newTaskFacts = 249 from t in tasksWithLastFactsAndStateLogs .ToList()264 from t in tasksWithLastFactsAndStateLogsAndLastResource.ToList() 250 265 select new FactTask { 251 266 TaskId = t.Task.TaskId, 252 267 JobId = t.Task.JobId, 253 DimTimeStart = t.LastFact .DimTimeStart,268 DimTimeStart = t.LastFact != null ? t.LastFact.DimTimeStart : newTime, 254 269 DimTimeEnd = newTime, 255 // ... 270 LastClientId = t.LastClient != null ? t.LastClient.Id : (t.LastFact != null ? t.LastFact.LastClientId : Guid.Empty), 271 Priority = t.Task.Priority, 272 CoresRequired = t.Task.CoresNeeded, 273 MemoryRequired = t.Task.MemoryNeeded, 274 TaskSize = t.LastFact != null ? t.LastFact.TaskSize : t.TaskDataSize, 275 ResultSize = t.Task.State == TaskState.Finished ? t.TaskDataSize : default(long?), 276 NumCalculationRuns = (t.LastFact != null ? t.LastFact.NumCalculationRuns : 0) + t.StateLogs.Count(x => x.State == TaskState.Calculating), 277 NumFails = (t.LastFact != null ? t.LastFact.NumFails : 0) + t.StateLogs.Count(x => x.State == TaskState.Failed || !string.IsNullOrEmpty(x.Exception)), 278 TotalWaitingTime = 0, //ToDo 279 TotalRuntime = 0, //ToDo 280 TotalTransferTime = 0 //ToDo 256 281 }; 257 282
Note: See TracChangeset
for help on using the changeset viewer.