Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8242


Ignore:
Timestamp:
07/05/12 17:39:12 (12 years ago)
Author:
spimming
Message:

#1888:

  • slave worker role initial commit
  • start client communication service optionally
  • make slave client communication interchangeable ('PipeCom', 'TraceCom')
Location:
branches/OaaS
Files:
18 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab 3.3 Hive.Slave.sln

    r7009 r8242  
    1717EndProject
    1818Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "HeuristicLab.Clients.Hive.Slave.WindowsServiceSetup-3.3", "HeuristicLab.Clients.Hive.Slave.WindowsServiceSetup\HeuristicLab.Clients.Hive.Slave.WindowsServiceSetup.vdproj", "{C16CA1A6-7AE8-4B87-A6A6-9C290E8B9646}"
     19EndProject
     20Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "HeuristicLab.Clients.Hive.Slave.Azure", "HeuristicLab.Clients.Hive.Slave.Azure\HeuristicLab.Clients.Hive.Slave.Azure.ccproj", "{BB824120-4F6D-4DD9-B492-618063532515}"
     21EndProject
     22Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Clients.Hive.Slave.AzureClient-3.3", "HeuristicLab.Clients.Hive.Slave.AzureClient\3.3\HeuristicLab.Clients.Hive.Slave.AzureClient-3.3.csproj", "{D0DDC7C9-9215-4325-AA2F-0C4ABF809321}"
    1923EndProject
    2024Global
     
    124128    {C16CA1A6-7AE8-4B87-A6A6-9C290E8B9646}.Release|x86.ActiveCfg = Release
    125129    {C16CA1A6-7AE8-4B87-A6A6-9C290E8B9646}.Release|x86.Build.0 = Release
     130    {BB824120-4F6D-4DD9-B492-618063532515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     131    {BB824120-4F6D-4DD9-B492-618063532515}.Debug|Any CPU.Build.0 = Debug|Any CPU
     132    {BB824120-4F6D-4DD9-B492-618063532515}.Debug|x64.ActiveCfg = Debug|Any CPU
     133    {BB824120-4F6D-4DD9-B492-618063532515}.Debug|x86.ActiveCfg = Debug|Any CPU
     134    {BB824120-4F6D-4DD9-B492-618063532515}.Release|Any CPU.ActiveCfg = Release|Any CPU
     135    {BB824120-4F6D-4DD9-B492-618063532515}.Release|Any CPU.Build.0 = Release|Any CPU
     136    {BB824120-4F6D-4DD9-B492-618063532515}.Release|x64.ActiveCfg = Release|Any CPU
     137    {BB824120-4F6D-4DD9-B492-618063532515}.Release|x86.ActiveCfg = Release|Any CPU
     138    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     139    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Debug|Any CPU.Build.0 = Debug|Any CPU
     140    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Debug|x64.ActiveCfg = Debug|Any CPU
     141    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Debug|x86.ActiveCfg = Debug|Any CPU
     142    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|Any CPU.ActiveCfg = Release|Any CPU
     143    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|Any CPU.Build.0 = Release|Any CPU
     144    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|x64.ActiveCfg = Release|Any CPU
     145    {D0DDC7C9-9215-4325-AA2F-0C4ABF809321}.Release|x86.ActiveCfg = Release|Any CPU
    126146  EndGlobalSection
    127147  GlobalSection(SolutionProperties) = preSolution
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs

    r7259 r8242  
    2626using System.Threading.Tasks;
    2727using HeuristicLab.Clients.Hive.SlaveCore.Properties;
    28 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;
    2928using HeuristicLab.Common;
    3029using HeuristicLab.Core;
     
    5251    private ConfigManager configManager;
    5352    private PluginManager pluginManager;
    54 
    55     public Core() {
     53    private bool startClientComService;
     54
     55    public Core()
     56      : this(true) {
     57    }
     58
     59    public Core(bool startClientComService) {
    5660      var log = new ThreadSafeLog(Settings.Default.MaxLogCount);
    5761      this.pluginManager = new PluginManager(WcfService.Instance, log);
     
    6367      this.configManager = new ConfigManager(taskManager);
    6468      ConfigManager.Instance = this.configManager;
     69
     70      this.startClientComService = startClientComService;
    6571    }
    6672
     
    7379
    7480      try {
    75         //start the client communication service (pipe between slave and slave gui)
    76         slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
    77         slaveComm.Open();
    78        
     81        if (startClientComService) {
     82          //start the client communication service (pipe between slave and slave gui)
     83          slaveComm = new ServiceHost(typeof(SlaveCommunicationService));
     84          slaveComm.Open();
     85        }
     86
    7987        // delete all left over task directories
    8088        pluginManager.CleanPluginTemp();
     
    96104        }
    97105        ShutdownCore();
    98       } finally {
     106      }
     107      finally {
    99108        DeregisterServiceEvents();
    100109        waitShutdownSem.Release();
     
    466475      SlaveClientCom.Close();
    467476
    468       if (slaveComm.State != CommunicationState.Closed)
    469         slaveComm.Close();
     477      if (startClientComService) {
     478        if (slaveComm.State != CommunicationState.Closed)
     479          slaveComm.Close();
     480      }
    470481    }
    471482
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/HeuristicLab.Clients.Hive.Slave-3.3.csproj

    r6983 r8242  
    128128  <ItemGroup>
    129129    <Compile Include="Exceptions\TaskFailedException.cs" />
     130    <Compile Include="IClientCom.cs" />
    130131    <Compile Include="Manager\ConfigManager.cs" />
    131132    <Compile Include="Exceptions\SerializationException.cs" />
     
    142143    <Compile Include="Exceptions\OutOfCoresException.cs" />
    143144    <Compile Include="Exceptions\AppDomainNotCreatedException.cs" />
     145    <Compile Include="PipeCom.cs" />
    144146    <Compile Include="SlaveClientCom.cs" />
    145147    <Compile Include="Core.cs" />
     
    163165    <Compile Include="SlaveStatusInfo.cs" />
    164166    <Compile Include="StatusCommons.cs" />
     167    <Compile Include="TraceCom.cs" />
    165168    <Compile Include="WcfService.cs" />
    166169    <None Include="app.config" />
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs

    r7777 r8242  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.530
     4//     Runtime Version:4.0.30319.269
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    311311            }
    312312        }
     313       
     314        [global::System.Configuration.UserScopedSettingAttribute()]
     315        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     316        [global::System.Configuration.DefaultSettingValueAttribute("Trace")]
     317        public global::HeuristicLab.Clients.Hive.SlaveCore.ClientComType ClientComType {
     318            get {
     319                return ((global::HeuristicLab.Clients.Hive.SlaveCore.ClientComType)(this["ClientComType"]));
     320            }
     321            set {
     322                this["ClientComType"] = value;
     323            }
     324        }
    313325    }
    314326}
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings

    r7777 r8242  
    7575      <Value Profile="(Default)">-1</Value>
    7676    </Setting>
     77    <Setting Name="ClientComType" Type="HeuristicLab.Clients.Hive.SlaveCore.ClientComType" Scope="User">
     78      <Value Profile="(Default)">Trace</Value>
     79    </Setting>
    7780  </Settings>
    7881</SettingsFile>
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/SlaveClientCom.cs

    r7259 r8242  
    2020#endregion
    2121
    22 using System.ServiceModel;
     22using System;
    2323using HeuristicLab.Clients.Hive.SlaveCore.Properties;
    2424using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;
    25 using System;
    2625
    2726namespace HeuristicLab.Clients.Hive.SlaveCore {
     27
     28  public enum ClientComType { Pipe, Trace };
    2829
    2930  /// <summary>
     
    3233  public class SlaveClientCom {
    3334    private static SlaveClientCom instance;
    34     private static DuplexChannelFactory<ISlaveCommunication> pipeFactory;
     35    //private static DuplexChannelFactory<ISlaveCommunication> pipeFactory;
     36    private static IClientCom clientComInstance;
    3537    public ISlaveCommunication ClientCom { get; set; }
    3638
     
    4547        }
    4648        return instance;
     49      }
     50    }
     51
     52    public static IClientCom ClientComInstance {
     53      get {
     54        if (clientComInstance != null) {
     55          return clientComInstance;
     56        }
     57        throw new NullReferenceException("No instance of SlaveClientCom<T>");
    4758      }
    4859    }
     
    6778
    6879    private SlaveClientCom() {
    69       SetupClientCom();
    70     }
     80      ClientComType type = Settings.Default.ClientComType;
     81      if (type == ClientComType.Pipe) {
     82        clientComInstance = new PipeCom();
     83      } else if (type == ClientComType.Trace) {
     84        clientComInstance = new TraceCom();
     85      } else {
     86        throw new InvalidStateException("Invalid client communication type");
     87      }
    7188
    72     private void SetupClientCom() {
    73       DummyListener dummy = new DummyListener();
    74       try {
    75         pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, Settings.Default.SlaveCommunicationServiceEndpoint);
    76       }
    77       catch {
    78         EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with config!");
    79 
    80         try {
    81           pipeFactory = new DuplexChannelFactory<ISlaveCommunication>(dummy, new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/HeuristicLabSlaveCom"));
    82         }
    83         catch {
    84           EventLogManager.LogMessage("Couldn't create pipe for SlaveClientCom with fixed addresse!");
    85           return;
    86         }
    87       }
    88       pipeFactory.Faulted += new System.EventHandler(pipeFactory_Faulted);
    89 
    90       ISlaveCommunication pipeProxy = pipeFactory.CreateChannel();
    91       ClientCom = pipeProxy;
    92     }
    93 
    94     void pipeFactory_Faulted(object sender, System.EventArgs e) {
    95       EventLogManager.LogMessage("SlaveClientCom just faulted. Trying to repair it...");
    96 
    97       try {
    98         pipeFactory.Faulted -= new System.EventHandler(pipeFactory_Faulted);
    99         SetupClientCom();
    100       }
    101       catch { }
     89      ClientCom = clientComInstance.GetSlaveCom();
    10290    }
    10391
    10492    public static void Close() {
    105       if (pipeFactory.State != CommunicationState.Closed && pipeFactory.State != CommunicationState.Faulted)
    106         pipeFactory.Close();
     93      ClientComInstance.Close();
    10794    }
    10895  }
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/app.config

    r7777 r8242  
    99    <gcServer enabled="true" />
    1010  </runtime>
    11 
    1211  <startup>
    1312    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    1413  </startup>
    15  
    1614  <system.serviceModel>
    1715    <behaviors>
     
    122120        <value>-1</value>
    123121      </setting>
     122      <setting name="ClientComType" serializeAs="String">
     123        <value>Trace</value>
     124      </setting>
    124125    </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings>
    125126  </userSettings>
Note: See TracChangeset for help on using the changeset viewer.