Changeset 4305 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3
- Timestamp:
- 08/24/10 18:37:04 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj
r4296 r4305 85 85 <Reference Include="System.Core" /> 86 86 <Reference Include="System.Drawing" /> 87 <Reference Include="System.Runtime.Serialization" /> 87 88 <Reference Include="System.ServiceModel" /> 88 89 <Reference Include="System.Xml.Linq" /> … … 104 105 </Compile> 105 106 <Compile Include="ServiceLocator.cs" /> 106 <Compile Include="Settings.cs" />107 107 </ItemGroup> 108 108 <ItemGroup> … … 113 113 <None Include="Properties\AssemblyInfo.frame" /> 114 114 <None Include="Properties\Settings.settings"> 115 <Generator> SettingsSingleFileGenerator</Generator>115 <Generator>PublicSettingsSingleFileGenerator</Generator> 116 116 <LastGenOutput>Settings.Designer.cs</LastGenOutput> 117 117 </None> 118 <None Include="Tools\RecreateServiceConfig.bat" /> 118 119 </ItemGroup> 119 120 <ItemGroup> … … 130 131 <Name>HeuristicLab.Hive.JobBase-3.3</Name> 131 132 </ProjectReference> 133 </ItemGroup> 134 <ItemGroup> 135 <WCFMetadata Include="Service References\" /> 132 136 </ItemGroup> 133 137 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs
r4302 r4305 43 43 using System.ServiceModel; 44 44 using HeuristicLab.Hive.Contracts.ResponseObjects; 45 using HeuristicLab.Hive.Experiment.Properties; 45 46 46 47 namespace HeuristicLab.Hive.Experiment { … … 90 91 } 91 92 } 92 93 93 94 #region Storable Properties 94 95 [Storable] … … 114 115 public JobItemList JobItems { 115 116 get { return jobItems; } 116 }117 118 119 [Storable]120 private string serverUrl;121 public string ServerUrl {122 get { return serverUrl; }123 set {124 if (serverUrl != value) {125 serverUrl = value;126 OnServerUrlChanged();127 }128 }129 117 } 130 118 … … 191 179 public HiveExperiment() 192 180 : base(itemName, itemDescription) { 193 this.ServerUrl = HeuristicLab.Hive.Experiment.Properties.Settings.Default.HiveServerUrl;194 181 this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds; 195 182 this.log = new Log(); … … 205 192 HiveExperiment clone = (HiveExperiment)base.Clone(cloner); 206 193 clone.resourceIds = this.resourceIds; 207 clone.serverUrl = this.serverUrl;208 194 clone.experiment = (HeuristicLab.Optimization.Experiment)cloner.Clone(experiment); 209 195 clone.executionState = this.executionState; … … 279 265 280 266 Thread t = new Thread(() => { 281 IClientFacade clientFacade = GetClientFacade();267 IClientFacade clientFacade = CreateStreamedClientFacade(); 282 268 283 269 try { … … 307 293 LogMessage(jobItem.JobDto.Id, "Job sent to Hive"); 308 294 } 309 } catch (Exception e) { 295 } 296 catch (Exception e) { 310 297 LogMessage("Error: Starting HiveExperiment failed: " + e.Message); 311 298 this.ExecutionState = Core.ExecutionState.Stopped; … … 468 455 private void FetchAndUpdateJob(Guid jobId) { 469 456 LogMessage(jobId, "FetchAndUpdateJob started"); 470 IClientFacade clientFacade = GetClientFacade();457 IClientFacade clientFacade = CreateStreamedClientFacade(); 471 458 IOptimizer originalOptimizer; 472 459 lock (pendingOptimizersByJobId) { … … 490 477 491 478 public void AbortJob(Guid jobId) { 492 IClientFacade clientFacade = GetClientFacade();479 IClientFacade clientFacade = CreateClientFacade(); 493 480 Response response = clientFacade.AbortJob(jobId); 494 481 LogMessage(jobId, "Aborting Job: " + response.StatusMessage); … … 554 541 try { 555 542 do { 556 IClientFacade clientFacade = GetClientFacade();543 IClientFacade clientFacade = CreateStreamedClientFacade(); 557 544 IEnumerable<Guid> jobIdsToQuery = from job in JobItems 558 545 where job.State != JobState.Finished && … … 571 558 throw new Exception(response.StatusMessage.ToString()); 572 559 } 573 } catch (Exception e) { 560 } 561 catch (Exception e) { 574 562 LogMessage("Polling results failed: " + e.Message); 575 563 } … … 582 570 } 583 571 } while (!this.stopResultsPollingPending); 584 } catch (ThreadInterruptedException exception) { 572 } 573 catch (ThreadInterruptedException exception) { 585 574 // thread has been interuppted 586 } finally { 575 } 576 finally { 587 577 this.IsPollingResults = false; 588 578 } … … 601 591 public void RequestSnapshot(Guid jobId) { 602 592 Thread t = new Thread(() => { 603 IClientFacade clientFacade = GetClientFacade();593 IClientFacade clientFacade = CreateStreamedClientFacade(); 604 594 ResponseObject<SerializedJob> response; 605 595 int retryCount = 0; … … 876 866 877 867 #region Helper Functions 878 private IClientFacade GetClientFacade() {868 private IClientFacade CreateClientFacade() { 879 869 IClientFacade clientFacade = null; 880 870 do { 881 871 try { 882 clientFacade = ServiceLocator.CreateClientFacade(ServerUrl); 872 clientFacade = ServiceLocator.CreateClientFacade(string.Format("http://{0}:{1}/{2}", Settings.Default.HiveServerIp, Settings.Default.HiveServerPort, WcfSettings.ClientServiceName)); 873 883 874 } catch (EndpointNotFoundException exception) { 884 875 LogMessage("Could not connect to Server: " + exception.Message + ". Will try again in " + (resultPollingIntervalMs / 1000) + " sec."); … … 889 880 } 890 881 882 private IClientFacade CreateStreamedClientFacade() { 883 IClientFacade clientFacade = null; 884 do { 885 try { 886 clientFacade = ServiceLocator.CreateStreamedClientFacade(string.Format("http://{0}:{1}/{2}", Settings.Default.HiveServerIp, Settings.Default.HiveServerPort, WcfSettings.ClientStreamedServiceName)); 887 888 } catch (EndpointNotFoundException exception) { 889 LogMessage("Could not connect to Server: " + exception.Message + ". Will try again in " + (resultPollingIntervalMs / 1000) + " sec."); 890 Thread.Sleep(resultPollingIntervalMs); 891 } 892 } while (clientFacade == null && this.ExecutionState != Core.ExecutionState.Stopped); 893 return clientFacade; 894 } 891 895 892 896 private void AddRange(IDictionary<IOptimizer, IOptimizer> optimizers, IDictionary<IOptimizer, IOptimizer> childs) { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/Settings.Designer.cs
r4116 r4305 14 14 [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 15 [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 internalsealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {16 public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 17 18 18 private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); … … 21 21 get { 22 22 return defaultInstance; 23 }24 }25 26 [global::System.Configuration.UserScopedSettingAttribute()]27 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]28 [global::System.Configuration.DefaultSettingValueAttribute("net.tcp://10.42.1.153:9000/ExecutionEngine/ExecutionEngineFacade")]29 public string HiveServerUrl {30 get {31 return ((string)(this["HiveServerUrl"]));32 }33 set {34 this["HiveServerUrl"] = value;35 23 } 36 24 } … … 47 35 } 48 36 } 37 38 [global::System.Configuration.UserScopedSettingAttribute()] 39 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 [global::System.Configuration.DefaultSettingValueAttribute("localhost")] 41 public string HiveServerIp { 42 get { 43 return ((string)(this["HiveServerIp"])); 44 } 45 set { 46 this["HiveServerIp"] = value; 47 } 48 } 49 50 [global::System.Configuration.UserScopedSettingAttribute()] 51 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 [global::System.Configuration.DefaultSettingValueAttribute("cneumueller")] 53 public string HiveUsername { 54 get { 55 return ((string)(this["HiveUsername"])); 56 } 57 set { 58 this["HiveUsername"] = value; 59 } 60 } 61 62 [global::System.Configuration.UserScopedSettingAttribute()] 63 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 64 [global::System.Configuration.DefaultSettingValueAttribute("cneumueller")] 65 public string HivePassword { 66 get { 67 return ((string)(this["HivePassword"])); 68 } 69 set { 70 this["HivePassword"] = value; 71 } 72 } 73 74 [global::System.Configuration.UserScopedSettingAttribute()] 75 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 76 [global::System.Configuration.DefaultSettingValueAttribute("9000")] 77 public string HiveServerPort { 78 get { 79 return ((string)(this["HiveServerPort"])); 80 } 81 set { 82 this["HiveServerPort"] = value; 83 } 84 } 49 85 } 50 86 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/Settings.settings
r4116 r4305 3 3 <Profiles /> 4 4 <Settings> 5 <Setting Name="HiveServerUrl" Type="System.String" Scope="User">6 <Value Profile="(Default)">net.tcp://10.42.1.153:9000/ExecutionEngine/ExecutionEngineFacade</Value>7 </Setting>8 5 <Setting Name="ResourceIds" Type="System.String" Scope="User"> 9 6 <Value Profile="(Default)">MyGroup</Value> 10 7 </Setting> 8 <Setting Name="HiveServerIp" Type="System.String" Scope="User"> 9 <Value Profile="(Default)">localhost</Value> 10 </Setting> 11 <Setting Name="HiveUsername" Type="System.String" Scope="User"> 12 <Value Profile="(Default)">cneumueller</Value> 13 </Setting> 14 <Setting Name="HivePassword" Type="System.String" Scope="User"> 15 <Value Profile="(Default)">cneumueller</Value> 16 </Setting> 17 <Setting Name="HiveServerPort" Type="System.String" Scope="User"> 18 <Value Profile="(Default)">9000</Value> 19 </Setting> 11 20 </Settings> 12 21 </SettingsFile> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs
r4302 r4305 27 27 using System.ServiceModel; 28 28 using HeuristicLab.Hive.Contracts; 29 using HeuristicLab.Hive.Experiment.Properties; 29 30 30 31 namespace HeuristicLab.Hive.Experiment { 31 32 internal class ServiceLocator { 32 33 internal static IClientFacade CreateClientFacade(string url) { 33 ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>( 34 WcfSettings.GetStreamedBinding(), 35 new EndpointAddress(url)); 36 return factory.CreateChannel(); 34 ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>("ClientHttpEndpoint"); 35 WcfSettings.SetEndpointAddress(factory.Endpoint, url); 36 37 factory.Credentials.UserName.UserName = Settings.Default.HiveUsername; 38 factory.Credentials.UserName.Password = Settings.Default.HivePassword; 39 40 IClientFacade client = factory.CreateChannel(); 41 return client; 42 } 43 44 internal static IClientFacade CreateStreamedClientFacade(string url) { 45 ChannelFactory<IClientFacade> factory = new ChannelFactory<IClientFacade>("ClientStreamedHttpEndpoint"); 46 WcfSettings.SetEndpointAddress(factory.Endpoint, url); 47 48 factory.Credentials.UserName.UserName = Settings.Default.HiveUsername; 49 factory.Credentials.UserName.Password = Settings.Default.HivePassword; 50 51 IClientFacade client = factory.CreateChannel(); 52 return client; 37 53 } 38 54 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/app.config
r4170 r4305 8 8 <userSettings> 9 9 <HeuristicLab.Hive.Experiment.Properties.Settings> 10 <setting name="HiveServerUrl" serializeAs="String">11 <value>net.tcp://10.20.71.22:9000/ExecutionEngine/ExecutionEngineFacade</value>12 </setting>13 10 <setting name="ResourceIds" serializeAs="String"> 14 11 <value>MyGroup</value> 15 12 </setting> 13 <setting name="HiveServerIp" serializeAs="String"> 14 <value>localhost</value> 15 </setting> 16 <setting name="HiveUsername" serializeAs="String"> 17 <value>cneumueller</value> 18 </setting> 19 <setting name="HivePassword" serializeAs="String"> 20 <value>cneumueller</value> 21 </setting> 22 <setting name="HiveServerPort" serializeAs="String"> 23 <value>9000</value> 24 </setting> 16 25 </HeuristicLab.Hive.Experiment.Properties.Settings> 17 26 </userSettings> 27 <system.serviceModel> 28 29 <bindings> 30 <basicHttpBinding> 31 <binding name="ClientStreamedHttpEndpoint" closeTimeout="00:01:00" 32 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 33 allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 34 maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 35 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 36 useDefaultWebProxy="true"> 37 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 38 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 39 <security mode="None"> 40 <transport clientCredentialType="None" proxyCredentialType="None" 41 realm="" /> 42 <message clientCredentialType="UserName" algorithmSuite="Default" /> 43 </security> 44 </binding> 45 </basicHttpBinding> 46 <wsHttpBinding> 47 <binding name="ClientHttpEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 48 receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 49 transactionFlow="false" hostNameComparisonMode="StrongWildcard" 50 maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 51 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 52 allowCookies="false"> 53 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 54 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 55 <reliableSession ordered="true" inactivityTimeout="00:10:00" 56 enabled="false" /> 57 <security mode="Message"> 58 <transport clientCredentialType="Windows" proxyCredentialType="None" 59 realm="" /> 60 <message clientCredentialType="UserName" negotiateServiceCredential="true" 61 algorithmSuite="Default" /> 62 </security> 63 </binding> 64 <binding name="ClientMexEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00" 65 receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 66 transactionFlow="false" hostNameComparisonMode="StrongWildcard" 67 maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 68 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 69 allowCookies="false"> 70 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 71 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 72 <reliableSession ordered="true" inactivityTimeout="00:10:00" 73 enabled="false" /> 74 <security mode="None"> 75 <transport clientCredentialType="Windows" proxyCredentialType="None" 76 realm="" /> 77 <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 78 </security> 79 </binding> 80 </wsHttpBinding> 81 </bindings> 82 <client> 83 <endpoint address="http://localhost:9000/ClientService" behaviorConfiguration="ClientServiceBehaviour" binding="wsHttpBinding" 84 bindingConfiguration="ClientHttpEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" 85 name="ClientHttpEndpoint"> 86 <identity> 87 <certificate encodedValue="AwAAAAEAAAAUAAAAeBLH/0jWrlsW42fIC8VIIdAE6PUgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhDez3CoJIIitEZ5xwVqLJn6MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDgyMzE1NTg0OFoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmOgweB6X4Ss6W2xb2hg1x61cjD2T7SO0ckkzmtqRhC2UWly9dBnonFJmg9RjN0y6l2tZhVzNhq8DgCkn3hPg5GL3XIwYX4PsXwNmeT6i+7s6rGbESuaEMvYOAQJSJ+MTgBvXCwo2g5nFHIBqP4W4aU2eybxP7H4cm1rQpoYHHjQIDAQABo0kwRzBFBgNVHQEEPjA8gBASDhO/IE7Ff7PpkCVF8oUpoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghDez3CoJIIitEZ5xwVqLJn6MAkGBSsOAwIdBQADgYEAhxAzm3JTV7j51jti5P7izTEs7+8534kQloeAJDwlKolkd4ZMkf0BiexC2Vt1KsnxUjrK0HbbITzazkvkAmKi7dP+4G+3SrWag5lS4NcoPjTQy16T3zC9E6yafRaZp1/pxjC3Ap44qwq4Kjl2mEjeHHsdie/h4loowTqC9FlLbgo=" /> 88 </identity> 89 </endpoint> 90 <endpoint address="http://localhost:9000/ClientService/mex" binding="wsHttpBinding" 91 bindingConfiguration="ClientMexEndpoint" contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" 92 name="ClientMexEndpoint" /> 93 <endpoint address="http://localhost:9000/ClientServiceStreamed" 94 binding="basicHttpBinding" bindingConfiguration="ClientStreamedHttpEndpoint" 95 contract="HeuristicLab.Hive.Contracts.Interfaces.IClientFacade" name="ClientStreamedHttpEndpoint" /> 96 </client> 97 98 <behaviors> 99 <endpointBehaviors> 100 <behavior name="ClientServiceBehaviour"> 101 <clientCredentials> 102 <serviceCertificate> 103 <authentication certificateValidationMode="None" /> 104 </serviceCertificate> 105 </clientCredentials> 106 </behavior> 107 </endpointBehaviors> 108 </behaviors> 109 110 </system.serviceModel> 18 111 </configuration>
Note: See TracChangeset
for help on using the changeset viewer.