- Timestamp:
- 08/13/15 14:51:54 (9 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.cs
r12012 r12857 30 30 throw new NotImplementedException(); 31 31 } 32 33 partial void OnCreated() { 34 LogFactory.GetLogger(this.GetType().Namespace).Log("HiveDataContext created"); 35 } 32 36 } 33 37 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
r12768 r12857 1 USE [HeuristicLab.Hive-3.3] 2 /* create and initialize hive database tables */ 1 /* HeuristicLab 2 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 3 * 4 * This file is part of HeuristicLab. 5 * 6 * HeuristicLab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * HeuristicLab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 USE [HeuristicLab.Hive-3.3] 3 20 4 21 EXEC sp_configure filestream_access_level, 2 -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql
r12768 r12857 1 /* HeuristicLab 2 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 3 * 4 * This file is part of HeuristicLab. 5 * 6 * HeuristicLab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * HeuristicLab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 /* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */ 1 21 USE [HeuristicLab.Hive-3.3] 2 /* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */3 /* adds default values */4 /* creates delete and update cascades */5 /* creates indices */6 /* creates views */7 /* creates triggers */8 9 22 10 23 ALTER TABLE [dbo].[AssignedResources] DROP CONSTRAINT [Task_AssignedResource] … … 97 110 GO 98 111 99 /* views */ 100 -- ============================================= 101 -- Author: cneumuel 102 -- Description: Returns the first StateLog entry for each job 103 -- ============================================= 104 CREATE VIEW [dbo].[view_FirstState] 105 AS 106 SELECT sl.TaskId, sl.DateTime, sl.State 107 FROM dbo.StateLog AS sl INNER JOIN 108 (SELECT TaskId, MIN(DateTime) AS DateTime 109 FROM dbo.StateLog 110 GROUP BY TaskId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.TaskId = minDate.TaskId 111 112 -- speed up joins between Job and Task 113 CREATE NONCLUSTERED INDEX [TaskJobIdIndex] 114 ON [dbo].[Task] ([JobId]) 115 INCLUDE ([TaskId],[TaskState],[ExecutionTimeMs],[LastHeartbeat],[ParentTaskId],[Priority],[CoresNeeded],[MemoryNeeded],[IsParentTask],[FinishWhenChildJobsFinished],[Command],[IsPrivileged]) 112 116 GO 113 117 114 -- ============================================= 115 -- Author: cneumuel 116 -- Description: Returns the last StateLog entry for each job 117 -- ============================================= 118 CREATE VIEW [dbo].[view_LastState] 119 AS 120 SELECT sl.TaskId, sl.DateTime, sl.State 121 FROM dbo.StateLog AS sl INNER JOIN 122 (SELECT TaskId, MAX(DateTime) AS DateTime 123 FROM dbo.StateLog 124 GROUP BY TaskId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.TaskId = minDate.TaskId 118 -- this is an index to speed up the GetWaitingTasks() method 119 CREATE NONCLUSTERED INDEX [TaskGetWaitingTasksIndex] 120 ON [dbo].[Task] ([TaskState],[IsParentTask],[FinishWhenChildJobsFinished],[CoresNeeded],[MemoryNeeded]) 121 INCLUDE ([TaskId],[ExecutionTimeMs],[LastHeartbeat],[ParentTaskId],[Priority],[Command],[JobId],[IsPrivileged]) 125 122 GO 123 126 124 127 125 /****** Object: Trigger [dbo].[tr_JobDeleteCascade] Script Date: 04/19/2011 16:31:53 ******/ … … 152 150 CREATE TRIGGER [dbo].[tr_TaskDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS 153 151 BEGIN 154 SELECT155 he.OwnerUserId AS UserId,156 ROUND(SUM(j.ExecutionTimeMs) / 1000, 0) AS ExecutionTimeS,157 ROUND(ISNULL(SUM(CASE ls.State WHEN 'Finished' THEN j.ExecutionTimeMs END), 0) / 1000, 0) AS ExecutionTimeSFinishedJobs,158 ISNULL(SUM(CASE ls.State WHEN 'Finished' THEN DATEDIFF(s, fs.DateTime, ls.DateTime) ELSE 0 END), 0) AS StartToEndTimeS159 FROM160 deleted j,161 Job he,162 view_FirstState fs,163 view_LastState ls164 WHERE165 he.JobId = j.JobId AND166 fs.TaskId = j.TaskId AND167 ls.TaskId = j.TaskId168 GROUP BY he.OwnerUserId169 170 152 -- recursively delete jobs 171 153 CREATE TABLE #Table( … … 194 176 GO 195 177 196 -- ============================================================197 -- Description: Create indices to speed up execution of queries198 -- ============================================================199 178 200 -- speed up joins between Job and Task201 CREATE NONCLUSTERED INDEX [TaskJobIdIndex]202 ON [dbo].[Task] ([JobId])203 INCLUDE ([TaskId],[TaskState],[ExecutionTimeMs],[LastHeartbeat],[ParentTaskId],[Priority],[CoresNeeded],[MemoryNeeded],[IsParentTask],[FinishWhenChildJobsFinished],[Command],[IsPrivileged])204 GO205 206 -- this is an index to speed up the GetWaitingTasks() method207 CREATE NONCLUSTERED INDEX [TaskGetWaitingTasksIndex]208 ON [dbo].[Task] ([TaskState],[IsParentTask],[FinishWhenChildJobsFinished],[CoresNeeded],[MemoryNeeded])209 INCLUDE ([TaskId],[ExecutionTimeMs],[LastHeartbeat],[ParentTaskId],[Priority],[Command],[JobId],[IsPrivileged])210 GO -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj
r12789 r12857 158 158 <Compile Include="Scheduler\JobInfoForScheduler.cs" /> 159 159 <Compile Include="Scheduler\RoundRobinTaskScheduler.cs" /> 160 <Compile Include="Settings.cs" />161 160 <None Include="app.config" /> 162 161 <None Include="Plugin.cs.frame" /> -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/NewHiveService.cs
r12776 r12857 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Diagnostics;25 24 using System.Linq; 26 using System.Runtime.CompilerServices;27 25 using System.Security; 28 26 using System.ServiceModel; … … 70 68 public Guid AddTask(DT.Task task, DT.TaskData taskData, IEnumerable<Guid> resourceIds) { 71 69 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 72 using (var pm = PersistenceManager)70 var pm = PersistenceManager; 73 71 using (new PerformanceLogger("AddTask")) { 74 72 var taskDao = pm.TaskDao; … … 102 100 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 103 101 IEnumerable<Guid> resourceIds; 104 using (var pm = PersistenceManager)102 var pm = PersistenceManager; 105 103 using (new PerformanceLogger("AddChildTask")) { 106 104 var assignedResourceDao = pm.AssignedResourceDao; … … 118 116 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 119 117 AuthorizationManager.AuthorizeForTask(taskId, Permission.Read); 120 using (var pm = PersistenceManager)118 var pm = PersistenceManager; 121 119 using (new PerformanceLogger("GetTask")) { 122 120 var taskDao = pm.TaskDao; … … 128 126 } 129 127 130 public IEnumerable<DT.Task> GetTasks() {131 // unused132 throw new NotImplementedException();133 }134 135 public IEnumerable<DT.LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {136 // unused137 throw new NotImplementedException();138 }139 140 public IEnumerable<DT.LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {141 // unused142 throw new NotImplementedException();143 }144 145 128 public IEnumerable<DT.LightweightTask> GetLightweightJobTasks(Guid jobId) { 146 129 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 147 130 AuthorizationManager.AuthorizeForJob(jobId, Permission.Read); 148 using (var pm = PersistenceManager)131 var pm = PersistenceManager; 149 132 using (new PerformanceLogger("GetLightweightJobTasks")) { 150 133 var taskDao = pm.TaskDao; … … 171 154 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 172 155 AuthorizationManager.AuthorizeForJob(jobId, Permission.Read); 173 using (var pm = PersistenceManager)156 var pm = PersistenceManager; 174 157 using (new PerformanceLogger("GetLightweightJobTasksWithoutStateLog")) { 175 158 var taskDao = pm.TaskDao; … … 194 177 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 195 178 AuthorizationManager.AuthorizeForTask(taskId, Permission.Read); 196 using (var pm = PersistenceManager)179 var pm = PersistenceManager; 197 180 using (new PerformanceLogger("GetTaskData")) { 198 181 var taskDataDao = pm.TaskDataDao; … … 204 187 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 205 188 AuthorizationManager.AuthorizeForTask(taskDto.Id, Permission.Full); 206 using (var pm = PersistenceManager)189 var pm = PersistenceManager; 207 190 using (new PerformanceLogger("UpdateTask")) { 208 191 var taskDao = pm.TaskDao; … … 218 201 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 219 202 AuthorizationManager.AuthorizeForTask(taskDto.Id, Permission.Full); 220 using (var pm = PersistenceManager)203 var pm = PersistenceManager; 221 204 using (new PerformanceLogger("UpdateTaskData")) { 222 205 var taskDao = pm.TaskDao; … … 233 216 } 234 217 235 public void DeleteTask(Guid taskId) {236 // unused237 throw new NotImplementedException();238 }239 240 public void DeleteChildTasks(Guid parentTaskId) {241 // unused242 throw new NotImplementedException();243 }244 245 218 public DT.Task UpdateTaskState(Guid taskId, DT.TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 246 219 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 247 220 AuthorizationManager.AuthorizeForTask(taskId, Permission.Full); 248 using (var pm = PersistenceManager)221 var pm = PersistenceManager; 249 222 using (new PerformanceLogger("UpdateTaskState")) { 250 223 var taskDao = pm.TaskDao; 251 var stateLogDao = pm.StateLogDao;252 224 return pm.UseTransaction(() => { 253 225 var task = taskDao.GetById(taskId); … … 264 236 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 265 237 AuthorizationManager.AuthorizeForTask(taskId, Permission.Full); 266 using (var pm = PersistenceManager)238 var pm = PersistenceManager; 267 239 using (new PerformanceLogger("StopTask")) { 268 240 var taskDao = pm.TaskDao; … … 284 256 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 285 257 AuthorizationManager.AuthorizeForTask(taskId, Permission.Full); 286 using (var pm = PersistenceManager)258 var pm = PersistenceManager; 287 259 using (new PerformanceLogger("PauseTask")) { 288 260 var taskDao = pm.TaskDao; … … 301 273 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 302 274 AuthorizationManager.AuthorizeForTask(taskId, Permission.Full); 303 using (var pm = PersistenceManager)275 var pm = PersistenceManager; 304 276 using (new PerformanceLogger("RestartTask")) { 305 277 var taskDao = pm.TaskDao; … … 318 290 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 319 291 AuthorizationManager.AuthorizeForJob(id, DT.Permission.Read); 320 using (var pm = PersistenceManager)292 var pm = PersistenceManager; 321 293 using (new PerformanceLogger("GetJob")) { 322 294 var jobDao = pm.JobDao; … … 354 326 public IEnumerable<DT.Job> GetJobs() { 355 327 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 356 using (var pm = PersistenceManager)328 var pm = PersistenceManager; 357 329 using (new PerformanceLogger("GetJobs")) { 358 330 var jobDao = pm.JobDao; … … 377 349 .ToList(); 378 350 foreach (var job in jobs) { 379 // TODO: improve performance of authorization (batch authorization)380 AuthorizationManager.AuthorizeForJob(job.Id, DT.Permission.Read);381 351 var statistic = statistics.FirstOrDefault(x => x.Key == job.Id); 382 352 if (statistic != null) { … … 398 368 } 399 369 400 public IEnumerable<DT.Job> GetAllJobs() {401 // unused402 throw new NotImplementedException();403 }404 405 370 public Guid AddJob(DT.Job jobDto) { 406 371 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 407 using (var pm = PersistenceManager)372 var pm = PersistenceManager; 408 373 using (new PerformanceLogger("AddJob")) { 409 374 var jobDao = pm.JobDao; … … 428 393 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 429 394 AuthorizationManager.AuthorizeForJob(jobDto.Id, DT.Permission.Full); 430 using (var pm = PersistenceManager)395 var pm = PersistenceManager; 431 396 using (new PerformanceLogger("UpdateJob")) { 432 397 bool exists = true; … … 450 415 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 451 416 AuthorizationManager.AuthorizeForJob(jobId, DT.Permission.Full); 452 using (var pm = PersistenceManager)417 var pm = PersistenceManager; 453 418 using (new PerformanceLogger("DeleteJob")) { 454 419 var jobDao = pm.JobDao; … … 466 431 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 467 432 AuthorizationManager.AuthorizeForJob(jobId, Permission.Full); 468 using (var pm = PersistenceManager)433 var pm = PersistenceManager; 469 434 using (new PerformanceLogger("GrantPermission")) { 470 435 var jobPermissionDao = pm.JobPermissionDao; … … 480 445 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 481 446 AuthorizationManager.AuthorizeForJob(jobId, Permission.Full); 482 using (var pm = PersistenceManager)447 var pm = PersistenceManager; 483 448 using (new PerformanceLogger("RevokePermission")) { 484 449 var jobPermissionDao = pm.JobPermissionDao; … … 494 459 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 495 460 AuthorizationManager.AuthorizeForJob(jobId, Permission.Full); 496 using (var pm = PersistenceManager)461 var pm = PersistenceManager; 497 462 using (new PerformanceLogger("GetJobPermissions")) { 498 463 var jobPermissionDao = pm.JobPermissionDao; … … 516 481 slaveInfo.OwnerUserId = UserManager.CurrentUserId; 517 482 } 518 using (var pm = PersistenceManager)483 var pm = PersistenceManager; 519 484 using (new PerformanceLogger("Hello")) { 520 485 var slaveDao = pm.SlaveDao; … … 539 504 public void GoodBye(Guid slaveId) { 540 505 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Slave); 541 using (var pm = PersistenceManager)506 var pm = PersistenceManager; 542 507 using (new PerformanceLogger("GoodBye")) { 543 508 var slaveDao = pm.SlaveDao; … … 575 540 public DT.Plugin GetPlugin(Guid pluginId) { 576 541 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 577 using (var pm = PersistenceManager)542 var pm = PersistenceManager; 578 543 using (new PerformanceLogger("GetPlugin")) { 579 544 var pluginDao = pm.PluginDao; … … 582 547 } 583 548 584 public DT.Plugin GetPluginByHash(byte[] hash) {585 // unused586 throw new NotImplementedException();587 }588 589 549 public Guid AddPlugin(DT.Plugin plugin, List<DT.PluginData> pluginData) { 590 550 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 591 using (var pm = PersistenceManager)551 var pm = PersistenceManager; 592 552 using (new PerformanceLogger("AddPlugin")) { 593 553 var pluginDao = pm.PluginDao; … … 613 573 public IEnumerable<DT.Plugin> GetPlugins() { 614 574 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 615 using (var pm = PersistenceManager)575 var pm = PersistenceManager; 616 576 using (new PerformanceLogger("GetPlugins")) { 617 577 var pluginDao = pm.PluginDao; … … 626 586 public IEnumerable<DT.PluginData> GetPluginDatas(List<Guid> pluginIds) { 627 587 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 628 using (var pm = PersistenceManager)588 var pm = PersistenceManager; 629 589 using (new PerformanceLogger("GetPluginDatas")) { 630 590 var pluginDataDao = pm.PluginDataDao; … … 636 596 } 637 597 } 638 639 public void DeletePlugin(Guid pluginId) {640 // unused641 throw new NotImplementedException();642 }643 598 #endregion 644 599 … … 646 601 public void GrantResourcePermissions(Guid resourceId, Guid[] grantedUserIds) { 647 602 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 648 using (var pm = PersistenceManager)603 var pm = PersistenceManager; 649 604 using (new PerformanceLogger("GrantResourcePermissions")) { 650 605 pm.UseTransaction(() => { … … 666 621 public void RevokeResourcePermissions(Guid resourceId, Guid[] grantedUserIds) { 667 622 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 668 using (var pm = PersistenceManager)623 var pm = PersistenceManager; 669 624 using (new PerformanceLogger("RevokeResourcePermissions")) { 670 625 var resourcePermissionDao = pm.ResourcePermissionDao; … … 678 633 public IEnumerable<DT.ResourcePermission> GetResourcePermissions(Guid resourceId) { 679 634 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 680 using (var pm = PersistenceManager)635 var pm = PersistenceManager; 681 636 using (new PerformanceLogger("GetResourcePermissions")) { 682 637 var resourcePermissionDao = pm.ResourcePermissionDao; … … 689 644 #endregion 690 645 691 #region Resource Methods692 public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) {693 // unused694 throw new NotImplementedException();695 }696 #endregion697 698 646 #region Slave Methods 699 647 public Guid AddSlave(DT.Slave slaveDto) { 700 648 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 701 using (var pm = PersistenceManager)649 var pm = PersistenceManager; 702 650 using (new PerformanceLogger("AddSlave")) { 703 651 var slaveDao = pm.SlaveDao; … … 712 660 public Guid AddSlaveGroup(DT.SlaveGroup slaveGroupDto) { 713 661 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 714 using (var pm = PersistenceManager)662 var pm = PersistenceManager; 715 663 using (new PerformanceLogger("AddSlaveGroup")) { 716 664 var slaveGroupDao = pm.SlaveGroupDao; … … 728 676 public DT.Slave GetSlave(Guid slaveId) { 729 677 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 730 using (var pm = PersistenceManager)678 var pm = PersistenceManager; 731 679 using (new PerformanceLogger("GetSlave")) { 732 680 var slaveDao = pm.SlaveDao; … … 735 683 } 736 684 737 public DT.SlaveGroup GetSlaveGroup(Guid slaveGroupId) {738 // unused739 throw new NotImplementedException();740 }741 742 685 public IEnumerable<DT.Slave> GetSlaves() { 743 686 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 744 687 bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator); 745 using (var pm = PersistenceManager)688 var pm = PersistenceManager; 746 689 using (new PerformanceLogger("GetSlaves")) { 747 690 var slaveDao = pm.SlaveDao; … … 768 711 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 769 712 bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator); 770 using (var pm = PersistenceManager)713 var pm = PersistenceManager; 771 714 using (new PerformanceLogger("GetSlaveGroups")) { 772 715 var slaveGroupDao = pm.SlaveGroupDao; … … 792 735 public void UpdateSlave(DT.Slave slaveDto) { 793 736 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 794 using (var pm = PersistenceManager)737 var pm = PersistenceManager; 795 738 using (new PerformanceLogger("UpdateSlave")) { 796 739 var slaveDao = pm.SlaveDao; … … 809 752 public void UpdateSlaveGroup(DT.SlaveGroup slaveGroupDto) { 810 753 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 811 using (var pm = PersistenceManager)754 var pm = PersistenceManager; 812 755 using (new PerformanceLogger("UpdateSlaveGroup")) { 813 756 var slaveGroupDao = pm.SlaveGroupDao; … … 827 770 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 828 771 AuthorizationManager.AuthorizeForResourceAdministration(slaveId); 829 using (var pm = PersistenceManager)772 var pm = PersistenceManager; 830 773 using (new PerformanceLogger("DeleteSlave")) { 831 774 var slaveDao = pm.SlaveDao; … … 839 782 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 840 783 AuthorizationManager.AuthorizeForResourceAdministration(slaveGroupId); 841 using (var pm = PersistenceManager)784 var pm = PersistenceManager; 842 785 using (new PerformanceLogger("DeleteSlaveGroup")) { 843 786 var slaveGroupDao = pm.SlaveGroupDao; … … 850 793 public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) { 851 794 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 852 using (var pm = PersistenceManager)795 var pm = PersistenceManager; 853 796 using (new PerformanceLogger("AddResourceToGroup")) { 854 797 var resourceDao = pm.ResourceDao; … … 863 806 public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 864 807 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 865 using (var pm = PersistenceManager)808 var pm = PersistenceManager; 866 809 using (new PerformanceLogger("RemoveResourceFromGroup")) { 867 810 var resourceDao = pm.ResourceDao; … … 876 819 public Guid GetResourceId(string resourceName) { 877 820 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 878 using (var pm = PersistenceManager)821 var pm = PersistenceManager; 879 822 using (new PerformanceLogger("GetResourceId")) { 880 823 var resourceDao = pm.ResourceDao; … … 886 829 } 887 830 888 public IEnumerable<DT.Task> GetTasksByResourceId(Guid resourceId) {889 // unused890 throw new NotImplementedException();891 }892 893 831 public void TriggerEventManager(bool force) { 894 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Slave);832 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator); 895 833 // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains) 896 834 bool cleanup; 897 using (var pm = PersistenceManager)835 var pm = PersistenceManager; 898 836 using (new PerformanceLogger("TriggerEventManager")) { 899 837 cleanup = false; … … 916 854 public int GetNewHeartbeatInterval(Guid slaveId) { 917 855 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Slave); 918 using (var pm = PersistenceManager)856 var pm = PersistenceManager; 919 857 using (new PerformanceLogger("GetNewHeartbeatInterval")) { 920 858 var slaveDao = pm.SlaveDao; … … 934 872 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 935 873 AuthorizationManager.AuthorizeForResourceAdministration(downtimeDto.ResourceId); 936 using (var pm = PersistenceManager)874 var pm = PersistenceManager; 937 875 using (new PerformanceLogger("AddDowntime")) { 938 876 var downtimeDao = pm.DowntimeDao; … … 947 885 public void DeleteDowntime(Guid downtimeId) { 948 886 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 949 using (var pm = PersistenceManager)887 var pm = PersistenceManager; 950 888 using (new PerformanceLogger("DeleteDowntime")) { 951 889 var downtimeDao = pm.DowntimeDao; … … 960 898 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 961 899 AuthorizationManager.AuthorizeForResourceAdministration(downtimeDto.ResourceId); 962 using (var pm = PersistenceManager)900 var pm = PersistenceManager; 963 901 using (new PerformanceLogger("UpdateDowntime")) { 964 902 var downtimeDao = pm.DowntimeDao; … … 977 915 public IEnumerable<DT.Downtime> GetDowntimesForResource(Guid resourceId) { 978 916 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 979 using (var pm = PersistenceManager)917 var pm = PersistenceManager; 980 918 using (new PerformanceLogger("GetDowntimesForResource")) { 981 919 var downtimeDao = pm.DowntimeDao; … … 1004 942 #region UserPriorities Methods 1005 943 public IEnumerable<DT.UserPriority> GetUserPriorities() { 1006 using (var pm = PersistenceManager)944 var pm = PersistenceManager; 1007 945 using (new PerformanceLogger("GetUserPriorities")) { 1008 946 var userPriorityDao = pm.UserPriorityDao; … … 1024 962 task.Command = null; 1025 963 } else if (taskStateEntity == DA.TaskState.Paused && task.Command != null) { 964 // slave paused and uploaded the task (no user-command) -> set waiting. 1026 965 taskStateEntity = DA.TaskState.Waiting; 1027 966 } … … 1047 986 return resource; 1048 987 } 1049 1050 [MethodImpl(MethodImplOptions.NoInlining)]1051 public string GetCurrentMethod() {1052 StackTrace st = new StackTrace();1053 StackFrame sf = st.GetFrame(1);1054 return sf.GetMethod().Name;1055 }1056 988 #endregion 1057 989 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/PerformanceLogger.cs
r12691 r12857 32 32 public PerformanceLogger(string name) { 33 33 this.name = name; 34 stopwatch = new Stopwatch(); 35 stopwatch.Start(); 34 if (Properties.Settings.Default.ProfileServicePerformance) { 35 stopwatch = new Stopwatch(); 36 stopwatch.Start(); 37 } 36 38 } 37 39 public void Dispose() { 38 stopwatch.Stop(); 39 LogFactory.GetLogger(this.GetType().Namespace).Log(string.Format("{0} took {1}ms", name, stopwatch.ElapsedMilliseconds)); 40 if (Properties.Settings.Default.ProfileServicePerformance) { 41 stopwatch.Stop(); 42 LogFactory.GetLogger(this.GetType().Namespace) 43 .Log(string.Format("{0} took {1}ms", name, stopwatch.ElapsedMilliseconds)); 44 } 40 45 } 41 46 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Properties/Settings.Designer.cs
r12477 r12857 1 1 //------------------------------------------------------------------------------ 2 2 // <auto-generated> 3 // This code was generated by a tool.4 // Runtime Version:4.0.30319.340143 // Dieser Code wurde von einem Tool generiert. 4 // Laufzeitversion:4.0.30319.42000 5 5 // 6 // Changes to this file may cause incorrect behavior and will be lost if7 // the code is regenerated.6 // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 // der Code erneut generiert wird. 8 8 // </auto-generated> 9 9 //------------------------------------------------------------------------------ 10 10 11 11 namespace HeuristicLab.Services.Hive.Properties { 12 13 14 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 18 private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 20 public static Settings Default { 21 get { 22 return defaultInstance; 23 } 12 13 14 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 18 private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 20 public static Settings Default { 21 get { 22 return defaultInstance; 23 } 24 } 25 26 [global::System.Configuration.ApplicationScopedSettingAttribute()] 27 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 [global::System.Configuration.DefaultSettingValueAttribute("00:03:00")] 29 public global::System.TimeSpan SlaveHeartbeatTimeout { 30 get { 31 return ((global::System.TimeSpan)(this["SlaveHeartbeatTimeout"])); 32 } 33 } 34 35 [global::System.Configuration.ApplicationScopedSettingAttribute()] 36 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 37 [global::System.Configuration.DefaultSettingValueAttribute("00:05:30")] 38 public global::System.TimeSpan CalculatingJobHeartbeatTimeout { 39 get { 40 return ((global::System.TimeSpan)(this["CalculatingJobHeartbeatTimeout"])); 41 } 42 } 43 44 [global::System.Configuration.ApplicationScopedSettingAttribute()] 45 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 46 [global::System.Configuration.DefaultSettingValueAttribute("00:15:00")] 47 public global::System.TimeSpan TransferringJobHeartbeatTimeout { 48 get { 49 return ((global::System.TimeSpan)(this["TransferringJobHeartbeatTimeout"])); 50 } 51 } 52 53 [global::System.Configuration.ApplicationScopedSettingAttribute()] 54 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 55 [global::System.Configuration.DefaultSettingValueAttribute("False")] 56 public bool TriggerEventManagerInHeartbeat { 57 get { 58 return ((bool)(this["TriggerEventManagerInHeartbeat"])); 59 } 60 } 61 62 [global::System.Configuration.ApplicationScopedSettingAttribute()] 63 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 [global::System.Configuration.DefaultSettingValueAttribute("00:03:00")] 65 public global::System.TimeSpan CleanupInterval { 66 get { 67 return ((global::System.TimeSpan)(this["CleanupInterval"])); 68 } 69 } 70 71 [global::System.Configuration.ApplicationScopedSettingAttribute()] 72 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 73 [global::System.Configuration.DefaultSettingValueAttribute("3.00:00:00")] 74 public global::System.TimeSpan SweepInterval { 75 get { 76 return ((global::System.TimeSpan)(this["SweepInterval"])); 77 } 78 } 79 80 [global::System.Configuration.ApplicationScopedSettingAttribute()] 81 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 82 [global::System.Configuration.DefaultSettingValueAttribute("00:00:20")] 83 public global::System.TimeSpan SchedulingPatience { 84 get { 85 return ((global::System.TimeSpan)(this["SchedulingPatience"])); 86 } 87 } 88 89 [global::System.Configuration.ApplicationScopedSettingAttribute()] 90 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 91 [global::System.Configuration.DefaultSettingValueAttribute("True")] 92 public bool ProfileServicePerformance { 93 get { 94 return ((bool)(this["ProfileServicePerformance"])); 95 } 96 } 97 98 [global::System.Configuration.ApplicationScopedSettingAttribute()] 99 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 100 [global::System.Configuration.DefaultSettingValueAttribute("00:03:00")] 101 public global::System.TimeSpan GenerateStatisticsInterval { 102 get { 103 return ((global::System.TimeSpan)(this["GenerateStatisticsInterval"])); 104 } 105 } 24 106 } 25 26 [global::System.Configuration.ApplicationScopedSettingAttribute()]27 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]28 [global::System.Configuration.DefaultSettingValueAttribute("00:03:00")]29 public global::System.TimeSpan SlaveHeartbeatTimeout {30 get {31 return ((global::System.TimeSpan)(this["SlaveHeartbeatTimeout"]));32 }33 }34 35 [global::System.Configuration.ApplicationScopedSettingAttribute()]36 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]37 [global::System.Configuration.DefaultSettingValueAttribute("00:05:30")]38 public global::System.TimeSpan CalculatingJobHeartbeatTimeout {39 get {40 return ((global::System.TimeSpan)(this["CalculatingJobHeartbeatTimeout"]));41 }42 }43 44 [global::System.Configuration.ApplicationScopedSettingAttribute()]45 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]46 [global::System.Configuration.DefaultSettingValueAttribute("00:15:00")]47 public global::System.TimeSpan TransferringJobHeartbeatTimeout {48 get {49 return ((global::System.TimeSpan)(this["TransferringJobHeartbeatTimeout"]));50 }51 }52 53 [global::System.Configuration.ApplicationScopedSettingAttribute()]54 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]55 [global::System.Configuration.DefaultSettingValueAttribute("False")]56 public bool TriggerEventManagerInHeartbeat {57 get {58 return ((bool)(this["TriggerEventManagerInHeartbeat"]));59 }60 }61 62 [global::System.Configuration.ApplicationScopedSettingAttribute()]63 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]64 [global::System.Configuration.DefaultSettingValueAttribute("00:03:00")]65 public global::System.TimeSpan CleanupInterval {66 get {67 return ((global::System.TimeSpan)(this["CleanupInterval"]));68 }69 }70 71 [global::System.Configuration.ApplicationScopedSettingAttribute()]72 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]73 [global::System.Configuration.DefaultSettingValueAttribute("3.00:00:00")]74 public global::System.TimeSpan SweepInterval {75 get {76 return ((global::System.TimeSpan)(this["SweepInterval"]));77 }78 }79 80 [global::System.Configuration.ApplicationScopedSettingAttribute()]81 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]82 [global::System.Configuration.DefaultSettingValueAttribute("00:00:20")]83 public global::System.TimeSpan SchedulingPatience {84 get {85 return ((global::System.TimeSpan)(this["SchedulingPatience"]));86 }87 }88 89 [global::System.Configuration.ApplicationScopedSettingAttribute()]90 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]91 [global::System.Configuration.DefaultSettingValueAttribute("00:01:00")]92 public global::System.TimeSpan GenerateStatisticsInterval {93 get {94 return ((global::System.TimeSpan)(this["GenerateStatisticsInterval"]));95 }96 }97 }98 107 } -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/Properties/Settings.settings
r9123 r12857 24 24 <Value Profile="(Default)">00:00:20</Value> 25 25 </Setting> 26 <Setting Name="ProfileServicePerformance" Type="System.Boolean" Scope="Application"> 27 <Value Profile="(Default)">True</Value> 28 </Setting> 29 <Setting Name="GenerateStatisticsInterval" Type="System.TimeSpan" Scope="Application"> 30 <Value Profile="(Default)">00:03:00</Value> 31 </Setting> 26 32 </Settings> 27 33 </SettingsFile> -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs
r12768 r12857 41 41 42 42 [OperationContract] 43 IEnumerable<Task> GetTasks();44 45 [OperationContract]46 IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds);47 48 [OperationContract]49 IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent);50 51 [OperationContract]52 43 IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId); 53 44 … … 65 56 66 57 [OperationContract] 67 void DeleteTask(Guid taskId);68 69 [OperationContract]70 void DeleteChildTasks(Guid parentTaskId);71 72 [OperationContract]73 58 Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception); 74 59 #endregion … … 89 74 Job GetJob(Guid id); 90 75 91 /// <summary>92 /// Returns all task for the current user93 /// </summary>94 76 [OperationContract] 95 77 IEnumerable<Job> GetJobs(); 96 78 97 /// <summary>98 /// Returns all task in the hive (only for admins)99 /// </summary>100 /// <returns></returns>101 [OperationContract]102 IEnumerable<Job> GetAllJobs();103 104 79 [OperationContract] 105 80 Guid AddJob(Job jobDto); … … 142 117 [OperationContract] 143 118 Plugin GetPlugin(Guid pluginId); 144 145 [OperationContract]146 Plugin GetPluginByHash(byte[] hash);147 119 148 120 [OperationContract] … … 155 127 [OperationContract] 156 128 IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds); 157 158 [OperationContract]159 void DeletePlugin(Guid pluginId);160 129 #endregion 161 130 … … 171 140 #endregion 172 141 173 #region Resource Methods174 [OperationContract]175 IEnumerable<Resource> GetChildResources(Guid resourceId);176 #endregion177 178 142 #region Slave Methods 179 143 [OperationContract] … … 187 151 188 152 [OperationContract] 189 SlaveGroup GetSlaveGroup(Guid slaveGroupId);190 191 [OperationContract]192 153 IEnumerable<Slave> GetSlaves(); 193 154 … … 215 176 [OperationContract] 216 177 Guid GetResourceId(string resourceName); 217 218 [OperationContract]219 IEnumerable<Task> GetTasksByResourceId(Guid resourceId);220 178 221 179 [OperationContract] -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/ServiceLocator.cs
r12789 r12857 131 131 } 132 132 } 133 133 134 private ITaskScheduler newtaskScheduler; 134 135 public ITaskScheduler NewTaskScheduler { -
branches/HiveStatistics/sources/HeuristicLab.Services.Hive/3.3/app.config
r11623 r12857 29 29 <value>00:00:20</value> 30 30 </setting> 31 <setting name="ProfileServicePerformance" serializeAs="String"> 32 <value>True</value> 33 </setting> 34 <setting name="GenerateStatisticsInterval" serializeAs="String"> 35 <value>00:03:00</value> 36 </setting> 31 37 </HeuristicLab.Services.Hive.Properties.Settings> 32 38 </applicationSettings> 33 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration> 39 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup> 40 </configuration>
Note: See TracChangeset
for help on using the changeset viewer.