Changeset 7132
- Timestamp:
- 12/06/11 12:49:34 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 13 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/Properties/Settings.Designer.cs
r6983 r7132 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.23 54 // Runtime Version:4.0.30319.239 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 62 62 [global::System.Configuration.UserScopedSettingAttribute()] 63 63 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 [global::System.Configuration.DefaultSettingValueAttribute("HeuristicLab.Clients.Hive.Slave Core.WindowsService")]64 [global::System.Configuration.DefaultSettingValueAttribute("HeuristicLab.Clients.Hive.Slave")] 65 65 public string ServiceName { 66 66 get { -
trunk/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/Properties/Settings.settings
r6983 r7132 13 13 </Setting> 14 14 <Setting Name="ServiceName" Type="System.String" Scope="User"> 15 <Value Profile="(Default)">HeuristicLab.Clients.Hive.Slave Core.WindowsService</Value>15 <Value Profile="(Default)">HeuristicLab.Clients.Hive.Slave</Value> 16 16 </Setting> 17 17 </Settings> -
trunk/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/app.config
r6983 r7132 17 17 <value>SlaveCommunicationServiceEndpoint</value> 18 18 </setting> 19 <setting name="ServiceName" serializeAs="String"> 20 <value>HeuristicLab.Clients.Hive.Slave</value> 21 </setting> 19 22 </HeuristicLab.Clients.Hive.SlaveCore.Views.Properties.Settings> 20 23 </userSettings> -
trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/WcfService.cs
r6983 r7132 42 42 if (instance == null) { 43 43 instance = new WcfService(); 44 ServiceLocator.Instance.Username = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlaveUser;45 ServiceLocator.Instance.Password = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlavePwd;44 HiveServiceLocator.Instance.Username = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlaveUser; 45 HiveServiceLocator.Instance.Password = HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings.Default.SlavePwd; 46 46 } 47 47 return instance; … … 161 161 public void CallHiveService(Action<IHiveService> call) { 162 162 try { 163 ServiceLocator.Instance.CallHiveService(call);163 HiveServiceLocator.Instance.CallHiveService(call); 164 164 } 165 165 catch (Exception ex) { … … 170 170 private T CallHiveService<T>(Func<IHiveService, T> call) { 171 171 try { 172 return ServiceLocator.Instance.CallHiveService(call);172 return HiveServiceLocator.Instance.CallHiveService(call); 173 173 } 174 174 catch (Exception ex) { -
trunk/sources/HeuristicLab.Clients.Hive/3.3/ConcurrentTaskDownloader.cs
r7125 r7132 69 69 70 70 private Task DownloadTask(object taskId) { 71 return ServiceLocator.Instance.CallHiveService(s => s.GetTask((Guid)taskId));71 return HiveServiceLocator.Instance.CallHiveService(s => s.GetTask((Guid)taskId)); 72 72 } 73 73 … … 81 81 try { 82 82 if (abort) return null; 83 result = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData(task.Id));83 result = HiveServiceLocator.Instance.CallHiveService(s => s.GetTaskData(task.Id)); 84 84 } finally { 85 85 downloadSemaphore.Release(); -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj
r7021 r7132 116 116 </Compile> 117 117 <Compile Include="Exceptions\ResourceNotFoundException.cs" /> 118 <Compile Include="I ServiceLocator.cs" />118 <Compile Include="IHiveServiceLocator.cs" /> 119 119 <Compile Include="Tasks\EngineTask.cs" /> 120 120 <Compile Include="Tasks\OptimizerTask.cs" /> … … 149 149 <Compile Include="ServiceClients\HiveServiceClient.cs" /> 150 150 <Compile Include="ServiceClients\Task.cs" /> 151 <Compile Include=" ServiceLocator.cs" />151 <Compile Include="HiveServiceLocator.cs" /> 152 152 <None Include="HeuristicLab.snk" /> 153 153 <None Include="ServiceClients\GenerateServiceClients.cmd" /> -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveAdminClient.cs
r6976 r7132 79 79 resources = new ItemList<Resource>(); 80 80 81 ServiceLocator.Instance.CallHiveService(service => {81 HiveServiceLocator.Instance.CallHiveService(service => { 82 82 service.GetSlaveGroups().ForEach(g => resources.Add(g)); 83 83 service.GetSlaves().ForEach(s => resources.Add(s)); … … 101 101 downtimes = new ItemList<Downtime>(); 102 102 103 ServiceLocator.Instance.CallHiveService(service => {103 HiveServiceLocator.Instance.CallHiveService(service => { 104 104 service.GetDowntimesForResource(downtimeForResourceId).ForEach(d => downtimes.Add(d)); 105 105 }); … … 119 119 if (item.Id == Guid.Empty) { 120 120 if (item is SlaveGroup) { 121 item.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddSlaveGroup((SlaveGroup)item));121 item.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddSlaveGroup((SlaveGroup)item)); 122 122 } 123 123 if (item is Slave) { 124 item.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddSlave((Slave)item));124 item.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddSlave((Slave)item)); 125 125 } 126 126 if (item is Downtime) { 127 item.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddDowntime((Downtime)item));127 item.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddDowntime((Downtime)item)); 128 128 } 129 129 } else { 130 130 if (item is SlaveGroup) { 131 ServiceLocator.Instance.CallHiveService((s) => s.UpdateSlaveGroup((SlaveGroup)item));131 HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateSlaveGroup((SlaveGroup)item)); 132 132 } 133 133 if (item is Slave) { 134 ServiceLocator.Instance.CallHiveService((s) => s.UpdateSlave((Slave)item));134 HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateSlave((Slave)item)); 135 135 } 136 136 if (item is Downtime) { 137 ServiceLocator.Instance.CallHiveService((s) => s.UpdateDowntime((Downtime)item));137 HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateDowntime((Downtime)item)); 138 138 } 139 139 } … … 144 144 public static void Delete(IHiveItem item) { 145 145 if (item is SlaveGroup) { 146 ServiceLocator.Instance.CallHiveService((s) => s.DeleteSlaveGroup(item.Id));146 HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteSlaveGroup(item.Id)); 147 147 } else if (item is Slave) { 148 ServiceLocator.Instance.CallHiveService((s) => s.DeleteSlave(item.Id));148 HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteSlave(item.Id)); 149 149 } else if (item is Downtime) { 150 ServiceLocator.Instance.CallHiveService((s) => s.DeleteDowntime(item.Id));150 HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteDowntime(item.Id)); 151 151 } 152 152 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r7125 r7132 82 82 83 83 try { 84 this.IsAllowedPrivileged = ServiceLocator.Instance.CallHiveService((s) => s.IsAllowedPrivileged());84 this.IsAllowedPrivileged = HiveServiceLocator.Instance.CallHiveService((s) => s.IsAllowedPrivileged()); 85 85 86 86 var oldJobs = jobs ?? new ItemCollection<RefreshableJob>(); 87 87 jobs = new HiveItemCollection<RefreshableJob>(); 88 var jobsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());88 var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs()); 89 89 90 90 foreach (var j in jobsLoaded) { … … 142 142 if (item is JobPermission) { 143 143 var hep = (JobPermission)item; 144 hep.GrantedUserId = ServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));144 hep.GrantedUserId = HiveServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName)); 145 145 if (hep.GrantedUserId == Guid.Empty) { 146 146 throw new ArgumentException(string.Format("The user {0} was not found.", hep.GrantedUserName)); 147 147 } 148 ServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));148 HiveServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission)); 149 149 } 150 150 } else { 151 151 if (item is Job) 152 ServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item));152 HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item)); 153 153 } 154 154 } … … 176 176 177 177 if (item is Job) 178 ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));178 HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id)); 179 179 if (item is RefreshableJob) 180 ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));180 HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id)); 181 181 if (item is JobPermission) { 182 182 var hep = (JobPermission)item; 183 ServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));183 HiveServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId)); 184 184 } 185 185 item.Id = Guid.Empty; … … 215 215 216 216 public static void PauseJob(RefreshableJob refreshableJob) { 217 ServiceLocator.Instance.CallHiveService(service => {217 HiveServiceLocator.Instance.CallHiveService(service => { 218 218 foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) { 219 219 if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed) … … 225 225 226 226 public static void StopJob(RefreshableJob refreshableJob) { 227 ServiceLocator.Instance.CallHiveService(service => {227 HiveServiceLocator.Instance.CallHiveService(service => { 228 228 foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) { 229 229 if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed) … … 246 246 var resourceIds = new List<Guid>(); 247 247 foreach (var resourceName in resourceNames) { 248 Guid resourceId = ServiceLocator.Instance.CallHiveService((s) => s.GetResourceId(resourceName));248 Guid resourceId = HiveServiceLocator.Instance.CallHiveService((s) => s.GetResourceId(resourceName)); 249 249 if (resourceId == Guid.Empty) { 250 250 throw new ResourceNotFoundException(string.Format("Could not find the resource '{0}'", resourceName)); … … 259 259 // upload Job 260 260 refreshableJob.Progress.Status = "Uploading Job..."; 261 refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));261 refreshableJob.Job.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job)); 262 262 bool isPrivileged = refreshableJob.Job.IsPrivileged; 263 refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions263 refreshableJob.Job = HiveServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions 264 264 refreshableJob.Job.IsPrivileged = isPrivileged; 265 265 cancellationToken.ThrowIfCancellationRequested(); … … 271 271 // upload plugins 272 272 refreshableJob.Progress.Status = "Uploading plugins..."; 273 this.OnlinePlugins = ServiceLocator.Instance.CallHiveService((s) => s.GetPlugins());273 this.OnlinePlugins = HiveServiceLocator.Instance.CallHiveService((s) => s.GetPlugins()); 274 274 this.AlreadyUploadedPlugins = new List<Plugin>(); 275 Plugin configFilePlugin = ServiceLocator.Instance.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins));275 Plugin configFilePlugin = HiveServiceLocator.Instance.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins)); 276 276 this.alreadyUploadedPlugins.Add(configFilePlugin); 277 277 cancellationToken.ThrowIfCancellationRequested(); … … 357 357 if (!cancellationToken.IsCancellationRequested) { 358 358 lock (pluginLocker) { 359 ServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));359 HiveServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins)); 360 360 } 361 361 } … … 370 370 if (!cancellationToken.IsCancellationRequested) { 371 371 if (parentHiveTask != null) { 372 hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));372 hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData)); 373 373 } else { 374 hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));374 hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList())); 375 375 } 376 376 } … … 417 417 // fetch all task objects to create the full tree of tree of HiveTask objects 418 418 refreshableJob.Progress.Status = "Downloading list of tasks..."; 419 allTasks = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id));419 allTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id)); 420 420 totalJobCount = allTasks.Count(); 421 421 … … 480 480 481 481 public static ItemTask LoadItemJob(Guid jobId) { 482 TaskData taskData = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId));482 TaskData taskData = HiveServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId)); 483 483 try { 484 484 return PersistenceUtil.Deserialize<ItemTask>(taskData.Data); … … 505 505 506 506 public static HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId) { 507 return ServiceLocator.Instance.CallHiveService((service) => {507 return HiveServiceLocator.Instance.CallHiveService((service) => { 508 508 IEnumerable<JobPermission> jps = service.GetJobPermissions(jobId); 509 509 foreach (var hep in jps) { -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs
r7125 r7132 456 456 try { 457 457 foreach (var child in childHiveTasks) { 458 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id));458 HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id)); 459 459 } 460 460 } 461 461 finally { childHiveTasksLock.ExitReadLock(); } 462 462 } else { 463 ServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));463 HiveServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id)); 464 464 } 465 465 } … … 470 470 try { 471 471 foreach (var child in childHiveTasks) { 472 ServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id));472 HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id)); 473 473 } 474 474 } 475 475 finally { childHiveTasksLock.ExitReadLock(); } 476 476 } else { 477 ServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));477 HiveServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id)); 478 478 } 479 479 } 480 480 481 481 public void Restart() { 482 ServiceLocator.Instance.CallHiveService(service => {482 HiveServiceLocator.Instance.CallHiveService(service => { 483 483 TaskData taskData = new TaskData(); 484 484 taskData.TaskId = this.task.Id; -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs
r7129 r7132 24 24 25 25 namespace HeuristicLab.Clients.Hive { 26 public class ServiceLocator : IServiceLocator {27 private static I ServiceLocator instance = null;28 public static I ServiceLocator Instance {26 public class HiveServiceLocator : IHiveServiceLocator { 27 private static IHiveServiceLocator instance = null; 28 public static IHiveServiceLocator Instance { 29 29 get { 30 30 if (instance == null) { 31 instance = new ServiceLocator();31 instance = new HiveServiceLocator(); 32 32 } 33 33 return instance; -
trunk/sources/HeuristicLab.Clients.Hive/3.3/IHiveServiceLocator.cs
r7129 r7132 23 23 24 24 namespace HeuristicLab.Clients.Hive { 25 public interface I ServiceLocator {25 public interface IHiveServiceLocator { 26 26 string Username { get; set; } 27 27 string Password { get; set; } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/JobResultPoller.cs
r6976 r7132 106 106 107 107 public IEnumerable<LightweightTask> FetchJobResults() { 108 return ServiceLocator.Instance.CallHiveService(service => {108 return HiveServiceLocator.Instance.CallHiveService(service => { 109 109 var responses = new List<LightweightTask>(); 110 110 responses.AddRange(service.GetLightweightJobTasks(jobId)); -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.Designer.cs
r7125 r7132 53 53 [global::System.Configuration.ApplicationScopedSettingAttribute()] 54 54 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 55 [global::System.Configuration.DefaultSettingValueAttribute(" 5")]55 [global::System.Configuration.DefaultSettingValueAttribute("2")] 56 56 public int MaxParallelDownloads { 57 57 get { -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.settings
r7125 r7132 13 13 </Setting> 14 14 <Setting Name="MaxParallelDownloads" Type="System.Int32" Scope="Application"> 15 <Value Profile="(Default)"> 5</Value>15 <Value Profile="(Default)">2</Value> 16 16 </Setting> 17 17 <Setting Name="MaxRepeatServiceCalls" Type="System.Int32" Scope="Application"> -
trunk/sources/HeuristicLab.Clients.Hive/3.3/app.config
r7125 r7132 18 18 </setting> 19 19 <setting name="MaxParallelDownloads" serializeAs="String"> 20 <value> 5</value>20 <value>2</value> 21 21 </setting> 22 22 <setting name="MaxRepeatServiceCalls" serializeAs="String">
Note: See TracChangeset
for help on using the changeset viewer.