- Timestamp:
- 04/22/11 10:58:01 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs
r6008 r6039 166 166 SlaveStatusInfo.JobsFetched++; 167 167 job = wcfService.UpdateJobState(job.Id, JobState.Calculating, null); 168 if (job == null) throw new JobNotFoundException(jobId); 168 169 StartJobInAppDomain(job, jobData); 169 170 }, container.JobId) … … 429 430 } 430 431 432 private static object locker = new object(); 433 431 434 /// <summary> 432 435 /// A new Job from the wcfService has been received and will be started within a AppDomain. … … 435 438 clientCom.LogMessage("Received new job with id " + myJob.Id); 436 439 clientCom.StatusChanged(ConfigManager.Instance.GetStatusForClientConsole()); 437 if (engines.ContainsKey(myJob.Id)) 438 throw new Exception("Job with key " + myJob.Id + " already exists"); 439 440 String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, myJob.Id.ToString()); 441 bool pluginsPrepared = false; 442 string configFileName = string.Empty; 443 444 try { 445 PluginCache.Instance.PreparePlugins(myJob, out configFileName); 446 clientCom.LogMessage("Plugins fetched for job " + myJob.Id); 447 pluginsPrepared = true; 448 } 449 catch (Exception exception) { 450 clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", myJob.Id, exception)); 451 lock (engines) { 452 if (jobs.ContainsKey(myJob.Id)) { 453 jobs.Remove(myJob.Id); 454 } 455 } 456 } 457 458 if (pluginsPrepared) { 440 441 lock (locker) { 442 if (engines.ContainsKey(myJob.Id)) 443 throw new Exception("Job with key " + myJob.Id + " already exists"); 444 445 String pluginDir = Path.Combine(PluginCache.Instance.PluginTempBaseDir, myJob.Id.ToString()); 446 bool pluginsPrepared = false; 447 string configFileName = string.Empty; 448 459 449 try { 460 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(myJob.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName)); 461 appDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException); 450 PluginCache.Instance.PreparePlugins(myJob, out configFileName); 451 clientCom.LogMessage("Plugins fetched for job " + myJob.Id); 452 pluginsPrepared = true; 453 } 454 catch (Exception exception) { 455 clientCom.LogMessage(string.Format("Copying plugins for job {0} failed: {1}", myJob.Id, exception)); 462 456 lock (engines) { 463 appDomains.Add(myJob.Id, appDomain); 464 clientCom.LogMessage("Creating AppDomain"); 465 Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName); 466 clientCom.LogMessage("Created AppDomain"); 467 engine.JobId = myJob.Id; 468 engine.Core = this; 469 clientCom.LogMessage("Starting Engine for job " + myJob.Id); 470 engines.Add(myJob.Id, engine); 471 engine.Start(jobData.Data); 472 } 473 } 474 catch (Exception exception) { 475 clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + myJob.Id); 476 clientCom.LogMessage("Error thrown is: " + exception.ToString()); 477 KillAppDomain(myJob.Id); 457 if (jobs.ContainsKey(myJob.Id)) { 458 jobs.Remove(myJob.Id); 459 } 460 } 461 } 462 463 if (pluginsPrepared) { 464 try { 465 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(myJob.Id.ToString(), pluginDir, Path.Combine(pluginDir, configFileName)); 466 appDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException); 467 lock (engines) { 468 appDomains.Add(myJob.Id, appDomain); 469 clientCom.LogMessage("Creating AppDomain"); 470 Executor engine = (Executor)appDomain.CreateInstanceAndUnwrap(typeof(Executor).Assembly.GetName().Name, typeof(Executor).FullName); 471 clientCom.LogMessage("Created AppDomain"); 472 engine.JobId = myJob.Id; 473 engine.Core = this; 474 clientCom.LogMessage("Starting Engine for job " + myJob.Id); 475 engines.Add(myJob.Id, engine); 476 engine.Start(jobData.Data); 477 } 478 } 479 catch (Exception exception) { 480 clientCom.LogMessage("Creating the Appdomain and loading the job failed for job " + myJob.Id); 481 clientCom.LogMessage("Error thrown is: " + exception.ToString()); 482 KillAppDomain(myJob.Id); 483 } 478 484 } 479 485 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/app.config
r5402 r6039 17 17 <bindings> 18 18 <wsHttpBinding> 19 <binding name="wsHttpBinding" 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="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">20 <readerQuotas maxDepth="32" maxStringContentLength=" 8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>19 <binding name="wsHttpBinding" 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="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 20 <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 21 21 <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/> 22 22 <security mode="Message"> … … 28 28 </bindings> 29 29 <services> 30 <service name="HeuristicLab.Clients.Hive.Slave .SlaveCommunicationService">31 <endpoint address="net.pipe://localhost/HeuristicLabSlaveCom" binding="netNamedPipeBinding" contract="HeuristicLab.Clients.Hive.Slave .ServiceContracts.ISlaveCommunication"/>30 <service name="HeuristicLab.Clients.Hive.SlaveCore.SlaveCommunicationService"> 31 <endpoint address="net.pipe://localhost/HeuristicLabSlaveCom" binding="netNamedPipeBinding" contract="HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts.ISlaveCommunication"/> 32 32 </service> 33 33 </services> 34 34 <client> 35 <endpoint address="http://localhost/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService" name="wsHttpBinding_IHiveService"> 35 <endpoint name="SlaveCommunicationServiceEndpoint" address="net.pipe://localhost/HeuristicLabSlaveCom" binding="netNamedPipeBinding" contract="HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts.ISlaveCommunication"/> 36 <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="HeuristicLab.Clients.Hive.IHiveService" name="wsHttpBinding_IHiveService"> 36 37 <identity> 37 <certificate encodedValue="AwAAAAEAAAAUAAAA fEKvcVixnJay+q4hCPFuO0JL5TQgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMTAxOTEwNTMxNVoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXwC5TGcAffd/0oAWHtm0s6YXVXEgXgb1AYmBkkkhkKIFJG/e/Z0KSYbJepmSJD44W3oOAVm+x1DAsZxU79HahDYgWCuHLMm1TLpwSmYOQ0kV3pGHWHhiWV7h7oGLds/eqZ2EOpaNGryfEPnrA4VmxY91vV5/2BTeVSWG6F8lRKQIDAQABo0kwRzBFBgNVHQEEPjA8gBAR7kBnMRHO5gzThEqda0wWoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghCNN5wrUcXMmE/9xwp4TYa9MAkGBSsOAwIdBQADgYEAoPwEG4QTDXhlxERNDfsZmM2IhEpV42ppz1kEah2oYKDa/ElIMVtvqLv6flVtg18ENN/mEJWiHZ3NyP3qr2Pip+sh+/2WBiSbOaukES/CM7OJn9kJCImH7M/xqM8pxqY8IfgM6iBVrVj9uHqj3j2BBck+cYY8fKyh3CFifMIp6ac="/>38 <certificate encodedValue="AwAAAAEAAAAUAAAAwK1+2oAmcy/mI2P2QjyiJRh0y60gAAAAAQAAACoCAAAwggImMIIBj6ADAgECAhAIkseQ2EEhgU720qJA61gqMA0GCSqGSIb3DQEBBAUAMCQxIjAgBgNVBAMTGXNlcnZpY2VzLmhldXJpc3RpY2xhYi5jb20wHhcNMTAwNTExMTExNDAyWhcNMzkxMjMxMjM1OTU5WjAkMSIwIAYDVQQDExlzZXJ2aWNlcy5oZXVyaXN0aWNsYWIuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCq26Bwmwc7k+4W30qLQ2j+FInEL5BuH6opDY6CSlrtt3xQS/anrhvpbf3QghLDVINzcHkzbPmm/SguG4F85QLB6xO+tJaOvRo0iEK5g3c307vMIru7FJwk/OhplEQ5J1hbDgL3zOJlrWlgtqRVxCtVdF3XroI9BctOt1NkeKv9ewIDAQABo1kwVzBVBgNVHQEETjBMgBCjbgdYd4j5JgUuJ1Wo/GxroSYwJDEiMCAGA1UEAxMZc2VydmljZXMuaGV1cmlzdGljbGFiLmNvbYIQCJLHkNhBIYFO9tKiQOtYKjANBgkqhkiG9w0BAQQFAAOBgQAb/2xk2uQad68shSPl/uixWgvFI8WkxOTBopOLaLtDxwCeZ3mWVHdV9VnixHtThubnEBXAhYOCQSIXWtQuXFWO+gH3YyjTRJY5kTmXyuvBRTn3/so5SrQ7Rdlm9hf6E5YVX3tCjAy7ybUyaDUkQfmH5vmvgvpMzRfsJ1qhnUpJiQ=="/> 38 39 </identity> 39 40 </endpoint>
Note: See TracChangeset
for help on using the changeset viewer.