Changeset 4119 for branches/3.3-HiveMigration
- Timestamp:
- 07/28/10 17:48:10 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive
- Files:
-
- 4 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Communication/3.3/WcfService.cs
r4107 r4119 262 262 Logger.Debug("STARTED: Sending back the finished job results"); 263 263 Logger.Debug("Building stream"); 264 Stream stream = 265 GetStreamedJobResult(clientId, jobId, result, percentage, exception); 264 Stream stream = GetStreamedJobResult(clientId, jobId, result, percentage, exception); 266 265 Logger.Debug("Builded stream"); 267 266 Logger.Debug("Making the call"); … … 269 268 } 270 269 } 270 271 271 private void proxy_StoreFinishedJobResultStreamedCompleted(object sender, StoreFinishedJobResultStreamedCompletedEventArgs e) { 272 272 Logger.Debug("Finished storing the job"); 273 Stream stream = 274 (Stream)e.UserState; 273 Stream stream = (Stream)e.UserState; 275 274 if (stream != null) { 276 275 Logger.Debug("Stream not null, disposing it"); … … 278 277 } 279 278 if (e.Error == null) { 280 StoreFinishedJobResultCompletedEventArgs args = 281 new StoreFinishedJobResultCompletedEventArgs( 282 new object[] { e.Result }, e.Error, e.Cancelled, e.UserState); 279 StoreFinishedJobResultCompletedEventArgs args = new StoreFinishedJobResultCompletedEventArgs(new object[] { e.Result }, e.Error, e.Cancelled, e.UserState); 283 280 Logger.Debug("calling the Finished Job Event"); 284 281 StoreFinishedJobResultCompleted(sender, args); 285 282 Logger.Debug("ENDED: Sending back the finished job results"); 286 } else 283 } else { 287 284 HandleNetworkError(e.Error); 285 } 288 286 } 289 287 … … 300 298 } 301 299 } 300 302 301 void proxy_ProcessSnapshotStreamedCompleted(object sender, ProcessSnapshotStreamedCompletedEventArgs e) { 303 302 Stream stream = … … 350 349 /// </summary> 351 350 private Stream GetStreamedJobResult(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception) { 352 JobResult jobResult = 353 new JobResult(); 351 JobResult jobResult = new JobResult(); 354 352 jobResult.ClientId = clientId; 355 353 jobResult.JobId = jobId; … … 357 355 jobResult.Exception = exception; 358 356 359 MultiStream stream = 360 new MultiStream(); 357 MultiStream stream = new MultiStream(); 361 358 362 359 //first send result 363 stream.AddStream( 364 new StreamedObject<JobResult>(jobResult)); 360 stream.AddStream(new StreamedObject<JobResult>(jobResult)); 365 361 366 362 //second stream the job binary data 367 MemoryStream memStream = 368 new MemoryStream(result, false); 363 MemoryStream memStream = new MemoryStream(result, false); 369 364 stream.AddStream(memStream); 370 365 … … 373 368 374 369 public ResponseResultReceived StoreFinishedJobResultsSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) { 375 return proxy.StoreFinishedJobResultStreamed( 376 GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 370 return proxy.StoreFinishedJobResultStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 377 371 } 378 372 … … 387 381 return null; 388 382 } 389 390 383 } 391 384 392 385 public ResponseResultReceived ProcessSnapshotSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception) { 393 386 try { 394 return proxy.ProcessSnapshotStreamed( 395 GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 387 return proxy.ProcessSnapshotStreamed(GetStreamedJobResult(clientId, jobId, result, percentage, exception)); 396 388 } catch (Exception e) { 397 389 HandleNetworkError(e); … … 453 445 } 454 446 } 455 456 447 } 457 448 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Core.cs
r4107 r4119 45 45 using HeuristicLab.Hive.Client.Core.JobStorage; 46 46 using HeuristicLab.Tracing; 47 using HeuristicLab.Core; 47 48 48 49 namespace HeuristicLab.Hive.Client.Core { … … 98 99 if (cc.IPAdress != String.Empty && cc.Port != 0) 99 100 wcfService.SetIPAndPort(cc.IPAdress, cc.Port); 100 101 if (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline())102 wcfService.Connect();103 101 104 102 //Initialize the heartbeat … … 249 247 if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) { 250 248 Logger.Info("Sending the finished job with id: " + jId); 251 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, 252 jId, 253 sJob, 254 1, 255 null, 256 true); 249 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, null, true); 257 250 } else { 258 251 Logger.Info("Storing the finished job with id: " + jId + " to hdd"); … … 465 458 466 459 foreach (KeyValuePair<Guid, Executor> execKVP in engines) { 467 if ( !execKVP.Value.Running&& execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) {460 if (execKVP.Value.ExecutionState != ExecutionState.Started && execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) { 468 461 Logger.Info("Checking for JobId: " + execKVP.Value.JobId); 469 462 Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob)); … … 513 506 } 514 507 515 508 516 509 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Heartbeat.cs
r4060 r4119 43 43 private bool offline; 44 44 45 public double Interval { get; set; } 45 public double Interval { get; set; } 46 46 private Timer heartbeatTimer = null; 47 47 48 private static object locker = new object(); 49 48 50 public Heartbeat() { 49 51 Interval = 100; … … 51 53 52 54 public Heartbeat(double interval) { 53 Interval = interval; 55 Interval = interval; 54 56 } 55 57 … … 74 76 /// <param name="sender"></param> 75 77 /// <param name="e"></param> 76 void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) { 77 ClientDto info = ConfigManager.Instance.GetClientInfo(); 78 void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) { 79 lock (locker) { 80 // check if cwfService is disconnected for any reason (should happen at first heartbeat) 81 // [chn] TODO: Client should always send heartbeats. when calendar disallows he should tell the server he does not want to compute anything 82 if (wcfService.ConnState == NetworkEnum.WcfConnState.Disconnected && 83 (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline())) { 84 wcfService.Connect(); 85 } 78 86 79 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 80 int mb = (int)(counter.NextValue() / 1024 / 1024); 87 ClientDto info = ConfigManager.Instance.GetClientInfo(); 81 88 82 HeartBeatData heartBeatData = new HeartBeatData { 83 ClientId = info.Id, 84 FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(), 85 FreeMemory = mb, 86 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 87 }; 88 89 DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00"); 90 TimeSpan span = DateTime.Now - lastFullHour; 91 if (span.TotalSeconds < (Interval/1000)) { 92 if (UptimeManager.Instance.IsOnline() && UptimeManager.Instance.CalendarAvailable) { 93 //That's quiet simple: Just reconnect and you're good for new jobs 94 if (wcfService.ConnState != NetworkEnum.WcfConnState.Loggedin) { 95 Logger.Info("Client goes online according to timetable"); 96 wcfService.Connect(); 89 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 90 int mb = (int)(counter.NextValue() / 1024 / 1024); 91 92 HeartBeatData heartBeatData = new HeartBeatData { 93 ClientId = info.Id, 94 FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(), 95 FreeMemory = mb, 96 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 97 }; 98 99 DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00"); 100 TimeSpan span = DateTime.Now - lastFullHour; 101 if (span.TotalSeconds < (Interval / 1000)) { 102 if (UptimeManager.Instance.IsOnline() && UptimeManager.Instance.CalendarAvailable) { 103 //That's quiet simple: Just reconnect and you're good for new jobs 104 if (wcfService.ConnState != NetworkEnum.WcfConnState.Loggedin) { 105 Logger.Info("Client goes online according to timetable"); 106 wcfService.Connect(); 107 } 108 } else { 109 //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong 110 MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect); 97 111 } 98 } else { 99 //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong 100 MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect); 101 } 102 } 103 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 104 wcfService.Connect(); 105 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) { 106 Logger.Debug("Sending Heartbeat: " + heartBeatData); 107 wcfService.ProcessHeartBeatAsync(heartBeatData); 112 } 113 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 114 wcfService.Connect(); 115 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) { 116 Logger.Debug("Sending Heartbeat: " + heartBeatData); 117 wcfService.ProcessHeartBeatAsync(heartBeatData); 118 } 108 119 } 109 120 } … … 111 122 void wcfService_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) { 112 123 Logger.Debug("Heartbeat received"); 113 e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 124 e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 114 125 } 115 126 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/HeuristicLab.Hive.Client.Core-3.3.csproj
r4107 r4119 76 76 </PropertyGroup> 77 77 <ItemGroup> 78 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 78 79 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 79 80 <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/PluginCache.cs
r4060 r4119 42 42 //we MAY run in problems here - if there is a plugin twice in requests, there may be added two different versions of the plugin 43 43 foreach (CachedHivePluginInfoDto cache in pluginCache) { 44 if (info.Name.Equals(cache.Name) && info.Version.Equals(cache.Version) && info.BuildDate <= cache.BuildDate) {44 if (info.Name.Equals(cache.Name) && info.Version.Equals(cache.Version)) { 45 45 Logger.Debug("Found plugin " + info.Name + ", " + info.Version); 46 46 neededPlugins.Add(cache); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Properties/AssemblyInfo.cs
r4116 r4119 57 57 // by using the '*' as shown below: 58 58 // [assembly: AssemblyVersion("1.0.*")] 59 [assembly: AssemblyVersion("3.3.0.411 1")]60 [assembly: AssemblyFileVersion("3.3.0.411 1")]61 [assembly: AssemblyBuildDate("2010/07/2 7 18:31:47")]59 [assembly: AssemblyVersion("3.3.0.4116")] 60 [assembly: AssemblyFileVersion("3.3.0.4116")] 61 [assembly: AssemblyBuildDate("2010/07/28 17:42:03")] -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.ExecutionEngine/3.3/Executor.cs
r4111 r4119 29 29 using HeuristicLab.Persistence.Default.Xml; 30 30 using System.IO; 31 using HeuristicLab.Core; 31 32 32 33 namespace HeuristicLab.Hive.Client.ExecutionEngine { … … 39 40 public bool JobIsFinished { get; set; } 40 41 41 public bool Running{42 public ExecutionState ExecutionState { 42 43 get { 43 return Job. Running;44 return Job.ExecutionState; 44 45 } 45 46 } … … 88 89 public byte[] GetSnapshot() { 89 90 //if the job is still running, something went VERY bad. 90 if (Job. Running) {91 if (Job.ExecutionState == Core.ExecutionState.Started) { 91 92 return null; 92 93 } else { … … 103 104 public byte[] GetFinishedJob() { 104 105 //Job isn't finished! 105 if (Job. Running) {106 if (Job.ExecutionState == Core.ExecutionState.Started) { 106 107 throw new InvalidStateException("Job is still running"); 107 108 } else { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.ExecutionEngine/3.3/HeuristicLab.Hive.Client.ExecutionEngine-3.3.csproj
r4107 r4119 79 79 <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath> 80 80 </Reference> 81 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 81 82 <Reference Include="HeuristicLab.Persistence-3.3"> 82 83 <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Contracts/3.3/BusinessObjects/HivePluginInfoDto.cs
r4042 r4119 39 39 public Version Version { get; set; } 40 40 41 [DataMember]42 public DateTime BuildDate { get; set; }43 41 } 44 42 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Engine/3.3/HeuristicLab.Hive.Engine-3.3.csproj
r4111 r4119 128 128 </ItemGroup> 129 129 <ItemGroup> 130 <Compile Include="Job.cs" />131 130 <Compile Include="HeuristicLabHiveEnginePlugin.cs" /> 132 <Compile Include="HiveEngine.cs" />133 131 <Compile Include="Properties\AssemblyInfo.cs" /> 134 132 <Compile Include="ServiceLocator.cs" /> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Engine/3.3/HiveEngine.cs
r4116 r4119 177 177 select new HivePluginInfoDto() { 178 178 Name = p.Name, 179 Version = p.Version, 180 BuildDate = p.BuildDate, 179 Version = p.Version 181 180 }).ToList(); 182 181 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HeuristicLab.Hive.Experiment.Views-3.3.csproj
r4116 r4119 39 39 <PlatformTarget>AnyCPU</PlatformTarget> 40 40 <OutputPath>bin\Debug\</OutputPath> 41 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 41 42 </PropertyGroup> 42 43 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> … … 46 47 <PropertyGroup> 47 48 <StartupObject /> 49 </PropertyGroup> 50 <PropertyGroup> 51 <SignAssembly>true</SignAssembly> 52 </PropertyGroup> 53 <PropertyGroup> 54 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 48 55 </PropertyGroup> 49 56 <ItemGroup> … … 109 116 </ItemGroup> 110 117 <ItemGroup> 118 <None Include="HeuristicLab.snk" /> 111 119 <None Include="Properties\AssemblyInfo.frame" /> 112 120 </ItemGroup> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveExperimentView.cs
r4116 r4119 75 75 base.OnContentChanged(); 76 76 if (Content == null) { 77 executionTimeTextBox.Text = "-";77 executionTimeTextBox.Text = string.Empty; 78 78 } else { 79 79 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 80 resourceIdsTextBox.Text = Content.ResourceIds; 81 serverUrlTextBox.Text = Content.ServerUrl; 82 experimentNamedItemView.Content = Content.Experiment; 80 83 } 81 84 } … … 84 87 base.SetEnabledStateOfControls(); 85 88 executionTimeTextBox.Enabled = Content != null; 89 if (Content != null) { 90 openExperimentButton.Enabled = Content.Experiment != null; 91 experimentNamedItemView.Locked = Content.Experiment == null; 92 } 86 93 SetEnabledStateOfExecutableButtons(); 87 94 } … … 94 101 private void Content_ExperimentChanged(object sender, EventArgs e) { 95 102 experimentNamedItemView.Content = Content.Experiment; 103 if (Content.Experiment != null) { 104 Content.Prepare(); 105 } 96 106 SetEnabledStateOfExecutableButtons(); 97 107 } … … 179 189 stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused); 180 190 resetButton.Enabled = Content.ExecutionState != ExecutionState.Started; 181 openExperimentButton.Enabled = Content.Experiment != null;182 experimentNamedItemView.Locked = Content.Experiment == null;183 191 } 184 192 } … … 200 208 201 209 private void resourceIdsTextBox_Validated(object sender, EventArgs e) { 202 Content.ResourceIds = resourceIds Label.Text;210 Content.ResourceIds = resourceIdsTextBox.Text; 203 211 } 204 212 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/Properties/AssemblyInfo.cs
r4116 r4119 55 55 // You can specify all the values or you can default the Revision and Build Numbers 56 56 // by using the '*' as shown below: 57 [assembly: AssemblyVersion("3.3.0.411 1")]58 [assembly: AssemblyFileVersion("3.3.0.411 1")]59 [assembly: AssemblyBuildDate("2010/07/2 7 18:32:02")]57 [assembly: AssemblyVersion("3.3.0.4116")] 58 [assembly: AssemblyFileVersion("3.3.0.4116")] 59 [assembly: AssemblyBuildDate("2010/07/28 17:42:56")] -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj
r4116 r4119 42 42 <PlatformTarget>AnyCPU</PlatformTarget> 43 43 <OutputPath>bin\Debug\</OutputPath> 44 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 44 45 </PropertyGroup> 45 46 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> 46 47 <PlatformTarget>AnyCPU</PlatformTarget> 47 48 <OutputPath>bin\Release\</OutputPath> 49 </PropertyGroup> 50 <PropertyGroup> 51 <SignAssembly>true</SignAssembly> 52 </PropertyGroup> 53 <PropertyGroup> 54 <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile> 48 55 </PropertyGroup> 49 56 <ItemGroup> … … 89 96 </ItemGroup> 90 97 <ItemGroup> 98 <Compile Include="OptimizerJob.cs" /> 91 99 <Compile Include="HeuristicLabHiveExperimentPlugin.cs" /> 92 100 <Compile Include="HiveExperiment.cs" /> … … 102 110 <ItemGroup> 103 111 <None Include="app.config" /> 112 <None Include="HeuristicLab.snk" /> 104 113 <None Include="Properties\AssemblyInfo.frame" /> 105 114 <None Include="Properties\Settings.settings"> … … 112 121 <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project> 113 122 <Name>HeuristicLab.Hive.Contracts-3.3</Name> 123 </ProjectReference> 124 <ProjectReference Include="..\..\HeuristicLab.Hive.JobBase\3.3\HeuristicLab.Hive.JobBase-3.3.csproj"> 125 <Project>{21187322-52DD-4243-80A4-A85F0263E63B}</Project> 126 <Name>HeuristicLab.Hive.JobBase-3.3</Name> 114 127 </ProjectReference> 115 128 </ItemGroup> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs
r4116 r4119 38 38 using System.Threading; 39 39 using HeuristicLab.Tracing; 40 using HeuristicLab.Hive.JobBase; 41 using System.Diagnostics; 42 using System.Collections; 40 43 41 44 namespace HeuristicLab.Hive.Experiment { … … 50 53 private const string itemDescription = "An experiment which contains multiple batch runs of algorithms which are executed in the Hive."; 51 54 private const int resultPollingIntervalMs = 10000; 55 52 56 private const int maxSnapshotRetries = 20; 53 57 54 private IDictionary<Guid, SerializedJob> jobs = null; 58 [Storable] 59 private IDictionary<Guid, IOptimizer> sentOptimizers = null; 60 55 61 private object locker = new object(); 56 62 private DateTime startTime; 63 64 [Storable] 57 65 private string serverUrl; 58 66 public string ServerUrl { … … 60 68 set { serverUrl = value; OnServerUrlChanged(); } 61 69 } 62 public event EventHandler ServerUrlChanged; 63 protected virtual void OnServerUrlChanged() { 64 EventHandler handler = ServerUrlChanged; 65 if (handler != null) handler(this, EventArgs.Empty); 66 } 67 70 71 [Storable] 68 72 private string resourceIds; 69 73 public string ResourceIds { … … 71 75 set { resourceIds = value; OnResourceIdsChanged(); } 72 76 } 73 public event EventHandler ResourceIdsChanged; 74 protected virtual void OnResourceIdsChanged() { 75 EventHandler handler = ResourceIdsChanged; 76 if (handler != null) handler(this, EventArgs.Empty); 77 78 [Storable] 79 private HeuristicLab.Optimization.Experiment experiment; 80 public HeuristicLab.Optimization.Experiment Experiment { 81 get { return experiment; } 82 set { experiment = value; OnExperimentChanged(); } 83 } 84 85 [StorableConstructor] 86 public HiveExperiment(bool deserializing) 87 : base(deserializing) { 88 } 89 90 public HiveExperiment() 91 : base(itemName, itemDescription) { 92 this.ServerUrl = HeuristicLab.Hive.Experiment.Properties.Settings.Default.HiveServerUrl; 93 this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds; 94 } 95 96 public override IDeepCloneable Clone(Cloner cloner) { 97 HiveExperiment clone = (HiveExperiment)base.Clone(cloner); 98 clone.resourceIds = this.resourceIds; 99 clone.serverUrl = this.serverUrl; 100 clone.experiment = (HeuristicLab.Optimization.Experiment)cloner.Clone(experiment); 101 clone.executionState = this.executionState; 102 clone.executionTime = this.executionTime; 103 clone.sentOptimizers = new Dictionary<Guid, IOptimizer>(); 104 foreach (var pair in this.sentOptimizers) 105 clone.sentOptimizers[pair.Key] = (IOptimizer)cloner.Clone(pair.Value); 106 return clone; 77 107 } 78 108 … … 86 116 } 87 117 } 88 89 private HeuristicLab.Optimization.Experiment experiment;90 public HeuristicLab.Optimization.Experiment Experiment {91 get { return experiment; }92 set { experiment = value; OnExperimentChanged(); }93 }94 public event EventHandler ExperimentChanged;95 protected virtual void OnExperimentChanged() {96 EventHandler handler = ExperimentChanged;97 if (handler != null) handler(this, EventArgs.Empty);98 }99 100 public HiveExperiment()101 : base(itemName, itemDescription) {102 this.ServerUrl = HeuristicLab.Hive.Experiment.Properties.Settings.Default.HiveServerUrl;103 this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds;104 }105 106 118 #region IExecutable Members 107 119 108 public event EventHandler<EventArgs<Exception>> ExceptionOccurred;109 120 [Storable] 121 private Core.ExecutionState executionState; 110 122 public ExecutionState ExecutionState { 111 get { return Core.ExecutionState.Stopped; } // [chn] todo 112 } 113 114 public event EventHandler ExecutionStateChanged; 115 123 get { return executionState; } 124 private set { 125 if (executionState != value) { 126 executionState = value; 127 OnExecutionStateChanged(); 128 } 129 } 130 } 131 132 [Storable] 133 private TimeSpan executionTime; 116 134 public TimeSpan ExecutionTime { 117 get { return new TimeSpan(); } // [chn] todo 118 } 119 120 public event EventHandler ExecutionTimeChanged; 135 get { return executionTime; } 136 private set { 137 executionTime = value; 138 OnExecutionTimeChanged(); 139 } 140 } 121 141 122 142 public void Pause() { … … 124 144 } 125 145 126 public event EventHandler Paused;127 128 146 public void Prepare() { 129 130 } 131 132 public event EventHandler Prepared; 147 // [chn] needed? 148 if (experiment != null) { 149 experiment.Prepare(); 150 OnPrepared(); 151 } 152 } 133 153 134 154 public void Start() { 155 this.startTime = DateTime.Now; 156 this.ExecutionState = Core.ExecutionState.Started; 135 157 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(ServerUrl); 136 158 137 IList<SerializedJob> serializedJobs = new List<SerializedJob>(); 159 sentOptimizers = new Dictionary<Guid, IOptimizer>(); 160 IEnumerable<string> groups = ResourceGroups; 161 138 162 foreach (IOptimizer optimizer in Experiment.Optimizers) { 139 serializedJobs.Add(CreateJob(optimizer)); 140 } 141 142 jobs = new Dictionary<Guid, SerializedJob>(); 143 144 IEnumerable<string> groups = ResourceGroups; 145 foreach (SerializedJob job in serializedJobs) { 146 ResponseObject<JobDto> response = executionEngineFacade.AddJobWithGroupStrings(job, groups); 147 148 jobs.Add(response.Obj.Id, job); 163 SerializedJob serializedJob = CreateSerializedJob(optimizer); 164 ResponseObject<JobDto> response = executionEngineFacade.AddJobWithGroupStrings(serializedJob, groups); 165 sentOptimizers.Add(response.Obj.Id, optimizer); 149 166 StartResultPollingThread(response.Obj); 150 167 } 151 168 } 152 153 public event EventHandler Started;154 169 155 170 public void Stop() { … … 157 172 } 158 173 159 public event EventHandler Stopped;160 174 private bool abortRequested; 161 175 162 176 #endregion 163 177 164 private SerializedJob CreateJob(IOptimizer optimizer) { 165 // serialize optimizer 178 private SerializedJob CreateSerializedJob(IOptimizer optimizer) { 179 IJob job = new OptimizerJob() { 180 Optimizer = optimizer 181 }; 182 183 // serialize job 166 184 MemoryStream memStream = new MemoryStream(); 167 XmlGenerator.Serialize(optimizer, memStream); 185 XmlGenerator.Serialize(job, memStream); 186 byte[] jobByteArray = memStream.ToArray(); 187 memStream.Dispose(); 168 188 169 189 // find out which which plugins are needed for the given object … … 172 192 select new HivePluginInfoDto() { 173 193 Name = p.Name, 174 Version = p.Version, 175 BuildDate = p.BuildDate, 194 Version = p.Version 176 195 }).ToList(); 177 196 … … 186 205 SerializedJob serializedJob = new SerializedJob() { 187 206 JobInfo = jobDto, 188 SerializedJobData = memStream.ToArray()207 SerializedJobData = jobByteArray 189 208 }; 190 memStream.Dispose();191 209 192 210 return serializedJob; … … 196 214 Thread t = new Thread(() => { 197 215 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(ServerUrl); 198 I OptimizerrestoredObject = null;216 IJob restoredObject = null; 199 217 200 218 do { … … 211 229 // 4. the result that we get from the server is a snapshot and not the final result 212 230 if (response.Success && response.Obj != null && response.StatusMessage != ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE) { 213 231 214 232 // [chn] todo: deserialization into interface is not possible! how to find out correct static type? 215 restoredObject = XmlParser.Deserialize<I Optimizer>(new MemoryStream(response.Obj.SerializedJobData));233 restoredObject = XmlParser.Deserialize<IJob>(new MemoryStream(response.Obj.SerializedJobData)); 216 234 } 217 235 } 218 } while (restoredObject == null || restoredObject.ExecutionState == Core.ExecutionState.Stopped);236 } while (restoredObject == null || restoredObject.ExecutionState != Core.ExecutionState.Stopped); 219 237 220 238 // job retrieved... replace the existing optimizers with the finished one 221 // todo 239 IOptimizer originalOptimizer = sentOptimizers[job.Id]; 240 IOptimizer restoredOptimizer = ((OptimizerJob)restoredObject).Optimizer; 241 242 int originalOptimizerIndex = experiment.Optimizers.IndexOf(originalOptimizer); 243 experiment.Optimizers[originalOptimizerIndex] = restoredOptimizer; 244 sentOptimizers.Remove(job.Id); 245 246 if (sentOptimizers.Count == 0) { 247 // finished 248 this.ExecutionState = Core.ExecutionState.Stopped; 249 OnStopped(); 250 } 222 251 }); 223 252 224 253 Logger.Debug("HiveEngine: Starting results-polling thread"); 225 254 t.Start(); 226 255 } 256 227 257 228 258 #region Required Plugin Search … … 310 340 } 311 341 #endregion 342 343 #region Eventhandler 344 345 public event EventHandler ExecutionTimeChanged; 346 private void OnExecutionTimeChanged() { 347 EventHandler handler = ExecutionTimeChanged; 348 if (handler != null) handler(this, EventArgs.Empty); 349 } 350 351 public event EventHandler ExecutionStateChanged; 352 private void OnExecutionStateChanged() { 353 EventHandler handler = ExecutionStateChanged; 354 if (handler != null) handler(this, EventArgs.Empty); 355 } 356 357 public event EventHandler<EventArgs<Exception>> ExceptionOccurred; 358 359 public event EventHandler Started; 360 private void OnStarted() { 361 EventHandler handler = Started; 362 if (handler != null) handler(this, EventArgs.Empty); 363 } 364 365 public event EventHandler Stopped; 366 private void OnStopped() { 367 EventHandler handler = Stopped; 368 if (handler != null) handler(this, EventArgs.Empty); 369 } 370 371 public event EventHandler Paused; 372 private void OnPaused() { 373 EventHandler handler = Paused; 374 if (handler != null) handler(this, EventArgs.Empty); 375 } 376 377 public event EventHandler Prepared; 378 protected virtual void OnPrepared() { 379 EventHandler handler = Prepared; 380 if (handler != null) handler(this, EventArgs.Empty); 381 } 382 383 public event EventHandler ResourceIdsChanged; 384 protected virtual void OnResourceIdsChanged() { 385 EventHandler handler = ResourceIdsChanged; 386 if (handler != null) handler(this, EventArgs.Empty); 387 } 388 389 public event EventHandler ExperimentChanged; 390 protected virtual void OnExperimentChanged() { 391 EventHandler handler = ExperimentChanged; 392 if (handler != null) handler(this, EventArgs.Empty); 393 } 394 395 public event EventHandler ServerUrlChanged; 396 protected virtual void OnServerUrlChanged() { 397 EventHandler handler = ServerUrlChanged; 398 if (handler != null) handler(this, EventArgs.Empty); 399 } 400 401 402 #endregion 312 403 } 313 404 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/AssemblyInfo.cs
r4116 r4119 55 55 // You can specify all the values or you can default the Revision and Build Numbers 56 56 // by using the '*' as shown below: 57 [assembly: AssemblyVersion("3.3.0.411 1")]58 [assembly: AssemblyFileVersion("3.3.0.411 1")]59 [assembly: AssemblyBuildDate("2010/07/2 7 18:31:34")]57 [assembly: AssemblyVersion("3.3.0.4116")] 58 [assembly: AssemblyFileVersion("3.3.0.4116")] 59 [assembly: AssemblyBuildDate("2010/07/28 17:42:02")] -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.JobBase/3.3/Interfaces/IJob.cs
r4111 r4119 6 6 public interface IJob { 7 7 long JobId { get; set; } 8 bool Running { get; set; }8 ExecutionState ExecutionState { get; } 9 9 double Progress { get; } 10 10 11 void Run(); 11 12 void Prepare(IOperation initialOperation); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/ClientCommunicator.cs
r4116 r4119 691 691 ResponsePlugin response = new ResponsePlugin(); 692 692 foreach (HivePluginInfoDto pluginInfo in pluginList) { 693 // TODO: BuildDate deleted, not needed???694 693 // TODO: Split version to major, minor and revision number 695 694 foreach (IPluginDescription currPlugin in ApplicationManager.Manager.Plugins) { … … 698 697 CachedHivePluginInfoDto currCachedPlugin = new CachedHivePluginInfoDto { 699 698 Name = currPlugin.Name, 700 Version = currPlugin.Version, 701 BuildDate = currPlugin.BuildDate 699 Version = currPlugin.Version 702 700 }; 703 701 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs
r4116 r4119 223 223 224 224 public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 225 ResponseObject<JobDto> result = 226 new ResponseObject<JobDto>(); 227 228 result.Obj = 229 GetLastJobResult(jobId); 230 result.Success = 231 result.Obj != null; 225 ResponseObject<JobDto> result = new ResponseObject<JobDto>(); 226 227 result.Obj = GetLastJobResult(jobId); 228 result.Success = result.Obj != null; 232 229 233 230 return result; … … 263 260 response.Obj.JobInfo = job; 264 261 265 response.Obj.SerializedJobData = 266 DaoLocator.JobDao.GetBinaryJobFile(jobId); 262 response.Obj.SerializedJobData = DaoLocator.JobDao.GetBinaryJobFile(jobId); 267 263 268 264 return response; -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Properties/AssemblyInfo.cs
r4116 r4119 55 55 // by using the '*' as shown below: 56 56 // [assembly: AssemblyVersion("1.0.*")] 57 [assembly: AssemblyVersion("3.3.0.411 1")]58 [assembly: AssemblyFileVersion("3.3.0.411 1")]59 [assembly: AssemblyBuildDate("2010/07/2 7 18:31:46")]57 [assembly: AssemblyVersion("3.3.0.4116")] 58 [assembly: AssemblyFileVersion("3.3.0.4116")] 59 [assembly: AssemblyBuildDate("2010/07/28 17:42:06")] -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/JobDao.cs
r4116 r4119 26 26 27 27 public IEnumerable<JobDto> FindWithLimitations(State jobState, int offset, int count) { 28 29 28 IQueryable<JobDto> query = null; 30 29 if (jobState == State.Finished) { … … 80 79 job.JobInfo.Id = j.JobId; 81 80 return job; 82 83 81 } 84 82 … … 104 102 select EntityToDto(j, null)).ToList(); 105 103 } 104 106 105 public IEnumerable<JobDto> FindFittingJobsForClient(State state, int freeCores, int freeMemory, Guid clientId) { 107 106 ClientGroupDao cgd = new ClientGroupDao(); … … 119 118 select EntityToDto(ar.Job, null)); 120 119 return q.ToList(); 121 122 120 } 123 121 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/PluginInfoDao.cs
r4042 r4119 48 48 if (dbpi == null) { 49 49 dbpi = new PluginInfo { 50 BuildDate = info.BuildDate.ToString(),51 50 Name = info.Name, 52 51 Version = info.Version.ToString() -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/Files.txt
r4111 r4119 6 6 HeuristicLab.DataAccess\3.3:HeuristicLab.DataAccess-3.3.dll 7 7 HeuristicLab.DataAccess.ADOHelper\3.3:HeuristicLab.DataAccess.ADOHelper-3.3.dll 8 9 HeuristicLab.Hive\3.3:HeuristicLab.Hive.log4net.xml 8 10 9 11 HeuristicLab.Hive.Client.Common\3.3:HeuristicLab.Hive.Client.Common-3.3.dll -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/HeuristicLab 3.3.exe.config
r4071 r4119 111 111 <HeuristicLab.Tracing.Properties.Settings> 112 112 <setting name="TracingLog4netConfigFile" serializeAs="String"> 113 <value />113 <value>HeuristicLab.Hive.log4net.xml</value> 114 114 </setting> 115 115 </HeuristicLab.Tracing.Properties.Settings> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/HeuristicLab.Hive-3.3.csproj
r4091 r4119 74 74 <Content Include="Files.x64.txt" /> 75 75 <Content Include="Files.x86.txt" /> 76 <Content Include="HeuristicLab.Hive.log4net.xml"> 77 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 78 </Content> 76 79 <Content Include="HeuristicLab.ico" /> 77 80 </ItemGroup> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/Properties/AssemblyInfo.cs
r4116 r4119 51 51 // Revision 52 52 // 53 [assembly: AssemblyVersion("3.3.0.411 1")]54 [assembly: AssemblyFileVersion("3.3.0.411 1")]53 [assembly: AssemblyVersion("3.3.0.4116")] 54 [assembly: AssemblyFileVersion("3.3.0.4116")]
Note: See TracChangeset
for help on using the changeset viewer.