- Timestamp:
- 12/06/11 12:49:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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) {
Note: See TracChangeset
for help on using the changeset viewer.