- Timestamp:
- 06/20/11 14:16:53 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4
- Files:
-
- 1 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r6431 r6452 120 120 <None Include="app_services.config" /> 121 121 <None Include="app.config" /> 122 <None Include="ClassDiagram 2.cd" />122 <None Include="ClassDiagram.cd" /> 123 123 <None Include="HeuristicLabClientsHivePlugin.cs.frame" /> 124 124 <Compile Include="Exceptions\AddJobToHiveException.cs" /> … … 151 151 <Compile Include="Exceptions\ServiceClientFactoryException.cs" /> 152 152 <Compile Include="ScopeExtensions.cs" /> 153 <Compile Include="ServiceClients\ Appointment.cs" />153 <Compile Include="ServiceClients\Downtime.cs" /> 154 154 <Compile Include="ServiceClients\HiveItemCollection.cs" /> 155 155 <Compile Include="ServiceClients\IHiveItem.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveClient.cs
r6444 r6452 192 192 private Semaphore jobUploadSemaphore = new Semaphore(4, 4); // todo: take magic number into config 193 193 private static object jobCountLocker = new object(); 194 private static object pluginLocker = new object(); 194 195 private void UploadExperiment(RefreshableHiveExperiment refreshableHiveExperiment, CancellationToken cancellationToken) { 195 196 try { … … 285 286 jobCount[0]++; 286 287 } 287 JobData jobData = null; 288 List<IPluginDescription> plugins = null; 289 290 TryAndRepeat(() => { // workaround for persistence bug (thread-safe access to bitmaps) - remove later 291 if (hiveJob.ItemJob.ComputeInParallel && (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) { 292 hiveJob.Job.IsParentJob = true; 293 hiveJob.Job.FinishWhenChildJobsFinished = true; 294 jobData = hiveJob.GetAsJobData(true, out plugins); 295 } else { 296 hiveJob.Job.IsParentJob = false; 297 hiveJob.Job.FinishWhenChildJobsFinished = false; 298 jobData = hiveJob.GetAsJobData(false, out plugins); 299 } 300 }, 30, "Could not serialize job"); 288 JobData jobData; 289 List<IPluginDescription> plugins; 290 291 if (hiveJob.ItemJob.ComputeInParallel && (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) { 292 hiveJob.Job.IsParentJob = true; 293 hiveJob.Job.FinishWhenChildJobsFinished = true; 294 jobData = hiveJob.GetAsJobData(true, out plugins); 295 } else { 296 hiveJob.Job.IsParentJob = false; 297 hiveJob.Job.FinishWhenChildJobsFinished = false; 298 jobData = hiveJob.GetAsJobData(false, out plugins); 299 } 301 300 cancellationToken.ThrowIfCancellationRequested(); 302 301 303 302 TryAndRepeat(() => { 304 303 if (!cancellationToken.IsCancellationRequested) { 305 ServiceLocator.Instance.CallHiveService((s) => hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins)); 304 lock (pluginLocker) { 305 ServiceLocator.Instance.CallHiveService((s) => hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins)); 306 } 306 307 } 307 308 }, -1, "Failed to upload plugins"); … … 333 334 var arguments = (Tuple<HiveJob, HiveJob>)tuple; 334 335 UploadJobWithChildren(progress, arguments.Item1, arguments.Item2, groups, jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged, cancellationToken); 335 }, new Tuple<HiveJob, HiveJob>(child, hiveJob 336 }, new Tuple<HiveJob, HiveJob>(child, hiveJob)) 336 337 .ContinueWith((x) => log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted)); 337 338 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r6426 r6452 82 82 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.StateLog))] 83 83 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Job))] 84 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive. Appointment))]84 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Downtime))] 85 85 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.PluginData))] 86 86 public partial class HiveItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { … … 938 938 "nsfer")] 939 939 [System.SerializableAttribute()] 940 public partial class Appointment: HeuristicLab.Clients.Hive.HiveItem {940 public partial class Downtime : HeuristicLab.Clients.Hive.HiveItem { 941 941 942 942 [System.Runtime.Serialization.OptionalFieldAttribute()] … … 1506 1506 1507 1507 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddAppointment", ReplyAction = "http://tempuri.org/IHiveService/AddAppointmentResponse")] 1508 System.Guid AddAppointment(HeuristicLab.Clients.Hive. Appointmentappointment);1508 System.Guid AddAppointment(HeuristicLab.Clients.Hive.Downtime appointment); 1509 1509 1510 1510 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteAppointment", ReplyAction = "http://tempuri.org/IHiveService/DeleteAppointmentResponse")] … … 1512 1512 1513 1513 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateAppointment", ReplyAction = "http://tempuri.org/IHiveService/UpdateAppointmentResponse")] 1514 void UpdateAppointment(HeuristicLab.Clients.Hive. Appointmentappointment);1514 void UpdateAppointment(HeuristicLab.Clients.Hive.Downtime appointment); 1515 1515 1516 1516 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetScheduleForResource", ReplyAction = "http://tempuri.org/IHiveService/GetScheduleForResourceResponse")] 1517 System.Collections.Generic.List<HeuristicLab.Clients.Hive. Appointment> GetScheduleForResource(System.Guid resourceId);1517 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Downtime> GetScheduleForResource(System.Guid resourceId); 1518 1518 1519 1519 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddJob", ReplyAction = "http://tempuri.org/IHiveService/AddJobResponse")] … … 1694 1694 } 1695 1695 1696 public System.Guid AddAppointment(HeuristicLab.Clients.Hive. Appointmentappointment) {1696 public System.Guid AddAppointment(HeuristicLab.Clients.Hive.Downtime appointment) { 1697 1697 return base.Channel.AddAppointment(appointment); 1698 1698 } … … 1702 1702 } 1703 1703 1704 public void UpdateAppointment(HeuristicLab.Clients.Hive. Appointmentappointment) {1704 public void UpdateAppointment(HeuristicLab.Clients.Hive.Downtime appointment) { 1705 1705 base.Channel.UpdateAppointment(appointment); 1706 1706 } 1707 1707 1708 public System.Collections.Generic.List<HeuristicLab.Clients.Hive. Appointment> GetScheduleForResource(System.Guid resourceId) {1708 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Downtime> GetScheduleForResource(System.Guid resourceId) { 1709 1709 return base.Channel.GetScheduleForResource(resourceId); 1710 1710 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Util/PluginUtil.cs
r6444 r6452 30 30 namespace HeuristicLab.Clients.Hive { 31 31 public static class PluginUtil { 32 private static object locker = new object();33 32 34 33 /// <summary> … … 41 40 /// <returns></returns> 42 41 public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins) { 43 lock (locker) { 44 var pluginIds = new List<Guid>(); 45 Dictionary<IPluginDescription, byte[]> checksumsNeededPlugins = CalcChecksumsForPlugins(neededPlugins); 42 var pluginIds = new List<Guid>(); 43 Dictionary<IPluginDescription, byte[]> checksumsNeededPlugins = CalcChecksumsForPlugins(neededPlugins); 46 44 47 foreach (var neededPlugin in checksumsNeededPlugins) { 48 Plugin foundPlugin = alreadyUploadedPlugins.FirstOrDefault(p => p.Hash.SequenceEqual(neededPlugin.Value)); 45 foreach (var neededPlugin in checksumsNeededPlugins) { 46 Plugin foundPlugin = alreadyUploadedPlugins.FirstOrDefault(p => p.Hash.SequenceEqual(neededPlugin.Value)); 47 if (foundPlugin == null) { 48 foundPlugin = onlinePlugins.FirstOrDefault(p => { 49 if (p.Hash != null) { 50 return p.Hash.SequenceEqual(neededPlugin.Value); 51 } else { 52 return false; 53 } 54 }); 55 49 56 if (foundPlugin == null) { 50 foundPlugin = onlinePlugins.FirstOrDefault(p => { 51 if (p.Hash != null) { 52 return p.Hash.SequenceEqual(neededPlugin.Value); 53 } else { 54 return false; 55 } 56 }); 57 58 if (foundPlugin == null) { 59 Plugin p = CreatePlugin(neededPlugin.Key, neededPlugin.Value); 60 List<PluginData> pd = CreatePluginDatas(neededPlugin.Key); 61 try { 62 p.Id = service.AddPlugin(p, pd); 63 alreadyUploadedPlugins.Add(p); 64 pluginIds.Add(p.Id); 65 } 66 catch (FaultException<PluginAlreadyExistsFault> fault) { 67 onlinePlugins.Add(service.GetPlugin(fault.Detail.Id)); 68 } 69 } else { 70 pluginIds.Add(foundPlugin.Id); 57 Plugin p = CreatePlugin(neededPlugin.Key, neededPlugin.Value); 58 List<PluginData> pd = CreatePluginDatas(neededPlugin.Key); 59 try { 60 p.Id = service.AddPlugin(p, pd); 61 alreadyUploadedPlugins.Add(p); 62 pluginIds.Add(p.Id); 63 } 64 catch (FaultException<PluginAlreadyExistsFault> fault) { 65 onlinePlugins.Add(service.GetPlugin(fault.Detail.Id)); 71 66 } 72 67 } else { 73 68 pluginIds.Add(foundPlugin.Id); 74 69 } 70 } else { 71 pluginIds.Add(foundPlugin.Id); 75 72 } 76 return pluginIds;77 73 } 74 return pluginIds; 78 75 } 79 76
Note: See TracChangeset
for help on using the changeset viewer.