Changeset 6000 for branches/HeuristicLab.Hive-3.4/sources
- Timestamp:
- 04/11/11 15:32:27 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 10 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.Tests/Mocks/MockHiveService.cs
r5779 r6000 266 266 } 267 267 268 public Plugin GetPlugin(Guid pluginId) { 269 if (plugins == null) 270 plugins = ReadPluginsFromServerCache(); 271 return plugins.SingleOrDefault(x => x.Id == pluginId); 272 } 273 268 274 public List<Plugin> GetPlugins() { 269 275 if (plugins == null) -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/ExperimentManagerClient.cs
r5958 r6000 50 50 } 51 51 52 private IEnumerable<Plugin> onlinePlugins;53 public IEnumerable<Plugin> OnlinePlugins {52 private List<Plugin> onlinePlugins; 53 public List<Plugin> OnlinePlugins { 54 54 get { return onlinePlugins; } 55 55 set { onlinePlugins = value; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/PluginUtil.cs
r5958 r6000 24 24 using System.IO; 25 25 using System.Linq; 26 using System.ServiceModel; 26 27 using HeuristicLab.PluginInfrastructure; 27 28 … … 38 39 /// <param name="useLocalPlugins">If true, the plugins which are already online are ignored. All local plugins are uploaded, but only once.</param> 39 40 /// <returns></returns> 40 public static List<Guid> GetPluginDependencies(IHiveService service, IEnumerable<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins, bool useLocalPlugins) {41 public static List<Guid> GetPluginDependencies(IHiveService service, List<Plugin> onlinePlugins, List<Plugin> alreadyUploadedPlugins, IEnumerable<IPluginDescription> neededPlugins, bool useLocalPlugins) { 41 42 var pluginIds = new List<Guid>(); 42 43 foreach (var neededPlugin in neededPlugins) { 43 Plugin foundPlugin = alreadyUploadedPlugins. SingleOrDefault(p => p.Name == neededPlugin.Name && p.Version == neededPlugin.Version);44 Plugin foundPlugin = alreadyUploadedPlugins.FirstOrDefault(p => p.Name == neededPlugin.Name && p.Version == neededPlugin.Version); 44 45 if (foundPlugin == null) { 45 foundPlugin = onlinePlugins. SingleOrDefault(p => p.Name == neededPlugin.Name && p.Version == neededPlugin.Version);46 foundPlugin = onlinePlugins.FirstOrDefault(p => p.Name == neededPlugin.Name && p.Version == neededPlugin.Version); 46 47 if (useLocalPlugins || foundPlugin == null) { 47 48 Plugin p = CreatePlugin(neededPlugin, useLocalPlugins); 48 49 List<PluginData> pd = CreatePluginDatas(neededPlugin); 49 p.Id = service.AddPlugin(p, pd); 50 alreadyUploadedPlugins.Add(p); 51 pluginIds.Add(p.Id); 50 try { 51 p.Id = service.AddPlugin(p, pd); 52 alreadyUploadedPlugins.Add(p); 53 pluginIds.Add(p.Id); 54 } 55 catch (FaultException<PluginAlreadyExistsFault> fault) { 56 onlinePlugins.Add(service.GetPlugin(fault.Detail.Id)); 57 } 52 58 } else { 53 59 pluginIds.Add(foundPlugin.Id); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r5955 r6000 1673 1673 } 1674 1674 1675 [System.Diagnostics.DebuggerStepThroughAttribute()] 1676 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1677 [System.Runtime.Serialization.DataContractAttribute(Name="PluginAlreadyExistsFault", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common")] 1678 [System.SerializableAttribute()] 1679 public partial class PluginAlreadyExistsFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged 1680 { 1681 1682 [System.NonSerializedAttribute()] 1683 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 1684 1685 [System.Runtime.Serialization.OptionalFieldAttribute()] 1686 private System.Guid IdField; 1687 1688 public System.Runtime.Serialization.ExtensionDataObject ExtensionData 1689 { 1690 get 1691 { 1692 return this.extensionDataField; 1693 } 1694 set 1695 { 1696 this.extensionDataField = value; 1697 } 1698 } 1699 1700 [System.Runtime.Serialization.DataMemberAttribute()] 1701 public System.Guid Id 1702 { 1703 get 1704 { 1705 return this.IdField; 1706 } 1707 set 1708 { 1709 if ((this.IdField.Equals(value) != true)) 1710 { 1711 this.IdField = value; 1712 this.RaisePropertyChanged("Id"); 1713 } 1714 } 1715 } 1716 1717 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 1718 1719 protected void RaisePropertyChanged(string propertyName) 1720 { 1721 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 1722 if ((propertyChanged != null)) 1723 { 1724 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 1725 } 1726 } 1727 } 1728 1675 1729 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 1676 1730 [System.ServiceModel.ServiceContractAttribute(ConfigurationName="HeuristicLab.Clients.Hive.IHiveService")] … … 1678 1732 { 1679 1733 1734 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddAppointment", ReplyAction="http://tempuri.org/IHiveService/AddAppointmentResponse")] 1735 System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment); 1736 1680 1737 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteAppointment", ReplyAction="http://tempuri.org/IHiveService/DeleteAppointmentResponse")] 1681 1738 void DeleteAppointment(System.Guid appointmentId); … … 1759 1816 System.Collections.Generic.List<HeuristicLab.Clients.Hive.MessageContainer> Heartbeat([System.ServiceModel.MessageParameterAttribute(Name="heartbeat")] HeuristicLab.Clients.Hive.Heartbeat heartbeat1); 1760 1817 1818 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetPlugin", ReplyAction="http://tempuri.org/IHiveService/GetPluginResponse")] 1819 HeuristicLab.Clients.Hive.Plugin GetPlugin(System.Guid pluginId); 1820 1761 1821 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddPlugin", ReplyAction="http://tempuri.org/IHiveService/AddPluginResponse")] 1822 [System.ServiceModel.FaultContractAttribute(typeof(HeuristicLab.Clients.Hive.PluginAlreadyExistsFault), Action="http://tempuri.org/IHiveService/AddPluginPluginAlreadyExistsFaultFault", Name="PluginAlreadyExistsFault", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common")] 1762 1823 System.Guid AddPlugin(HeuristicLab.Clients.Hive.Plugin plugin, System.Collections.Generic.List<HeuristicLab.Clients.Hive.PluginData> pluginData); 1763 1824 … … 1809 1870 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/TriggerLifecycle", ReplyAction="http://tempuri.org/IHiveService/TriggerLifecycleResponse")] 1810 1871 void TriggerLifecycle(bool force); 1811 1812 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddAppointment", ReplyAction="http://tempuri.org/IHiveService/AddAppointmentResponse")]1813 System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment);1814 1872 } 1815 1873 … … 1848 1906 } 1849 1907 1908 public System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment) 1909 { 1910 return base.Channel.AddAppointment(appointment); 1911 } 1912 1850 1913 public void DeleteAppointment(System.Guid appointmentId) 1851 1914 { … … 1983 2046 } 1984 2047 2048 public HeuristicLab.Clients.Hive.Plugin GetPlugin(System.Guid pluginId) 2049 { 2050 return base.Channel.GetPlugin(pluginId); 2051 } 2052 1985 2053 public System.Guid AddPlugin(HeuristicLab.Clients.Hive.Plugin plugin, System.Collections.Generic.List<HeuristicLab.Clients.Hive.PluginData> pluginData) 1986 2054 { … … 2067 2135 base.Channel.TriggerLifecycle(force); 2068 2136 } 2069 2070 public System.Guid AddAppointment(HeuristicLab.Clients.Hive.Appointment appointment)2071 {2072 return base.Channel.AddAppointment(appointment);2073 }2074 2137 } 2075 2138 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Plugin.cs
r5955 r6000 39 39 return new Plugin(this, cloner); 40 40 } 41 42 public override string ToString() { 43 return string.Format("{0}-{1}", this.Name, this.Version.ToString()) + (this.IsLocal ? ", Local" : string.Empty); 44 } 41 45 } 42 46 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive 3.4.sln
r5958 r6000 34 34 ProjectSection(WebsiteProperties) = preProject 35 35 TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" 36 ProjectReferences = "{CF9DA321-AC1B-4FD3-9EC3-67BC6B861BDE}|HeuristicLab.Services.Hive-3.4.dll;{14424A16-48D4-445E-80BF-DDF617548BBB}|HeuristicLab.Services.Hive.Common-3.4.dll;{EC2C8109-6E1E-4C88-9A2B-908CFF2EF4AC}|HeuristicLab.Services.Hive.DataAccess-3.4.dll; "36 ProjectReferences = "{CF9DA321-AC1B-4FD3-9EC3-67BC6B861BDE}|HeuristicLab.Services.Hive-3.4.dll;{14424A16-48D4-445E-80BF-DDF617548BBB}|HeuristicLab.Services.Hive.Common-3.4.dll;{EC2C8109-6E1E-4C88-9A2B-908CFF2EF4AC}|HeuristicLab.Services.Hive.DataAccess-3.4.dll;{F98A1740-9AC9-4D36-A582-6A2D0D06978D}|HeuristicLab.Hive-3.4.dll;" 37 37 Debug.AspNetCompiler.VirtualPath = "/Hive-3.4" 38 38 Debug.AspNetCompiler.PhysicalPath = "HeuristicLab.Services.Hive.Web\Hive-3.4\" … … 92 92 EndProject 93 93 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HiveEngine-3.4", "HeuristicLab.HiveEngine\3.4\HeuristicLab.HiveEngine-3.4.csproj", "{2C036542-5451-4A23-AFF6-87575C7BAFE7}" 94 EndProject 95 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.HiveEngine.Test", "HeuristicLab.HiveEngine.Test\HeuristicLab.HiveEngine.Test.csproj", "{87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}" 94 96 EndProject 95 97 Global … … 386 388 {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x86.ActiveCfg = Release|x86 387 389 {2C036542-5451-4A23-AFF6-87575C7BAFE7}.Release|x86.Build.0 = Release|x86 390 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 391 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|Any CPU.Build.0 = Debug|Any CPU 392 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 393 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|Mixed Platforms.Build.0 = Debug|x86 394 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|x64.ActiveCfg = Debug|x86 395 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|x86.ActiveCfg = Debug|x86 396 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Debug|x86.Build.0 = Debug|x86 397 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|Any CPU.ActiveCfg = Release|x86 398 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|Mixed Platforms.ActiveCfg = Release|x86 399 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|Mixed Platforms.Build.0 = Release|x86 400 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|x64.ActiveCfg = Release|x86 401 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|x86.ActiveCfg = Release|x86 402 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5}.Release|x86.Build.0 = Release|x86 388 403 EndGlobalSection 389 404 GlobalSection(SolutionProperties) = preSolution … … 413 428 {A0EB9657-4D57-4CC1-A309-EC010D7F9EAB} = {9963403B-3CB9-48E0-9FEB-B1CE12C31601} 414 429 {2C036542-5451-4A23-AFF6-87575C7BAFE7} = {4596C5BB-CAB1-4C01-891F-4890F9F16CF8} 430 {87D9FBB9-8E54-4770-9C84-B4B571D9EDD5} = {4596C5BB-CAB1-4C01-891F-4890F9F16CF8} 415 431 EndGlobalSection 416 432 EndGlobal -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4
-
Property
svn:ignore
set to
bin
obj
HeuristicLab.HiveEngine-3.4.csproj.vs10x
-
Property
svn:ignore
set to
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/EngineJob.cs
r5958 r6000 33 33 this.initialOperation = initialOperation; 34 34 this.engine = engine; 35 this.engine.Prepare(initialOperation);36 35 RegisterEngineEvents(); 37 36 } … … 42 41 : base(original, cloner) { 43 42 this.engine = cloner.Clone(original.engine); 43 this.initialOperation = cloner.Clone(original.initialOperation); 44 44 RegisterEngineEvents(); 45 45 } … … 60 60 61 61 public override void Start() { 62 engine.Prepare(initialOperation); 62 63 engine.Start(); 63 64 } 64 65 65 66 public override void Pause() { 66 throw new NotImplementedException();67 engine.Pause(); 67 68 } 68 69 … … 80 81 } 81 82 82 void engine_ExceptionOccurred(object sender, EventArgs<Exception> e) {83 private void engine_ExceptionOccurred(object sender, EventArgs<Exception> e) { 83 84 OnJobFailed(e); 84 85 } 85 86 86 void engine_Stopped(object sender, EventArgs e) {87 private void engine_Stopped(object sender, EventArgs e) { 87 88 OnJobStopped(); 88 89 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r5958 r6000 46 46 } 47 47 48 private IEnumerable<Plugin> onlinePlugins;49 public IEnumerable<Plugin> OnlinePlugins {48 private List<Plugin> onlinePlugins; 49 public List<Plugin> OnlinePlugins { 50 50 get { return onlinePlugins; } 51 51 set { onlinePlugins = value; } 52 52 } 53 53 54 54 private List<Plugin> alreadyUploadedPlugins; 55 55 public List<Plugin> AlreadyUploadedPlugins { … … 102 102 TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException); 103 103 104 this.OnlinePlugins = ServiceLocator.Instance.CallHiveService(s => s.GetPlugins()) ;104 this.OnlinePlugins = ServiceLocator.Instance.CallHiveService(s => s.GetPlugins()).Where(x => x.IsLocal == false).ToList(); 105 105 this.AlreadyUploadedPlugins = new List<Plugin>(); 106 106 … … 123 123 124 124 IScope[] scopes = ExecuteOnHive(jobs, parentScopeClone, cancellationToken); 125 125 //IScope[] scopes = ExecuteLocally(jobs, parentScopeClone, cancellationToken); 126 126 127 for (int i = 0; i < coll.Count; i++) { 127 128 if (coll[i] is IAtomicOperation) { … … 183 184 target.SubScopes.AddRange(source.SubScopes); 184 185 // TODO: validate if parent scopes match - otherwise source is invalid 186 } 187 188 private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) { 189 IScope[] scopes = new Scope[jobs.Length]; 190 191 for (int i = 0; i < jobs.Length; i++) { 192 var job = (EngineJob)jobs[i].Clone(); 193 job.Start(); 194 while (job.ExecutionState != ExecutionState.Stopped) { 195 Thread.Sleep(100); 196 } 197 scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope; 198 } 199 200 return scopes; 185 201 } 186 202 … … 444 460 /// </summary> 445 461 private static void TryAndRepeat(Action action, int repetitions, string errorMessage) { 446 while (repetitions > 0) { 447 try { action(); } 448 catch (Exception e) { 449 repetitions--; 450 if (repetitions == 0) { 451 throw new HiveEngineException(errorMessage, e); 452 } 453 } 454 } 455 } 456 457 private static void TryAndRepeat(Action action) { 458 TryAndRepeat(action, -1, string.Empty); 462 try { action(); } 463 catch (Exception e) { 464 repetitions--; 465 if (repetitions <= 0) 466 throw new HiveEngineException(errorMessage, e); 467 TryAndRepeat(action, repetitions, errorMessage); 468 } 459 469 } 460 470 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLab.Services.Hive.Common-3.4.csproj
r5852 r6000 95 95 <ItemGroup> 96 96 <Compile Include="ApplicationConstants.cs" /> 97 <Compile Include="ServiceFaults\PluginAlreadyExistsFault.cs" /> 97 98 <None Include="HeuristicLabServicesHiveCommonPlugin.cs.frame" /> 98 99 <Compile Include="DataTransfer\Appointment.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r5779 r6000 101 101 #region Plugin Methods 102 102 [OperationContract] 103 Plugin GetPlugin(Guid pluginId); 104 [OperationContract] 105 [FaultContract(typeof(PluginAlreadyExistsFault))] 103 106 Guid AddPlugin(Plugin plugin, List<PluginData> pluginData); 104 107 [OperationContract] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveRoles.cs
r5028 r6000 25 25 public const string Administrator = "Hive Administrator"; 26 26 public const string Slave = "Hive Slave"; 27 public const string Client = "Hive Client";27 public const string Client = "Hive User"; 28 28 } 29 29 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r5793 r6000 250 250 dao.AddSlave(slaveInfo); 251 251 } else { 252 dao.UpdateSlave(slaveInfo); 252 var dbSlave = dao.GetSlave(slaveInfo.Id); 253 254 dbSlave.Name = slaveInfo.Name; 255 dbSlave.Description = slaveInfo.Description; 256 257 dbSlave.Cores = slaveInfo.Cores; 258 dbSlave.CpuArchitecture = slaveInfo.CpuArchitecture; 259 dbSlave.CpuSpeed = slaveInfo.CpuSpeed; 260 dbSlave.FreeCores = slaveInfo.FreeCores; 261 dbSlave.FreeMemory = slaveInfo.FreeMemory; 262 dbSlave.Memory = slaveInfo.Memory; 263 dbSlave.OperatingSystem = slaveInfo.OperatingSystem; 264 265 dbSlave.LastHeartbeat = DateTime.Now; 266 dbSlave.SlaveState = SlaveState.Idle; 267 268 // don't update those properties: 269 // dbSlave.IsAllowedToCalculate = slaveInfo.IsAllowedToCalculate; 270 // dbSlave.ParentResourceId = slaveInfo.ParentResourceId; 271 272 dao.UpdateSlave(dbSlave); 253 273 } 254 274 }); … … 282 302 plugin.UserId = auth.UserId; 283 303 plugin.DateCreated = DateTime.Now; 304 if (!plugin.IsLocal) { 305 var existing = dao.GetPlugins(x => x.Name == plugin.Name && x.Version == plugin.Version.ToString() && !x.IsLocal); 306 if (existing.Count() > 0) { 307 // a plugin with the same name and version already exists. 308 throw new FaultException<PluginAlreadyExistsFault>(new PluginAlreadyExistsFault(existing.Single().Id)); 309 } 310 } 284 311 Guid pluginId = dao.AddPlugin(plugin); 285 312 foreach (PluginData pluginData in pluginDatas) { … … 289 316 return pluginId; 290 317 }); 318 } 319 320 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 321 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 322 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 323 public Plugin GetPlugin(Guid pluginId) { 324 return dao.GetPlugin(pluginId); 291 325 } 292 326
Note: See TracChangeset
for help on using the changeset viewer.