Changeset 1655


Ignore:
Timestamp:
04/24/09 14:35:35 (12 years ago)
Author:
kgrading
Message:

added proper exception handling (#601)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs

    r1635 r1655  
    211211          files.AddRange(plugininfo.PluginFiles);
    212212       
    213         AppDomain appDomain = PluginManager.Manager.CreateAndInitAppDomainWithSandbox(e.Result.Job.Id.ToString(), sandboxed, null, files);
     213        AppDomain appDomain = PluginManager.Manager.CreateAndInitAppDomainWithSandbox(e.Result.Job.Id.ToString(), sandboxed, typeof(Engine.HiveEngine), files);
    214214        appDomain.UnhandledException += new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    215215        lock (engines) {                   
     
    298298
    299299    void appDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
    300       Logging.Instance.Error(this.ToString(), " Exception: " + e.ExceptionObject.ToString());
     300      Logging.Instance.Error(this.ToString(), "Exception in AppDomain: " + e.ExceptionObject.ToString());
     301     
    301302    }
    302303  }
  • trunk/sources/HeuristicLab.Hive.Client.Core/3.2/HeuristicLab.Hive.Client.Core-3.2.csproj

    r1635 r1655  
    143143      <Name>HeuristicLab.Hive.Contracts-3.2</Name>
    144144    </ProjectReference>
     145    <ProjectReference Include="..\..\HeuristicLab.Hive.Engine\3.2\HeuristicLab.Hive.Engine-3.2.csproj">
     146      <Project>{C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}</Project>
     147      <Name>HeuristicLab.Hive.Engine-3.2</Name>
     148    </ProjectReference>
    145149    <ProjectReference Include="..\..\HeuristicLab.Hive.JobBase\3.2\HeuristicLab.Hive.JobBase-3.2.csproj">
    146150      <Project>{21187322-52DD-4243-80A4-A85F0263E63B}</Project>
  • trunk/sources/HeuristicLab.Hive.Client.ExecutionEngine/3.2/Executor.cs

    r1530 r1655  
    5757      //Job = new TestJob();
    5858      Job.JobStopped += new EventHandler(Job_JobStopped);
     59      Job.JobFailed += new EventHandler(Job_JobFailed);
    5960      Job.Start();
     61    }
     62
     63    void Job_JobFailed(object sender, EventArgs e) {
     64      Queue.AddMessage(new MessageContainer(MessageContainer.MessageType.JobFailed, JobId));
    6065    }
    6166
  • trunk/sources/HeuristicLab.Hive.Contracts/3.2/MessageContainer.cs

    r1530 r1655  
    3333  public class MessageContainer {
    3434
    35     public enum MessageType { FetchJob, AbortJob, JobAborted, RequestSnapshot, FinishedJob, NoMessage, SnapshotReady, Shutdown };
     35    public enum MessageType { FetchJob, AbortJob, JobAborted, RequestSnapshot, FinishedJob, NoMessage, SnapshotReady, Shutdown, JobFailed };
    3636
    3737    public MessageType Message { get; set; }
  • trunk/sources/HeuristicLab.Hive.Engine/3.2/Job.cs

    r1530 r1655  
    6060
    6161    public event EventHandler JobStopped;
     62    public event EventHandler JobFailed;
    6263
    6364    public long JobId {
  • trunk/sources/HeuristicLab.Hive.JobBase/3.2/Interfaces/IJob.cs

    r1430 r1655  
    44  public interface IJob: IStorable {
    55    event EventHandler JobStopped;
     6    event EventHandler JobFailed;
    67    long JobId { get; set; }
    78    double Progress { get; }
  • trunk/sources/HeuristicLab.Hive.JobBase/3.2/JobBase.cs

    r1530 r1655  
    3434    private Thread thread = null;
    3535    public event EventHandler JobStopped;
     36    public event EventHandler JobFailed;
    3637   
    3738    public long JobId { get; set; }   
     
    4243
    4344    abstract public void Run();
     45    private void SecureRun() {
     46      try {
     47        Run();
     48      }
     49      catch (Exception ex) {
     50        if (JobFailed != null)
     51          JobFailed(this, new EventArgs());
     52      }
     53    }
    4454
    4555    public void Start() {
    46       thread = new Thread(new ThreadStart(Run));
     56      thread = new Thread(new ThreadStart(Run));     
    4757      thread.Start();
    4858      Running = true;
  • trunk/sources/HeuristicLab.PluginInfrastructure/PluginManager.cs

    r1602 r1655  
    194194      PermissionSet pset;
    195195
     196     
     197
    196198      DiscoveryService dService = new DiscoveryService();
    197199      //get the declaring plugin of the job
     
    227229      NotifyListeners(PluginManagerAction.Initializing, "All plugins");
    228230
    229       if (assemblyFiles != null && assemblyFiles.Count > 0)
    230         remoteRunner.LoadPlugins(assemblyFiles);
    231    
    232       //if (depPlugins != null && depPlugins.Count > 0) {       
    233       //  remoteRunner.LoadPlugins(depPlugins);
    234       //}
     231      //if (assemblyFiles != null && assemblyFiles.Count > 0)
     232      //  remoteRunner.LoadPlugins(assemblyFiles);
     233     
     234      if (depPlugins != null && depPlugins.Count > 0) {       
     235        remoteRunner.LoadPlugins(depPlugins);
     236      }
    235237      NotifyListeners(PluginManagerAction.Initialized, "All plugins");
    236238      return applicationDomain;
Note: See TracChangeset for help on using the changeset viewer.