Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/02/11 18:42:44 (13 years ago)
Author:
ascheibe
Message:

#1233 slave: catch more errors and log them to the windows event log

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs

    r6910 r6945  
    7171    public void Start() {
    7272      abortRequested = false;
     73      EventLogManager.ServiceEventLog = ServiceEventLog;
    7374
    7475      try {
     
    9091      catch (Exception ex) {
    9192        if (ServiceEventLog != null) {
    92           try {
    93             ServiceEventLog.WriteEntry(string.Format("Hive Slave threw exception: {0} with stack trace: {1}", ex.ToString(), ex.StackTrace), EventLogEntryType.Error);
    94           }
    95           catch (Exception) { }
     93          EventLogManager.LogException(ex);
    9694        } else {
    9795          //try to log with clientCom. if this works the user sees at least a message,
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj

    r6896 r6945  
    118118    <Compile Include="ExecutorQueue.cs" />
    119119    <Compile Include="IPluginProvider.cs" />
     120    <Compile Include="Manager\EventLogManager.cs" />
    120121    <Compile Include="Manager\TaskManager.cs" />
    121122    <Compile Include="Exceptions\OutOfCoresException.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs

    r6456 r6945  
    5757      }
    5858      catch {
    59         pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom"));
     59        EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with config!");
     60
     61        try {
     62          pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom"));
     63        }
     64        catch {
     65          EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with fixed addresse!");
     66          return;
     67        }
    6068      }
     69      pipeFactory.Faulted += new System.EventHandler(pipeFactory_Faulted);
    6170
    6271      ISlaveCommunication pipeProxy = pipeFactory.CreateChannel();
     
    6473    }
    6574
     75    void pipeFactory_Faulted(object sender, System.EventArgs e) {
     76      EventLogManager.LogMessage("SlaveClientCom just faulted. Trying to repair it...");
     77
     78      try {
     79        pipeFactory.Faulted -= new System.EventHandler(pipeFactory_Faulted);
     80        SetupClientCom();
     81      }
     82      catch { }
     83    }
     84
    6685    public static void Close() {
    67       if (pipeFactory.State != CommunicationState.Closed)
     86      if (pipeFactory.State != CommunicationState.Closed && pipeFactory.State != CommunicationState.Faulted)
    6887        pipeFactory.Close();
    6988    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveCommunicationService.cs

    r6371 r6945  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using System.ServiceModel;
     
    5455
    5556    public void LogMessage(string message) {
    56       subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) {
    57         if (((ICommunicationObject)callback).State == CommunicationState.Opened) {
    58           callback.OnMessageLogged(message);
    59         } else {
    60           subscribers.Remove(callback);
    61         }
    62       });
     57      try {
     58        subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) {
     59          if (((ICommunicationObject)callback).State == CommunicationState.Opened) {
     60            callback.OnMessageLogged(message);
     61          } else {
     62            subscribers.Remove(callback);
     63          }
     64        });
     65      }
     66      catch (Exception ex) {
     67        EventLogManager.LogException(ex);
     68      }
    6369    }
    6470
    6571    public void StatusChanged(StatusCommons status) {
    66       subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) {
    67         if (((ICommunicationObject)callback).State == CommunicationState.Opened) {
    68           callback.OnStatusChanged(status);
    69         } else {
    70           subscribers.Remove(callback);
    71         }
    72       });
     72      try {
     73        subscribers.ForEach(delegate(ISlaveCommunicationCallbacks callback) {
     74          if (((ICommunicationObject)callback).State == CommunicationState.Opened) {
     75            callback.OnStatusChanged(status);
     76          } else {
     77            subscribers.Remove(callback);
     78          }
     79        });
     80      }
     81      catch (Exception ex) {
     82        EventLogManager.LogException(ex);
     83      }
    7384    }
    7485
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.3/SlaveTask.cs

    r6725 r6945  
    5151
    5252    public TimeSpan ExecutionTime {
    53       get { return executor != null ? executor.ExecutionTime : TimeSpan.Zero; }
     53      get {
     54        try {
     55          return executor != null ? executor.ExecutionTime : TimeSpan.Zero;
     56        }
     57        catch (Exception ex) {
     58          EventLogManager.LogException(ex);
     59          return TimeSpan.Zero;
     60        }
     61      }
    5462    }
    5563
     
    122130
    123131      if (executor != null) {
    124         executor.Dispose();
     132        try {
     133          executor.Dispose();
     134        }
     135        catch (Exception ex) {
     136          EventLogManager.LogException(ex);
     137        }
    125138      }
    126139
     
    155168
    156169    public TaskData GetTaskData() {
    157       return executor.GetTaskData();
     170      TaskData data = null;
     171      try {
     172        data = executor.GetTaskData();
     173      }
     174      catch (Exception ex) {
     175        EventLogManager.LogException(ex);
     176      }
     177      return data;
    158178    }
    159179
Note: See TracChangeset for help on using the changeset viewer.