Changeset 4141 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Core.cs
- Timestamp:
- 08/04/10 10:44:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Core.cs
r4119 r4141 46 46 using HeuristicLab.Tracing; 47 47 using HeuristicLab.Core; 48 using System.IO; 48 49 49 50 namespace HeuristicLab.Hive.Client.Core { … … 134 135 135 136 case MessageContainer.MessageType.JobAborted: 136 //todo: thread this 137 lock (engines) { 138 Guid jobId = new Guid(container.JobId.ToString()); 139 if (engines.ContainsKey(jobId)) { 140 appDomains[jobId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException); 141 AppDomain.Unload(appDomains[jobId]); 142 appDomains.Remove(jobId); 143 engines.Remove(jobId); 144 jobs.Remove(jobId); 145 GC.Collect(); 146 } else 147 Logger.Error("JobAbort: Engine doesn't exist"); 148 } 137 Guid jobId = new Guid(container.JobId.ToString()); 138 KillAppDomain(jobId); 149 139 break; 150 140 … … 247 237 if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) { 248 238 Logger.Info("Sending the finished job with id: " + jId); 249 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, null, true);239 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, engines[jId].CurrentException, true); 250 240 } else { 251 241 Logger.Info("Storing the finished job with id: " + jId + " to hdd"); 252 242 JobStorageManager.PersistObjectToDisc(wcfService.ServerIP, wcfService.ServerPort, jId, sJob); 253 lock (engines) { 254 appDomains[jId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException); 255 256 //Disposing it 257 engines[jId].Dispose(); 258 259 AppDomain.Unload(appDomains[jId]); 260 Logger.Debug("Unloaded appdomain"); 261 appDomains.Remove(jId); 262 engines.Remove(jId); 263 jobs.Remove(jId); 264 Logger.Debug("Removed job from appDomains, Engines and Jobs"); 265 } 243 KillAppDomain(jId); 266 244 } 267 245 } catch (InvalidStateException ise) { … … 332 310 PluginCache.Instance.PreparePlugins(e.Result.Job.PluginsNeeded); 333 311 312 PluginCache.Instance.CopyPluginsForJob(e.Result.Job.PluginsNeeded, e.Result.Job.Id); 313 334 314 // foreach (CachedHivePluginInfoDto plugininfo in PluginCache.Instance.GetPlugins(e.Result.Job.PluginsNeeded)) 335 315 // files.AddRange(plugininfo.PluginFiles); 336 316 Logger.Debug("Plugins fetched for job " + e.Result.Job.Id); 337 317 try { 338 AppDomain appDomain =339 HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(340 e.Result.Job.Id.ToString(), null);318 String pluginDir = Path.Combine(PluginCache.PLUGIN_REPO, e.Result.Job.Id.ToString()); 319 320 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(pluginDir, null); 341 321 appDomain.UnhandledException += new UnhandledExceptionEventHandler(appDomain_UnhandledException); 342 322 lock (engines) { … … 365 345 CurrentlyFetching = false; 366 346 KillAppDomain(e.Result.Job.Id); 347 wcfService.StoreFinishedJobResultsSync(ConfigManager.Instance.GetClientInfo().Id, e.Result.Job.Id, new byte[] { }, 1, exception, true); 367 348 } 368 349 } else … … 497 478 engines.Remove(id); 498 479 jobs.Remove(id); 480 PluginCache.Instance.DeletePluginsForJob(id); 499 481 GC.Collect(); 500 482 } catch (Exception ex) {
Note: See TracChangeset
for help on using the changeset viewer.