Changeset 6198
- Timestamp:
- 05/15/11 12:02:12 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/RefreshableHiveExperimentView.cs
r6178 r6198 107 107 calculatingTextBox.Text = "0"; 108 108 finishedTextBox.Text = "0"; 109 logView.Content = null; 109 110 } else { 110 111 nameTextBox.Text = Content.HiveExperiment.Name; … … 117 118 calculatingTextBox.Text = Content.HiveExperiment.CalculatingCount.ToString(); 118 119 finishedTextBox.Text = Content.HiveExperiment.FinishedCount.ToString(); 120 logView.Content = Content.Log; 119 121 } 120 122 Content_HiveExperimentChanged(this, EventArgs.Empty); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/ConcurrentJobDownloader.cs
r6178 r6198 20 20 } 21 21 22 public void DownloadJob( Guid jobId, Action<Guid, T, Exception> onFinishedAction) {23 Task<JobData>.Factory.StartNew((x) => DownloadJob(x), job Id)22 public void DownloadJob(Job job, Action<Job, T, Exception> onFinishedAction) { 23 Task<JobData>.Factory.StartNew((x) => DownloadJob(x), job.Id) 24 24 .ContinueWith((x) => DeserializeJob(x.Result)) 25 .ContinueWith((x) => OnJobFinished(job Id, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously);25 .ContinueWith((x) => OnJobFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously); 26 26 } 27 27 28 private void OnJobFinished( Guid jobId, Task<T> task, Action<Guid, T, Exception> onFinishedAction) {29 onFinishedAction(job Id, task.Result, task.Exception);28 private void OnJobFinished(Job job, Task<T> task, Action<Job, T, Exception> onFinishedAction) { 29 onFinishedAction(job, task.Result, task.Exception); 30 30 } 31 31 … … 46 46 protected T DeserializeJob(JobData jobData) { 47 47 try { 48 if (abort || jobData == null) return null; 48 49 Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.JobId)); 49 if ( abort || job == null || jobData== null) return null;50 if (job == null) return null; 50 51 var deserializedJob = PersistenceUtil.Deserialize<T>(jobData.Data); 51 52 jobData.Data = null; // reduce memory consumption. -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/EngineHiveJob.cs
r6178 r6198 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 62 63 } 63 64 65 // add type objects from object graph to work around ticket #1527 66 var typeObjects = ItemJob.GetObjectGraphObjects().OfType<Type>(); 67 usedTypes = new List<Type>(usedTypes).Union(typeObjects); 68 64 69 PluginUtil.CollectDeclaringPlugins(plugins, usedTypes); 65 70 66 71 return jobData; 67 72 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJob.cs
r6178 r6198 65 65 job = value; 66 66 RegisterJobEvents(); 67 itemJobDownloaded = false;67 IsFinishedJobDownloaded = false; 68 68 OnJobChanged(); 69 69 OnToStringChanged(); … … 87 87 RegisterItemJobEvents(); 88 88 OnJobItemChanged(); 89 itemJobDownloaded = true;89 IsFinishedJobDownloaded = true; 90 90 } 91 91 } … … 94 94 // job downloaded since last status change 95 95 [Storable] 96 private bool itemJobDownloaded = false; 97 public bool ItemJobDownloaded { 98 get { return itemJobDownloaded; } 99 } 96 private bool isFinishedJobDownloaded = false; 97 public bool IsFinishedJobDownloaded { 98 get { return isFinishedJobDownloaded; } 99 set { 100 if (value != isFinishedJobDownloaded) { 101 this.isFinishedJobDownloaded = value; 102 OnIsFinishedJobDownloadedChanged(); 103 } 104 } 105 } 106 107 public bool IsDownloading { get; set; } 100 108 101 109 [Storable] … … 147 155 this.childHiveJobs = cloner.Clone(original.childHiveJobs); 148 156 this.syncJobsWithOptimizers = original.syncJobsWithOptimizers; 149 this.i temJobDownloaded = original.itemJobDownloaded;157 this.isFinishedJobDownloaded = original.isFinishedJobDownloaded; 150 158 } 151 159 public override IDeepCloneable Clone(Cloner cloner) { … … 210 218 job.StateLog = new List<StateLog>(lightweightJob.StateLog); 211 219 job.Command = lightweightJob.Command; 212 job.LastJobDataUpdate = lightweightJob.LastJobDataUpdate;213 220 214 221 OnJobStateChanged(); … … 262 269 } 263 270 264 public event EventHandler IsFinished OptimizerDownloadedChanged;265 private void OnIsFinished OptimizerDownloadedChanged() {266 var handler = IsFinished OptimizerDownloadedChanged;271 public event EventHandler IsFinishedJobDownloadedChanged; 272 private void OnIsFinishedJobDownloadedChanged() { 273 var handler = IsFinishedJobDownloadedChanged; 267 274 if (handler != null) handler(this, EventArgs.Empty); 268 275 } … … 280 287 private void job_PropertyChanged(object sender, PropertyChangedEventArgs e) { 281 288 if (e.PropertyName == "State") { 282 itemJobDownloaded = false;289 IsFinishedJobDownloaded = false; 283 290 } 284 291 } … … 402 409 403 410 public virtual void IntegrateChild(ItemJob job, Guid childJobId) { } 411 404 412 } 405 413 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs
r6178 r6198 59 59 public void StartAsync() { 60 60 foreach (Guid jobId in jobIds) { 61 jobDownloader.DownloadJob(jobId, 62 (id, itemJob, exception) => { 61 Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobId)); 62 63 jobDownloader.DownloadJob(job, 64 (localJob, itemJob, exception) => { 63 65 if (exception != null) { 64 66 throw new ConcurrentJobDownloaderException("Downloading job failed", exception); 65 67 } 66 Job job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(id)); 67 if (job != null && itemJob != null) { 68 if (localJob != null && itemJob != null) { 68 69 HiveJob hiveJob; 69 70 if (itemJob is OptimizerJob) { … … 72 73 hiveJob = new HiveJob(itemJob, true); 73 74 } 74 hiveJob.Job = job;75 this.results.Add( id, hiveJob);75 hiveJob.Job = localJob; 76 this.results.Add(localJob.Id, hiveJob); 76 77 } 77 78 }); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs
r6178 r6198 95 95 } 96 96 97 [Storable] 98 private ILog log; 99 public ILog Log { 100 get { return log; } 101 set { log = value; } 102 } 103 104 97 105 #region Constructors and Cloning 98 106 public RefreshableHiveExperiment() { … … 100 108 this.refreshAutomatically = true; 101 109 this.HiveExperiment = new HiveExperiment(); 110 this.log = new Log(); 102 111 } 103 112 public RefreshableHiveExperiment(HiveExperiment hiveExperiment) { … … 105 114 this.refreshAutomatically = true; 106 115 this.HiveExperiment = hiveExperiment; 116 this.log = new Log(); 107 117 } 108 118 protected RefreshableHiveExperiment(RefreshableHiveExperiment original, Cloner cloner) { … … 112 122 this.IncludeJobs = original.IncludeJobs; 113 123 this.IsControllable = original.IsControllable; 124 this.Log = cloner.Clone(original.Log); 114 125 } 115 126 public IDeepCloneable Clone(Cloner cloner) { … … 167 178 private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) { 168 179 foreach (LightweightJob lightweightJob in e.Value) { 169 HiveJob hj = GetHiveJobById(lightweightJob.Id); 170 if (hj != null) { 171 DateTime lastJobDataUpdate = hj.Job.LastJobDataUpdate; 172 hj.UpdateFromLightweightJob(lightweightJob); 173 180 HiveJob hiveJob = GetHiveJobById(lightweightJob.Id); 181 if (hiveJob != null) { 174 182 // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated 175 if (lastJobDataUpdate != DateTime.MinValue && lastJobDataUpdate < hj.Job.LastJobDataUpdate) { 176 jobDownloader.DownloadJob(hj.Job.Id, (id, itemJob, exception) => { 183 if (hiveJob.Job.State == JobState.Offline && lightweightJob.State != JobState.Finished && lightweightJob.State != JobState.Failed && lightweightJob.State != JobState.Aborted) { 184 hiveJob.Job.LastJobDataUpdate = lightweightJob.LastJobDataUpdate; 185 } 186 187 hiveJob.UpdateFromLightweightJob(lightweightJob); 188 189 if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) { 190 log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id)); 191 hiveJob.IsDownloading = true; 192 jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob, exception) => { 193 log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id)); 194 HiveJob localHiveJob = GetHiveJobById(localJob.Id); 195 177 196 if (exception != null) { 197 log.LogException(exception); 198 localHiveJob.IsDownloading = false; 178 199 throw new ConcurrentJobDownloaderException("Downloading job failed.", exception); 179 200 } … … 183 204 } else { 184 205 // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare) 185 if (hj.Job.State == JobState.Paused) { 186 hj.ItemJob = itemJob; 206 207 208 if (localJob.State == JobState.Paused) { 209 localHiveJob.ItemJob = itemJob; 187 210 } else { 188 if (l ightweightJob.ParentJobId.HasValue) {189 HiveJob parentHiveJob = GetHiveJobById(l ightweightJob.ParentJobId.Value);190 parentHiveJob.IntegrateChild(itemJob, hj.Job.Id);211 if (localJob.ParentJobId.HasValue) { 212 HiveJob parentHiveJob = GetHiveJobById(localJob.ParentJobId.Value); 213 parentHiveJob.IntegrateChild(itemJob, localJob.Id); 191 214 } else { 192 hj.ItemJob = itemJob;215 localHiveJob.ItemJob = itemJob; 193 216 } 194 217 } 218 localHiveJob.IsDownloading = false; 219 localHiveJob.Job.LastJobDataUpdate = localJob.LastJobDataUpdate; 195 220 } 196 221 }); … … 227 252 || j.Job.State == JobState.Aborted 228 253 || j.Job.State == JobState.Failed) 229 && j.I temJobDownloaded);254 && j.IsFinishedJobDownloaded); 230 255 } 231 256 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Test/app_services.config
r6167 r6198 36 36 <bindings> 37 37 <wsHttpBinding> 38 <binding name="WSHttpBinding_IUpdate" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00: 10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">38 <binding name="WSHttpBinding_IUpdate" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 39 39 <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 40 40 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> … … 44 44 </security> 45 45 </binding> 46 <binding name="WSHttpBinding_IAdmin" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00: 10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">46 <binding name="WSHttpBinding_IAdmin" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="200000000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 47 47 <readerQuotas maxDepth="32" maxStringContentLength="32000" maxArrayLength="200000000" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 48 48 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> … … 52 52 </security> 53 53 </binding> 54 <binding name="wsHttpBinding_ Hive" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">55 <readerQuotas maxDepth=" 32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />54 <binding name="wsHttpBinding_IHiveService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 55 <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 56 56 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> 57 57 <security mode="Message"> … … 73 73 </identity> 74 74 </endpoint> 75 <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_ Hive" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService">75 <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IHiveService" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService"> 76 76 <identity> 77 77 <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgNVHQEETjBMgBCjbgdYd4j5JgUuJ1Wo/GxroSYwJDEiMCAGA1UEAxMZc2VydmljZXMuaGV1cmlzdGljbGFiLmNvbYIQCJLHkNhBIYFO9tKiQOtYKjANBgkqhkiG9w0BAQQFAAOBgQAb/2xk2uQad68shSPl/uixWgvFI8WkxOTBopOLaLtDxwCeZ3mWVHdV9VnixHtThubnEBXAhYOCQSIXWtQuXFWO+gH3YyjTRJY5kTmXyuvBRTn3/so5SrQ7Rdlm9hf6E5YVX3tCjAy7ybUyaDUkQfmH5vmvgvpMzRfsJ1qhnUpJiQ==" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs
r6178 r6198 261 261 Thread.Sleep(500); 262 262 this.ExecutionTimeOnHive = TimeSpan.FromMilliseconds(hiveExperiments.Sum(x => x.HiveExperiment.ExecutionTime.TotalMilliseconds)); 263 cancellationToken.ThrowIfCancellationRequested(); 263 264 } 264 265 LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableHiveExperiment.ToString(), refreshableHiveExperiment.HiveExperiment.ExecutionTime));
Note: See TracChangeset
for help on using the changeset viewer.