- Timestamp:
- 07/17/15 16:57:22 (9 years ago)
- Location:
- branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HiveStatisticsGenerator.cs
r12765 r12776 134 134 135 135 private void UpdateExistingDimJobs(PersistenceManager pm) { 136 var jobDao = pm.JobDao; 136 137 var dimJobDao = pm.DimJobDao; 137 138 var factTaskDao = pm.FactTaskDao; … … 151 152 } 152 153 if (totalTasks == completedTasks) { 153 dimJob.DateCompleted = factTaskDao.GetLastCompletedTaskFromJob(dimJob.JobId) ?? DateTime.Now; 154 var completeDate = factTaskDao.GetLastCompletedTaskFromJob(dimJob.JobId); 155 if (completeDate == null) { 156 if (jobDao.GetById(dimJob.JobId) == null) { 157 completeDate = DateTime.Now; 158 } 159 } 160 dimJob.DateCompleted = completeDate; 154 161 } 155 162 dimJob.TotalTasks = totalTasks; -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/NewHiveService.cs
r12768 r12776 128 128 } 129 129 130 public IEnumerable< Task> GetTasks() {130 public IEnumerable<DT.Task> GetTasks() { 131 131 // unused 132 132 throw new NotImplementedException(); 133 133 } 134 134 135 public IEnumerable< LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {135 public IEnumerable<DT.LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) { 136 136 // unused 137 137 throw new NotImplementedException(); 138 138 } 139 139 140 public IEnumerable< LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {140 public IEnumerable<DT.LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) { 141 141 // unused 142 142 throw new NotImplementedException(); … … 398 398 } 399 399 400 public IEnumerable< Job> GetAllJobs() {400 public IEnumerable<DT.Job> GetAllJobs() { 401 401 // unused 402 402 throw new NotImplementedException(); 403 403 } 404 404 405 public Guid AddJob( Job jobDto) {405 public Guid AddJob(DT.Job jobDto) { 406 406 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 407 407 using (var pm = PersistenceManager) 408 408 using (new PerformanceLogger("AddJob")) { 409 409 var jobDao = pm.JobDao; 410 var userPriorityDao = pm.UserPriorityDao; 410 411 return pm.UseTransaction(() => { 411 412 jobDto.OwnerUserId = UserManager.CurrentUserId; 412 413 jobDto.DateCreated = DateTime.Now; 413 414 var job = jobDao.Save(jobDto.ToEntity()); 415 if (userPriorityDao.GetById(jobDto.OwnerUserId) == null) { 416 userPriorityDao.Save(new DA.UserPriority { 417 UserId = jobDto.OwnerUserId, 418 DateEnqueued = jobDto.DateCreated 419 }); 420 } 414 421 pm.SubmitChanges(); 415 422 return job.JobId; … … 447 454 var jobDao = pm.JobDao; 448 455 pm.UseTransaction(() => { 456 // child task will be deleted by db-trigger 449 457 jobDao.Delete(jobId); 450 458 pm.SubmitChanges(); … … 546 554 547 555 #region Heartbeat Methods 548 public List<MessageContainer> Heartbeat( Heartbeat heartbeat) {556 public List<MessageContainer> Heartbeat(DT.Heartbeat heartbeat) { 549 557 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Slave); 550 558 List<MessageContainer> result = new List<MessageContainer>(); … … 565 573 566 574 #region Plugin Methods 567 public Plugin GetPlugin(Guid pluginId) {575 public DT.Plugin GetPlugin(Guid pluginId) { 568 576 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 569 577 using (var pm = PersistenceManager) … … 574 582 } 575 583 576 public Plugin GetPluginByHash(byte[] hash) {584 public DT.Plugin GetPluginByHash(byte[] hash) { 577 585 // unused 578 586 throw new NotImplementedException(); 579 587 } 580 588 581 public Guid AddPlugin( Plugin plugin, List<PluginData> pluginData) {589 public Guid AddPlugin(DT.Plugin plugin, List<DT.PluginData> pluginData) { 582 590 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 583 591 using (var pm = PersistenceManager) … … 593 601 pluginEntity = plugin.ToEntity(); 594 602 foreach (var data in pluginData) { 595 data.PluginId = default(Guid); 603 data.PluginId = default(Guid); // real id will be assigned from linq2sql 596 604 pluginEntity.PluginData.Add(data.ToEntity()); 597 605 } … … 603 611 } 604 612 605 public IEnumerable< Plugin> GetPlugins() {613 public IEnumerable<DT.Plugin> GetPlugins() { 606 614 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 607 615 using (var pm = PersistenceManager) … … 616 624 } 617 625 618 public IEnumerable< PluginData> GetPluginDatas(List<Guid> pluginIds) {626 public IEnumerable<DT.PluginData> GetPluginDatas(List<Guid> pluginIds) { 619 627 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 620 628 using (var pm = PersistenceManager) … … 668 676 } 669 677 670 public IEnumerable< ResourcePermission> GetResourcePermissions(Guid resourceId) {678 public IEnumerable<DT.ResourcePermission> GetResourcePermissions(Guid resourceId) { 671 679 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 672 680 using (var pm = PersistenceManager) … … 682 690 683 691 #region Resource Methods 684 public IEnumerable< Resource> GetChildResources(Guid resourceId) {692 public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) { 685 693 // unused 686 694 throw new NotImplementedException(); … … 718 726 } 719 727 720 public Slave GetSlave(Guid slaveId) {728 public DT.Slave GetSlave(Guid slaveId) { 721 729 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 722 730 using (var pm = PersistenceManager) … … 727 735 } 728 736 729 public SlaveGroup GetSlaveGroup(Guid slaveGroupId) {737 public DT.SlaveGroup GetSlaveGroup(Guid slaveGroupId) { 730 738 // unused 731 739 throw new NotImplementedException(); 732 740 } 733 741 734 public IEnumerable< Slave> GetSlaves() {742 public IEnumerable<DT.Slave> GetSlaves() { 735 743 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 736 744 bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator); … … 757 765 } 758 766 759 public IEnumerable< SlaveGroup> GetSlaveGroups() {767 public IEnumerable<DT.SlaveGroup> GetSlaveGroups() { 760 768 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 761 769 bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator); … … 878 886 } 879 887 880 public IEnumerable< Task> GetTasksByResourceId(Guid resourceId) {888 public IEnumerable<DT.Task> GetTasksByResourceId(Guid resourceId) { 881 889 // unused 882 890 throw new NotImplementedException(); … … 967 975 } 968 976 969 public IEnumerable<D owntime> GetDowntimesForResource(Guid resourceId) {977 public IEnumerable<DT.Downtime> GetDowntimesForResource(Guid resourceId) { 970 978 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 971 979 using (var pm = PersistenceManager) … … 995 1003 996 1004 #region UserPriorities Methods 997 public IEnumerable< UserPriority> GetUserPriorities() {1005 public IEnumerable<DT.UserPriority> GetUserPriorities() { 998 1006 using (var pm = PersistenceManager) 999 1007 using (new PerformanceLogger("GetUserPriorities")) {
Note: See TracChangeset
for help on using the changeset viewer.