Changeset 2073
- Timestamp:
- 06/19/09 15:21:33 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs
r2064 r2073 74 74 procEngine.OperatorGraph.AddOperator(algorithm.Engine.OperatorGraph.InitialOperator); 75 75 procEngine.OperatorGraph.InitialOperator = algorithm.Engine.OperatorGraph.InitialOperator; 76 procEngine.Reset(); 76 77 AsyncGridResult asyncResult = jobManager.BeginExecuteEngine(procEngine); 77 78 asyncResults.Add(asyncResult.WaitHandle, asyncResult); … … 100 101 } 101 102 catch (Exception badEx) { 102 Trace.WriteLine("CEDMA Executer: Exception in job execution thread. " + badEx.Message);103 HeuristicLab.Tracing.Logger.Error("CEDMA Executer: Exception in job execution thread. " + badEx.Message); 103 104 } 104 105 } 105 106 } 106 107 catch (Exception ex) { 107 Trace.WriteLine("CEDMA Executer: Exception in job-management thread. " + ex.Message);108 HeuristicLab.Tracing.Logger.Warn("CEDMA Executer: Exception in job-management thread. " + ex.Message); 108 109 } 109 110 } -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HeuristicLab.Grid.HiveBridge-3.2.csproj
r2064 r2073 101 101 <Name>HeuristicLab.PluginInfrastructure</Name> 102 102 </ProjectReference> 103 <ProjectReference Include="..\..\HeuristicLab.Tracing\3.2\HeuristicLab.Tracing-3.2.csproj"> 104 <Project>{EE2034D9-6E27-48A1-B855-42D45F69A4FC}</Project> 105 <Name>HeuristicLab.Tracing-3.2</Name> 106 </ProjectReference> 103 107 </ItemGroup> 104 108 <ItemGroup> -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HeuristicLabGridHiveBridgePlugin.cs
r2064 r2073 33 33 [Dependency(Dependency = "HeuristicLab.Hive.JobBase-3.2")] 34 34 [Dependency(Dependency = "HeuristicLab.Hive.Engine-3.2")] 35 [Dependency(Dependency = "HeuristicLab.Tracing-3.2")] 35 36 public class HeuristicLabGridPlugin : PluginBase { 36 37 } -
trunk/sources/HeuristicLab.Grid.HiveBridge/3.2/HiveGridServerWrapper.cs
r2064 r2073 32 32 using HeuristicLab.PluginInfrastructure; 33 33 using HeuristicLab.Hive.Contracts.BusinessObjects; 34 using System.ServiceModel; 35 using HeuristicLab.Tracing; 34 36 35 37 namespace HeuristicLab.Grid.HiveBridge { 36 38 public class HiveGridServerWrapper : IGridServer { 39 private const int MAX_CONNECTION_RETRIES = 10; 40 private const int RETRY_TIMEOUT_SEC = 60; 37 41 private string address; 42 private IExecutionEngineFacade executionEngine; 43 private object connectionLock = new object(); 38 44 39 45 public HiveGridServerWrapper(string address) { … … 42 48 43 49 public JobState JobState(Guid guid) { 44 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(address); 45 ResponseObject<JobResult> response = executionEngineFacade.GetLastResult(guid, false); 46 if (response.Success == true && 50 ResponseObject<JobResult> response = SavelyExecute(() => executionEngine.GetLastResult(guid, false)); 51 if (response != null && response.Success == true && 47 52 (response.StatusMessage == ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE || 48 53 response.StatusMessage == ApplicationConstants.RESPONSE_JOB_REQUEST_SET || 49 54 response.StatusMessage == ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET || 50 55 response.StatusMessage == ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT)) { 51 56 return HeuristicLab.Grid.JobState.Busy; 52 57 } else return HeuristicLab.Grid.JobState.Unknown; 53 58 } … … 56 61 var jobObj = CreateJobObj(engine); 57 62 58 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(address); 59 ResponseObject<HeuristicLab.Hive.Contracts.BusinessObjects.Job> res = executionEngineFacade.AddJob(jobObj); 60 return res.Obj.Id; 63 ResponseObject<HeuristicLab.Hive.Contracts.BusinessObjects.Job> res = SavelyExecute(() => executionEngine.AddJob(jobObj)); 64 return res == null ? Guid.Empty : res.Obj.Id; 61 65 } 62 66 63 67 public byte[] TryEndExecuteEngine(Guid guid) { 64 IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(address);65 ResponseObject<JobResult> response = executionEngineFacade.GetLastResult(guid, false);66 if (response.Success && response.Obj != null) {68 ResponseObject<JobResult> response = SavelyExecute(() => executionEngine.GetLastResult(guid, false)); 69 if (response != null && 70 response.Success && response.Obj != null) { 67 71 HeuristicLab.Hive.Engine.Job restoredJob = (HeuristicLab.Hive.Engine.Job)PersistenceManager.RestoreFromGZip(response.Obj.Result); 68 72 // Serialize the engine … … 89 93 job.Engine.OperatorGraph.AddOperator(engine.OperatorGraph.InitialOperator); 90 94 job.Engine.OperatorGraph.InitialOperator = engine.OperatorGraph.InitialOperator; 95 job.Engine.Reset(); 91 96 92 97 // Serialize the job … … 143 148 return engine; 144 149 } 150 151 private TResult SavelyExecute<TResult>(Func<TResult> a) where TResult : Response { 152 int retries = 0; 153 if (executionEngine == null) 154 executionEngine = ServiceLocator.CreateExecutionEngineFacade(address); 155 156 do { 157 try { 158 lock (connectionLock) { 159 return a(); 160 } 161 } 162 catch (TimeoutException) { 163 retries++; 164 Thread.Sleep(TimeSpan.FromSeconds(RETRY_TIMEOUT_SEC)); 165 } 166 catch (CommunicationException) { 167 executionEngine = ServiceLocator.CreateExecutionEngineFacade(address); 168 retries++; 169 Thread.Sleep(TimeSpan.FromSeconds(RETRY_TIMEOUT_SEC)); 170 } 171 } while (retries < MAX_CONNECTION_RETRIES); 172 Logger.Warn("Reached max connection retries"); 173 return null; 174 } 145 175 } 146 176 } -
trunk/sources/HeuristicLab.Grid/3.2/JobManager.cs
r2058 r2073 42 42 43 43 private IGridServer server; 44 private string address;45 44 private object waitingQueueLock = new object(); 46 45 private Queue<AsyncGridResult> waitingJobs = new Queue<AsyncGridResult>(); … … 108 107 } 109 108 catch (Exception e) { 110 Trace.TraceError("Exception " + e + " in JobManager.StartEngines() killed the start-engine thread\n" + e.StackTrace);109 HeuristicLab.Tracing.Logger.Error("Exception " + e + " in JobManager.StartEngines() killed the start-engine thread\n" + e.StackTrace); 111 110 } 112 111 } … … 150 149 } 151 150 catch (Exception e) { 152 Trace.TraceError("Exception " + e + " in JobManager.GetResults() killed the results-gathering thread\n" + e.StackTrace);151 HeuristicLab.Tracing.Logger.Error("Exception " + e + " in JobManager.GetResults() killed the results-gathering thread\n" + e.StackTrace); 153 152 } 154 153 } -
trunk/sources/HeuristicLab.Grid/3.2/ProcessingEngine.cs
r1529 r2073 27 27 using System.Xml; 28 28 using System.Threading; 29 using System.Diagnostics;30 29 31 30 namespace HeuristicLab.Grid { … … 82 81 } catch(Exception ex) { 83 82 errorMessage = CreateErrorMessage(ex); 84 Trace.TraceWarning(errorMessage);83 HeuristicLab.Tracing.HiveLogger.Error(errorMessage); 85 84 // push operation on stack again 86 85 myExecutionStack.Push(atomicOperation); -
trunk/sources/HeuristicLab.sln
r2058 r2073 3862 3862 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU 3863 3863 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU 3864 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU 3864 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.CEDMA Debug|x86.ActiveCfg = Debug|x86 3865 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.CEDMA Debug|x86.Build.0 = Debug|x86 3865 3866 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 3866 3867 {DFAC1BEA-6D9D-477F-AC7B-E64977644DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
Note: See TracChangeset
for help on using the changeset viewer.