- Timestamp:
- 05/04/19 08:22:42 (6 years ago)
- Location:
- branches/2925_AutoDiffForDynamicalModels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2925_AutoDiffForDynamicalModels
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Clients.Hive merged: 16878
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/HiveAdminClient.cs
r16662 r16892 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using System.Threading; 26 using HeuristicLab.Clients.Access; 24 27 using HeuristicLab.Common; 25 28 using HeuristicLab.Core; 26 using System.Collections.Generic;27 using System.Linq;28 using HeuristicLab.Clients.Access;29 29 30 30 namespace HeuristicLab.Clients.Hive { … … 77 77 if (value != jobs) 78 78 jobs = value; 79 79 } 80 80 } 81 81 … … 166 166 if (projectIds.Any()) { 167 167 service.GetAssignedResourcesForProjectsAdministration(projectIds) 168 .ForEach(a => projectResourceAssignments.Add(a));169 projectIds.ForEach(p => jobs.Add(p, new HiveItemCollection<RefreshableJob>())); 168 .ForEach(a => projectResourceAssignments.Add(a)); 169 170 170 var unsortedJobs = service.GetJobsByProjectIds(projectIds) 171 .OrderBy(x => x.DateCreated).ToList(); 172 173 unsortedJobs.Where(j => j.State == JobState.DeletionPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 174 unsortedJobs.Where(j => j.State == JobState.StatisticsPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 175 unsortedJobs.Where(j => j.State == JobState.Online).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 176 177 foreach (var job in jobs.SelectMany(x => x.Value)) 178 LoadLightweightJob(job); 171 .OrderBy(x => x.DateCreated).ToList(); 179 172 180 173 projectNames = service.GetProjectNames(); … … 187 180 RefreshDisabledParentProjects(); 188 181 RefreshDisabledParentResources(); 189 } 190 catch { 182 } catch { 191 183 throw; 192 } 193 finally { 184 } finally { 194 185 OnRefreshed(); 195 186 } 196 187 } 197 198 //public void UpdateResourceGenealogy(IItemList<Resource> resources) {199 // resourceAncestors.Clear();200 // resourceDescendants.Clear();201 202 // foreach (var r in resources) {203 // resourceAncestors.Add(r.Id, new HashSet<Resource>());204 // resourceDescendants.Add(r.Id, new HashSet<Resource>());205 // }206 207 // foreach (var r in resources) {208 // var parentResourceId = r.ParentResourceId;209 // while (parentResourceId != null) {210 // var parent = resources.SingleOrDefault(x => x.Id == parentResourceId);211 // if (parent != null) {212 // resourceAncestors[r.Id].Add(parent);213 // resourceDescendants[parent.Id].Add(r);214 // parentResourceId = parent.ParentResourceId;215 // } else {216 // parentResourceId = null;217 // }218 // }219 // }220 //}221 222 //public void UpdateProjectGenealogy(IItemList<Project> projects) {223 // projectAncestors.Clear();224 // projectDescendants.Clear();225 226 // foreach (var p in projects) {227 // projectAncestors.Add(p.Id, new HashSet<Project>());228 // projectDescendants.Add(p.Id, new HashSet<Project>());229 // }230 231 // foreach (var p in projects) {232 // var parentProjectId = p.ParentProjectId;233 // while (parentProjectId != null) {234 // var parent = projects.SingleOrDefault(x => x.Id == parentProjectId);235 // if (parent != null) {236 // projectAncestors[p.Id].Add(parent);237 // projectDescendants[parent.Id].Add(p);238 // parentProjectId = parent.ParentProjectId;239 // } else {240 // parentProjectId = null;241 // }242 // }243 // }244 //}245 188 246 189 private void UpdateResourceGenealogy() { … … 314 257 } 315 258 316 public void RefreshJobs() { 317 var projectIds = new List<Guid>(); 318 jobs = new Dictionary<Guid, HiveItemCollection<RefreshableJob>>(); 319 tasks = new Dictionary<Guid, List<LightweightTask>>(); 320 259 public void RefreshJobs(Guid projectId) { 321 260 HiveServiceLocator.Instance.CallHiveService(service => { 322 service.GetProjectsForAdministration().ForEach(p => projectIds.Add(p.Id)); 323 if(projectIds.Any()) { 324 projectIds.ForEach(p => jobs.Add(p, new HiveItemCollection<RefreshableJob>())); 325 var unsortedJobs = service.GetJobsByProjectIds(projectIds) 326 .OrderBy(x => x.DateCreated).ToList(); 327 261 var projectIds = new HashSet<Guid>(service.GetProjectsForAdministration().Select(x => x.Id)); 262 if (projectIds.Contains(projectId)) { 263 jobs.Add(projectId, new HiveItemCollection<RefreshableJob>()); 264 265 var unsortedJobs = service.GetJobsByProjectId(projectId) 266 .OrderBy(x => x.DateCreated).ToList(); 267 328 268 unsortedJobs.Where(j => j.State == JobState.DeletionPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 329 269 unsortedJobs.Where(j => j.State == JobState.StatisticsPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 330 270 unsortedJobs.Where(j => j.State == JobState.Online).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j))); 331 271 332 foreach (var job in jobs.SelectMany(x => x.Value))272 foreach (var job in jobs.SelectMany(x => x.Value)) 333 273 LoadLightweightJob(job); 334 274 } … … 344 284 tasks[job.Id].AddRange(lightweightTasks); 345 285 } else { 346 tasks.Add(job.Id, new List<LightweightTask>(lightweightTasks)); 286 tasks.Add(job.Id, new List<LightweightTask>(lightweightTasks)); 347 287 } 348 288 349 289 if (lightweightTasks != null && lightweightTasks.Count > 0 && lightweightTasks.All(x => x.Id != Guid.Empty)) { 350 290 if (lightweightTasks.All(x => 351 x.State == TaskState.Finished 352 || x.State == TaskState.Aborted 291 x.State == TaskState.Finished 292 || x.State == TaskState.Aborted 353 293 || x.State == TaskState.Failed)) { 354 294 refreshableJob.ExecutionState = ExecutionState.Stopped; … … 366 306 refreshableJob.ExecutionState = ExecutionState.Paused; 367 307 refreshableJob.RefreshAutomatically = false; 368 } else if (lightweightTasks.Any(x => x.State == TaskState.Calculating 369 || x.State == TaskState.Transferring 308 } else if (lightweightTasks.Any(x => x.State == TaskState.Calculating 309 || x.State == TaskState.Transferring 370 310 || x.State == TaskState.Waiting)) { 371 311 refreshableJob.ExecutionState = ExecutionState.Started; … … 377 317 378 318 public void SortJobs() { 379 for (int i = 0; i < jobs.Count; i++) {319 for (int i = 0; i < jobs.Count; i++) { 380 320 var projectId = jobs.Keys.ElementAt(i); 381 321 var unsortedJobs = jobs.Values.ElementAt(i); … … 403 343 service.GetDowntimesForResource(downtimeForResourceId).ForEach(d => downtimes.Add(d)); 404 344 }); 405 } 406 catch { 345 } catch { 407 346 throw; 408 } 409 finally { 347 } finally { 410 348 OnRefreshed(); 411 349 } … … 521 459 522 460 public IEnumerable<Project> GetAvailableProjectDescendants(Guid id) { 523 if (projectDescendants.ContainsKey(id)) return projects.Where(x => projectDescendants[id].Contains(x.Id));461 if (projectDescendants.ContainsKey(id)) return projects.Where(x => projectDescendants[id].Contains(x.Id)); 524 462 else return Enumerable.Empty<Project>(); 525 463 } … … 545 483 546 484 public bool CheckAccessToAdminAreaGranted() { 547 if (projects != null) {485 if (projects != null) { 548 486 return projects.Count > 0; 549 487 } else { … … 561 499 if (res.OwnerUserId == userId) { 562 500 return true; 563 } else if (resourceAncestors.ContainsKey(res.Id)) {501 } else if (resourceAncestors.ContainsKey(res.Id)) { 564 502 return GetAvailableResourceAncestors(res.Id).Where(x => x.OwnerUserId == userId).Any(); 565 503 } … … 583 521 if (pro == null || userId == Guid.Empty) return false; 584 522 585 if (projectAncestors.ContainsKey(pro.Id)) {523 if (projectAncestors.ContainsKey(pro.Id)) { 586 524 return GetAvailableProjectAncestors(pro.Id).Any(x => x.OwnerUserId == userId); 587 525 } … … 613 551 // ... if the user is no admin nor owner of the new parent or grand..grandparents 614 552 changePossible = false; 615 } else if (parent != null && projectDescendants.ContainsKey(child.Id)) {553 } else if (parent != null && projectDescendants.ContainsKey(child.Id)) { 616 554 // ... if the new parent is among the moved project's descendants 617 555 changePossible = !GetAvailableProjectDescendants(child.Id).Where(x => x.Id == parent.Id).Any(); … … 630 568 // ... or the new parent is a slave 631 569 // ... or there is not parental change 632 if (child == null 570 if (child == null 633 571 || child == parent 634 572 || (parent != null && parent.Id == Guid.Empty) … … 645 583 646 584 public IEnumerable<Resource> GetAssignedResourcesForJob(Guid jobId) { 647 var assignedJobResource = 585 var assignedJobResource = HiveServiceLocator.Instance.CallHiveService(service => service.GetAssignedResourcesForJob(jobId)); 648 586 return Resources.Where(x => assignedJobResource.Select(y => y.ResourceId).Contains(x.Id)); 649 587 } -
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/ServiceClients/GenerateServiceClients.cmd
r15361 r16892 13 13 IF "%GENERATECONFIG%"=="" SET GENERATECONFIG=y 14 14 15 SET ARGS=http://%HOST%/Hive-3. 3/HiveService.svc?wsdl ^15 SET ARGS=http://%HOST%/Hive-3.4/HiveService.svc?wsdl ^ 16 16 /out:HiveServiceClient ^ 17 17 /namespace:*,HeuristicLab.Clients.Hive ^
Note: See TracChangeset
for help on using the changeset viewer.