Changeset 12925
- Timestamp:
- 09/01/15 13:47:15 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.cs
r12878 r12925 30 30 throw new NotImplementedException(); 31 31 } 32 33 partial void OnCreated() {34 LogFactory.GetLogger(this.GetType().Namespace).Log("HiveDataContext created");35 }36 32 } 37 33 } -
trunk/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
r12878 r12925 57 57 58 58 pm.UseTransaction(() => { 59 UpdateTaskFactsTable( time,pm);59 UpdateTaskFactsTable(pm); 60 60 try { 61 61 pm.SubmitChanges(); … … 261 261 } 262 262 263 private void UpdateTaskFactsTable( DimTime newTime,PersistenceManager pm) {263 private void UpdateTaskFactsTable(PersistenceManager pm) { 264 264 var factTaskDao = pm.FactTaskDao; 265 265 var taskDao = pm.TaskDao; … … 273 273 274 274 var newTasks = 275 from task in taskDao.GetAllChildTasks() 276 let stateLogs = task.StateLogs.OrderByDescending(x => x.DateTime) 277 let lastSlaveId = stateLogs.First(x => x.SlaveId != null).SlaveId 278 where (!factTaskIds.Contains(task.TaskId) 279 || notFinishedFactTasks.Select(x => x.TaskId).Contains(task.TaskId)) 280 join lastFactTask in notFinishedFactTasks on task.TaskId equals lastFactTask.TaskId into lastFactPerTask 281 from lastFact in lastFactPerTask.DefaultIfEmpty() 282 join client in dimClientDao.GetActiveClients() on lastSlaveId equals client.ResourceId into clientsPerSlaveId 283 from client in clientsPerSlaveId.DefaultIfEmpty() 284 select new { 285 TaskId = task.TaskId, 286 JobId = task.JobId, 287 Priority = task.Priority, 288 CoresRequired = task.CoresNeeded, 289 MemoryRequired = task.MemoryNeeded, 290 State = task.State, 291 StateLogs = stateLogs.OrderBy(x => x.DateTime), 292 LastClientId = client != null 293 ? client.Id : lastFact != null 294 ? lastFact.LastClientId : (Guid?)null 295 }; 275 (from task in taskDao.GetAllChildTasks() 276 let stateLogs = task.StateLogs.OrderByDescending(x => x.DateTime) 277 let lastSlaveId = stateLogs.First(x => x.SlaveId != null).SlaveId 278 where (!factTaskIds.Contains(task.TaskId) 279 || notFinishedFactTasks.Select(x => x.TaskId).Contains(task.TaskId)) 280 join lastFactTask in notFinishedFactTasks on task.TaskId equals lastFactTask.TaskId into lastFactPerTask 281 from lastFact in lastFactPerTask.DefaultIfEmpty() 282 join client in dimClientDao.GetActiveClients() on lastSlaveId equals client.ResourceId into clientsPerSlaveId 283 from client in clientsPerSlaveId.DefaultIfEmpty() 284 select new { 285 TaskId = task.TaskId, 286 JobId = task.JobId, 287 Priority = task.Priority, 288 CoresRequired = task.CoresNeeded, 289 MemoryRequired = task.MemoryNeeded, 290 State = task.State, 291 StateLogs = stateLogs.OrderBy(x => x.DateTime), 292 LastClientId = client != null 293 ? client.Id : lastFact != null 294 ? lastFact.LastClientId : (Guid?)null, 295 NotFinishedTask = notFinishedFactTasks.Any(y => y.TaskId == task.TaskId) 296 }).ToList(); 297 298 //insert facts for new tasks 296 299 factTaskDao.Save( 297 from x in newTasks.ToList() 300 from x in newTasks 301 where !x.NotFinishedTask 298 302 let taskData = CalculateFactTaskData(x.StateLogs) 299 303 select new FactTask { … … 315 319 InitialWaitingTime = taskData.InitialWaitingTime 316 320 }); 317 factTaskDao.Delete(notFinishedFactTasks.Select(x => x.TaskId)); 321 322 //update data of already existing facts 323 foreach (var notFinishedTask in factTaskDao.GetNotFinishedTasks()) { 324 var ntc = newTasks.Where(x => x.TaskId == notFinishedTask.TaskId); 325 if (ntc.Any()) { 326 var x = ntc.Single(); 327 var taskData = CalculateFactTaskData(x.StateLogs); 328 329 notFinishedTask.StartTime = taskData.StartTime; 330 notFinishedTask.EndTime = taskData.EndTime; 331 notFinishedTask.LastClientId = x.LastClientId; 332 notFinishedTask.Priority = x.Priority; 333 notFinishedTask.CoresRequired = x.CoresRequired; 334 notFinishedTask.MemoryRequired = x.MemoryRequired; 335 notFinishedTask.NumCalculationRuns = taskData.CalculationRuns; 336 notFinishedTask.NumRetries = taskData.Retries; 337 notFinishedTask.WaitingTime = taskData.WaitingTime; 338 notFinishedTask.CalculatingTime = taskData.CalculatingTime; 339 notFinishedTask.TransferTime = taskData.TransferTime; 340 notFinishedTask.TaskState = x.State; 341 notFinishedTask.Exception = taskData.Exception; 342 notFinishedTask.InitialWaitingTime = taskData.InitialWaitingTime; 343 } 344 } 318 345 } 319 346
Note: See TracChangeset
for help on using the changeset viewer.