- Timestamp:
- 06/19/10 09:17:24 (14 years ago)
- Location:
- branches/3.2/sources
- Files:
-
- 1 added
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/sources/HeuristicLab.Hive.Client.Communication/3.2/WcfService.cs
r3578 r3931 326 326 #region Heartbeat 327 327 328 public event System.EventHandler<ProcessHeartBeatCompletedEventArgs> SendHeartBeatCompleted;329 public void SendHeartBeatAsync(HeartBeatData hbd) {328 public event System.EventHandler<ProcessHeartBeatCompletedEventArgs> ProcessHeartBeatCompleted; 329 public void ProcessHeartBeatAsync(HeartBeatData hbd) { 330 330 if (ConnState == NetworkEnum.WcfConnState.Loggedin) 331 331 Logger.Debug("STARTING: sending heartbeat"); … … 334 334 335 335 private void proxy_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) { 336 if (e.Error == null && e.Result.Success == true) {337 SendHeartBeatCompleted(sender, e);336 if (e.Error == null && e.Result.Success) { 337 ProcessHeartBeatCompleted(sender, e); 338 338 Logger.Debug("ENDED: sending heartbeats"); 339 339 } else { … … 376 376 } 377 377 378 public ResponseResultReceived S endStoredJobResultsSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) {378 public ResponseResultReceived StoreFinishedJobResultsSync(Guid clientId, Guid jobId, byte[] result, double percentage, Exception exception, bool finished) { 379 379 return proxy.StoreFinishedJobResultStreamed( 380 380 GetStreamedJobResult(clientId, jobId, result, percentage, exception)); -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/HeuristicLab.Hive.Client.Console-3.2.csproj
r3022 r3931 202 202 <None Include="Properties\DataSources\Calendar.Appointment.datasource" /> 203 203 <None Include="Resources\shutdown-icon.png" /> 204 <None Include="Service References\ClientService\Calendar.xsd" />205 <None Include="Service References\ClientService\System.Drawing.xsd" />206 204 </ItemGroup> 207 205 <ItemGroup> … … 213 211 <ItemGroup> 214 212 <None Include="Resources\exit-48.png" /> 213 <None Include="Service References\ClientService\Calendar1.xsd" /> 214 <None Include="Service References\ClientService\System.Drawing1.xsd" /> 215 215 </ItemGroup> 216 216 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/HiveClientConsole.cs
r3220 r3931 187 187 } 188 188 189 private void UpdateGraph( JobStatus[] jobs)189 private void UpdateGraph(StatusCommons sc) 190 190 { 191 191 ZedGraphControl zgc = new ZedGraphControl(); … … 208 208 double done = 0; 209 209 210 if (jobs.Length == 0) 210 211 /*if (jobs.Length == 0) 211 212 { 212 213 myPane.AddPieSlice(100, Color.Green, 0.1, ""); … … 217 218 { 218 219 allProgress += jobs[i].Progress; 219 } 220 221 done = allProgress / jobs.Length;222 223 myPane.AddPieSlice(done, Color.Green, 0, "");224 myPane.AddPieSlice(1 - done, Color.Red, 0, "");225 }220 } */ 221 222 //done = allProgress / jobs.Length; 223 224 myPane.AddPieSlice((sc.FreeCores / (double) sc.TotalCores), Color.Red, 0, ""); 225 myPane.AddPieSlice(((sc.TotalCores - sc.FreeCores) / (double)sc.TotalCores), Color.Green, 0, ""); 226 // } 226 227 //Hides the slice labels 227 228 PieItem.Default.LabelType = PieLabelType.None; … … 586 587 } 587 588 588 UpdateGraph(sc .Jobs);589 UpdateGraph(sc); 589 590 590 591 if (sc.Status == NetworkEnumWcfConnState.Connected || sc.Status == NetworkEnumWcfConnState.Loggedin) -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/HeuristicLab.Hive.Client.Core.ClientConsoleService.xsd
r1449 r3931 7 7 <xs:element minOccurs="0" name="ClientGuid" type="ser:guid" /> 8 8 <xs:element minOccurs="0" name="ConnectedSince" type="xs:dateTime" /> 9 <xs:element minOccurs="0" name="FreeCores" type="xs:int" /> 9 10 <xs:element minOccurs="0" name="Jobs" nillable="true" type="tns:ArrayOfJobStatus" /> 10 11 <xs:element minOccurs="0" name="JobsAborted" type="xs:int" /> … … 12 13 <xs:element minOccurs="0" name="JobsFetched" type="xs:int" /> 13 14 <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/HeuristicLab.Hive.Client.Common" minOccurs="0" name="Status" type="q1:NetworkEnum.WcfConnState" /> 15 <xs:element minOccurs="0" name="TotalCores" type="xs:int" /> 14 16 </xs:sequence> 15 17 </xs:complexType> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/Reference.cs
r2023 r3931 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:2.0.50727. 30824 // Runtime Version:2.0.50727.4927 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 31 31 32 32 [System.Runtime.Serialization.OptionalFieldAttribute()] 33 private int FreeCoresField; 34 35 [System.Runtime.Serialization.OptionalFieldAttribute()] 33 36 private HeuristicLab.Hive.Client.Console.ClientService.JobStatus[] JobsField; 34 37 … … 44 47 [System.Runtime.Serialization.OptionalFieldAttribute()] 45 48 private HeuristicLab.Hive.Client.Console.ClientService.NetworkEnumWcfConnState StatusField; 49 50 [System.Runtime.Serialization.OptionalFieldAttribute()] 51 private int TotalCoresField; 46 52 47 53 [global::System.ComponentModel.BrowsableAttribute(false)] … … 82 88 83 89 [System.Runtime.Serialization.DataMemberAttribute()] 90 public int FreeCores { 91 get { 92 return this.FreeCoresField; 93 } 94 set { 95 if ((this.FreeCoresField.Equals(value) != true)) { 96 this.FreeCoresField = value; 97 this.RaisePropertyChanged("FreeCores"); 98 } 99 } 100 } 101 102 [System.Runtime.Serialization.DataMemberAttribute()] 84 103 public HeuristicLab.Hive.Client.Console.ClientService.JobStatus[] Jobs { 85 104 get { … … 142 161 this.StatusField = value; 143 162 this.RaisePropertyChanged("Status"); 163 } 164 } 165 } 166 167 [System.Runtime.Serialization.DataMemberAttribute()] 168 public int TotalCores { 169 get { 170 return this.TotalCoresField; 171 } 172 set { 173 if ((this.TotalCoresField.Equals(value) != true)) { 174 this.TotalCoresField = value; 175 this.RaisePropertyChanged("TotalCores"); 144 176 } 145 177 } -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/Reference.svcmap
r2023 r3931 26 26 <MetadataFile FileName="HeuristicLab.Hive.Client.Core.ClientConsoleService.xsd" MetadataType="Schema" ID="36748734-59b6-4ba4-950d-66ca1a4fc8bb" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" /> 27 27 <MetadataFile FileName="HeuristicLab.Hive.Client.Common.xsd" MetadataType="Schema" ID="0c1369fa-d4cc-4149-b202-00da9dd35972" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" /> 28 <MetadataFile FileName="Calendar .xsd" MetadataType="Schema" ID="09fa9f67-e082-4dcb-9c41-a7a3f0fb7aef" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" />29 <MetadataFile FileName="System.Drawing .xsd" MetadataType="Schema" ID="70cfc9bf-b4a8-419b-8c1f-379c0d78f9d2" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" />28 <MetadataFile FileName="Calendar1.xsd" MetadataType="Schema" ID="5ec19e4e-fed1-451d-971e-01b8df8dcb0a" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" /> 29 <MetadataFile FileName="System.Drawing1.xsd" MetadataType="Schema" ID="2aa97a8b-a12e-47ca-8bb7-93a3404f40e5" SourceId="1" SourceUrl="net.tcp://127.0.0.1:8000/ClientConsole/mex" /> 30 30 </Metadata> 31 31 <Extensions> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/configuration.svcinfo
r2023 r3931 6 6 </bindings> 7 7 <endpoints> 8 <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IClientConsoleCommunicator" contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator"><identity><userPrincipalName value=" mse08004@fhs-hagenberg.ac.at" /></identity></Data>" digest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IClientConsoleCommunicator" contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator"><identity><userPrincipalName value="mse08004@fhs-hagenberg.ac.at" /></identity></Data>" contractName="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator" />8 <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IClientConsoleCommunicator" contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator"><identity><userPrincipalName value="semteX-PC\semteX" /></identity></Data>" digest="<?xml version="1.0" encoding="utf-16"?><Data address="net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IClientConsoleCommunicator" contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator"><identity><userPrincipalName value="semteX-PC\semteX" /></identity></Data>" contractName="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator" /> 9 9 </endpoints> 10 10 </configurationSnapshot> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/configuration91.svcinfo
r2023 r3931 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum=" LJHqHAg9UO+arib7mQMPUcNSFqQ=">2 <SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="BEhVTwOR+7957ZuwDJOXr3mn9MQ="> 3 3 <bindingConfigurations> 4 4 <bindingConfiguration bindingType="netTcpBinding" name="NetTcpBinding_IClientConsoleCommunicator"> … … 93 93 <property path="/security/transport/protectionLevel" isComplexType="false" isExplicitlyDefined="true" clrType="System.Net.Security.ProtectionLevel, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 94 94 <serializedValue>EncryptAndSign</serializedValue> 95 </property> 96 <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 97 <serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue> 98 </property> 99 <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 100 <serializedValue>Never</serializedValue> 101 </property> 102 <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 103 <serializedValue>TransportSelected</serializedValue> 104 </property> 105 <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 106 <serializedValue>(Collection)</serializedValue> 95 107 </property> 96 108 <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.MessageSecurityOverTcpElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> … … 137 149 </property> 138 150 <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 139 <serializedValue> mse08004@fhs-hagenberg.ac.at</serializedValue>151 <serializedValue>semteX-PC\semteX</serializedValue> 140 152 </property> 141 153 <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/service.wsdl
r2023 r3931 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns: soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="ClientConsoleCommunicator" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">2 <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:tns="http://tempuri.org/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="ClientConsoleCommunicator" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 3 3 <wsp:Policy wsu:Id="NetTcpBinding_IClientConsoleCommunicator_policy"> 4 4 <wsp:ExactlyOne> … … 190 190 <wsa10:Address>net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator</wsa10:Address> 191 191 <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity"> 192 <Upn> mse08004@fhs-hagenberg.ac.at</Upn>192 <Upn>semteX-PC\semteX</Upn> 193 193 </Identity> 194 194 </wsa10:EndpointReference> -
branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/app.config
r2023 r3931 27 27 enabled="false" /> 28 28 <security mode="Transport"> 29 <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" /> 29 <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"> 30 <extendedProtectionPolicy policyEnforcement="Never" /> 31 </transport> 30 32 <message clientCredentialType="Windows" /> 31 33 </security> … … 38 40 contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator"> 39 41 <identity> 40 <userPrincipalName value=" mse08004@fhs-hagenberg.ac.at" />42 <userPrincipalName value="semteX-PC\semteX" /> 41 43 </identity> 42 44 </endpoint> -
branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/ClientConsoleService/TransferObjects/StatusCommons.cs
r1132 r3931 40 40 public DateTime ConnectedSince { get; set; } 41 41 [DataMember] 42 public int TotalCores { get; set; } 43 [DataMember] 44 public int FreeCores { get; set; } 45 [DataMember] 42 46 public int JobsFetched { get; set; } 43 47 [DataMember] -
branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/ConfigurationManager/ConfigManager.cs
r3011 r3931 108 108 st.ConnectedSince = WcfService.Instance.ConnectedSince; 109 109 110 st.TotalCores = hardwareInfo.NrOfCores; 111 st.FreeCores = hardwareInfo.NrOfCores - GetUsedCores(); 112 110 113 st.JobsAborted = ClientStatusInfo.JobsAborted; 111 114 st.JobsDone = ClientStatusInfo.JobsProcessed; -
branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs
r3578 r3931 259 259 lock (engines) { 260 260 appDomains[jId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException); 261 262 //Disposing it 263 engines[jId].Dispose(); 264 261 265 AppDomain.Unload(appDomains[jId]); 262 266 Logger.Debug("Unloaded appdomain"); … … 478 482 lock (engines) { 479 483 try { 484 engines[id].Dispose(); 480 485 appDomains[id].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException); 481 486 AppDomain.Unload(appDomains[id]); -
branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/Heartbeat.cs
r3578 r3931 65 65 heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed); 66 66 wcfService = WcfService.Instance; 67 wcfService. SendHeartBeatCompleted += new EventHandler<ProcessHeartBeatCompletedEventArgs>(wcfService_ProcessHeartBeatCompleted);67 wcfService.ProcessHeartBeatCompleted += new EventHandler<ProcessHeartBeatCompletedEventArgs>(wcfService_ProcessHeartBeatCompleted); 68 68 heartbeatTimer.Start(); 69 69 } … … 105 105 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) { 106 106 Logger.Debug("Sending Heartbeat: " + heartBeatData); 107 wcfService. SendHeartBeatAsync(heartBeatData);107 wcfService.ProcessHeartBeatAsync(heartBeatData); 108 108 } 109 109 } -
branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/JobStorage/JobStorageManager.cs
r3578 r3931 1 using System;1 using System; 2 2 using System.Collections.Generic; 3 3 using System.Linq; … … 51 51 byte[] job = File.ReadAllBytes(path + filename + ".dat"); 52 52 if (WcfService.Instance.IsJobStillNeeded(storedJobsList[index - 1].JobID).StatusMessage == ApplicationConstants.RESPONSE_COMMUNICATOR_SEND_JOBRESULT) { 53 ResponseResultReceived res = WcfService.Instance.S endStoredJobResultsSync(ConfigManager.Instance.GetClientInfo().Id, storedJobsList[index - 1].JobID, job, 1.00, null, true);53 ResponseResultReceived res = WcfService.Instance.StoreFinishedJobResultsSync(ConfigManager.Instance.GetClientInfo().Id, storedJobsList[index - 1].JobID, job, 1.00, null, true); 54 54 if (!res.Success) 55 55 Logger.Error("sending of job failed: " + res.StatusMessage); -
branches/3.2/sources/HeuristicLab.Hive.Client.ExecutionEngine/3.2/Executor.cs
r2108 r3931 33 33 34 34 namespace HeuristicLab.Hive.Client.ExecutionEngine { 35 public class Executor: MarshalByRefObject {35 public class Executor: MarshalByRefObject, IDisposable { 36 36 public Guid JobId { get; set; } 37 37 public IJob Job { get; set; } … … 109 109 throw new InvalidStateException("Job is still running"); 110 110 } else { 111 return SerializeJobObject(); 111 byte[] jobArr = SerializeJobObject(); 112 return jobArr; 112 113 } 113 } 114 } 114 115 115 116 … … 131 132 JobIsFinished = false; 132 133 Job = new TestJob(); 133 } 134 } 135 136 #region IDisposable Members 137 138 public void Dispose() { 139 Job.JobFailed -= new EventHandler(Job_JobFailed); 140 Job.JobFailed -= new EventHandler(Job_JobStopped); 141 Queue = null; 142 Job = null; 143 } 144 145 #endregion 134 146 } 135 147 } -
branches/3.2/sources/HeuristicLab.Hive.Contracts/3.2/ApplicationConstants.cs
r3578 r3931 29 29 public class ApplicationConstants { 30 30 31 public static System.Data.IsolationLevel ISOLATION_LEVEL = IsolationLevel.Read Committed;31 public static System.Data.IsolationLevel ISOLATION_LEVEL = IsolationLevel.ReadUncommitted; 32 32 33 33 public static System.Transactions.IsolationLevel ISOLATION_LEVEL_SCOPE = 34 System.Transactions.IsolationLevel.Read Committed;34 System.Transactions.IsolationLevel.ReadUncommitted; 35 35 public static int HEARTBEAT_MAX_DIF = 120; // value in seconds 36 36 public static int JOB_TIME_TO_LIVE = 5; -
branches/3.2/sources/HeuristicLab.Hive.Contracts/3.2/BusinessObjects/ClientDto.cs
r3203 r3931 39 39 public int NrOfFreeCores { get; set; } 40 40 [DataMember] 41 public int CpuSpeedPerCore { get; set; }41 public int? CpuSpeedPerCore { get; set; } 42 42 [DataMember] 43 43 public int Memory { get; set; } … … 45 45 public int FreeMemory { get; set; } 46 46 [DataMember] 47 public DateTime Login { get; set; }47 public DateTime? Login { get; set; } 48 48 [DataMember] 49 49 public State State { get; set; } -
branches/3.2/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientAdapter.cs
r3011 r3931 156 156 if (client != null && row != null) { 157 157 row.ResourceId = client.Id; 158 row.CPUSpeed = client.CpuSpeedPerCore;158 // row.CPUSpeed = client.CpuSpeedPerCore; 159 159 row.Memory = client.Memory; 160 row.Login = client.Login;160 // row.Login = client.Login; 161 161 if (client.State != State.nullState) 162 162 row.Status = client.State.ToString(); -
branches/3.2/sources/HeuristicLab.Hive.Server.Console/3.2/HeuristicLab.Hive.Server.Console-3.2.csproj
r3022 r3931 217 217 <Name>HeuristicLab.PluginInfrastructure</Name> 218 218 </ProjectReference> 219 <ProjectReference Include="..\..\HeuristicLab.Tracing\3.2\HeuristicLab.Tracing-3.2.csproj"> 220 <Project>{EE2034D9-6E27-48A1-B855-42D45F69A4FC}</Project> 221 <Name>HeuristicLab.Tracing-3.2</Name> 222 </ProjectReference> 219 223 </ItemGroup> 220 224 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/3.2/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs
r3578 r3931 33 33 using System.Threading; 34 34 using System.ServiceModel; 35 using HeuristicLab.Tracing; 35 36 36 37 namespace HeuristicLab.Hive.Server.ServerConsole { … … 263 264 IJobManager jobManager = 264 265 ServiceLocator.GetJobManager(); 265 jobs = jobManager.GetAllJobs(); 266 267 lvJobControl.Items.Clear(); 266 if (jobManager == null) { 267 Logger.Error("Jobmanager is null"); 268 jobs = new ResponseList<JobDto>(); 269 } else { 270 jobs = jobManager.GetAllJobs(); 271 } 272 273 274 if (lvJobControl != null) lvJobControl.Items.Clear(); 268 275 269 276 ListViewGroup lvJobCalculating = new ListViewGroup("calculating", HorizontalAlignment.Left); … … 311 318 } 312 319 catch (Exception ex) { 320 Logger.Error(ex); 313 321 closeFormEvent(true, true); 314 322 this.Close(); … … 790 798 } 791 799 792 private int CapacityRam(int noCores, int freeCores) { 800 private int CapacityRam(int noCores, int freeCores) { 793 801 if (noCores > 0) { 794 802 int capacity = ((noCores - freeCores) / noCores) * 100; -
branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r3578 r3931 120 120 Logger.Info("Client timed out and is on RESET"); 121 121 foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) { 122 jobManager.ResetJobsDependingOnResults(job);122 DaoLocator.JobDao.SetJobOffline(job); 123 123 lock (newAssignedJobs) { 124 124 if (newAssignedJobs.ContainsKey(job.Id)) … … 149 149 lastHeartbeats.Remove(client.Id); 150 150 foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) { 151 jobManager.ResetJobsDependingOnResults(job);151 DaoLocator.JobDao.SetJobOffline(job); 152 152 } 153 153 heartbeatLock.ExitWriteLock(); … … 428 428 JobDto job2Calculate = scheduler.GetNextJobForClient(clientId); 429 429 if (job2Calculate != null) { 430 response.Job = job2Calculate; 430 response.Job = job2Calculate; 431 431 response.Job.PluginsNeeded = DaoLocator.PluginInfoDao.GetPluginDependenciesForJob(response.Job); 432 432 response.Success = true; … … 481 481 482 482 if (response.Success) { 483 jobStream = DaoLocator.JobDao.GetSerializedJobStream(result.JobId); 484 483 Logger.Debug("Trying to aquire WCF Job Stream"); 484 //jobStream = DaoLocator.JobDao.GetSerializedJobStream(result.JobId); 485 //Logger.Debug("Job Stream Aquired"); 485 486 byte[] buffer = new byte[3024]; 487 List<byte> serializedJob = new List<byte>(); 486 488 int read = 0; 487 while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) { 488 jobStream.Write(buffer, 0, read); 489 } 490 jobStream.Close(); 489 int i = 0; 490 while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) { 491 for (int j = 0; j < read; j++) { 492 serializedJob.Add(buffer[j]); 493 } 494 if (i% 100 == 0) 495 Logger.Debug("Writing to stream: " + i); 496 //jobStream.Write(buffer, 0, read); 497 i++; 498 } 499 Logger.Debug("Done Writing, closing the stream!"); 500 //jobStream.Close(); 501 502 DaoLocator.JobDao.SetBinaryJobFile(result.JobId, serializedJob.ToArray()); 491 503 } 492 504 Logger.Info("END Job received for Storage:"); 505 stream.Dispose(); 493 506 return response; 494 507 } … … 656 669 foreach (JobDto job in jobsOfClient) { 657 670 if (job.State != State.finished) 658 jobManager.ResetJobsDependingOnResults(job);671 DaoLocator.JobDao.SetJobOffline(job); 659 672 } 660 673 } -
branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/ClientFacade.cs
r3220 r3931 114 114 IJobManager jobManager = 115 115 ServiceLocator.GetJobManager(); 116 116 IInternalJobManager internalJobManager = (IInternalJobManager) jobManager; 117 117 118 //second stream the job binary data 118 119 MemoryStream memoryStream = new MemoryStream(); 119 120 if(job.Job != null) 120 stream.AddStream( 121 ((IInternalJobManager) (jobManager)). 122 GetJobStreamById( 123 job.Job.Id)); 121 stream.AddStream(new MemoryStream(internalJobManager.GetSerializedJobDataById(job.Job.Id))); 124 122 125 123 OperationContext clientContext = OperationContext.Current; -
branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/DbTestApp.cs
r3220 r3931 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 21 20 22 #endregion 21 23 … … 37 39 using HeuristicLab.Hive.Server.LINQDataAccess; 38 40 using System.Transactions; 41 using System.Threading; 42 using HeuristicLab.Tracing; 39 43 40 44 namespace HeuristicLab.Hive.Server { 41 45 [Application("Hive DB Test App", "Test Application for the Hive DataAccess Layer")] 42 class HiveDbTestApplication : ApplicationBase {46 internal class HiveDbTestApplication : ApplicationBase { 43 47 /*private void TestJobStreaming() { 44 48 ISessionFactory factory = … … 111 115 } */ 112 116 113 ClientDao clientDao = new ClientDao(); 114 ClientGroupDao cgd = new ClientGroupDao(); 115 116 private void TestLINQImplementation() { 117 118 117 private ClientDao clientDao = new ClientDao(); 118 private ClientGroupDao cgd = new ClientGroupDao(); 119 120 private void TestLINQImplementation() { 119 121 ClientDto c1 = new ClientDto(); 120 122 c1.Id = Guid.NewGuid(); … … 143 145 c2 = clientDao.Insert(c2); 144 146 145 //ClientDto info2 = clientDao.FindById(info.Id);146 //Console.WriteLine(info2);147 148 147 ClientGroupDto tg = new ClientGroupDto(); 149 148 tg.Name = "TopGroup"; … … 174 173 175 174 List<ClientGroupDto> list = new List<ClientGroupDto>(cgd.FindAllWithSubGroupsAndClients()); 176 175 177 176 cgd.RemoveRessourceFromClientGroup(sg.Id, tg.Id); 178 177 … … 181 180 clientDao.Delete(c1); 182 181 clientDao.Delete(c2); 183 184 182 } 185 183 … … 220 218 sg = cgd.Insert(sg); 221 219 cgd.AddRessourceToClientGroup(sg.Id, mg.Id); 222 populateMainGroup(sg, p-1); 223 } 224 225 226 } 227 220 populateMainGroup(sg, p - 1); 221 } 222 } 228 223 229 224 … … 235 230 //TestJobResultDeserialization(); 236 231 232 //if (ContextFactory.Context.DatabaseExists()) 233 // ContextFactory.Context.DeleteDatabase(); 234 //ContextFactory.Context.CreateDatabase(); 237 235 //TestLINQImplementation(); 236 TestLinqFileHandling(); 238 237 //StressTest(); 239 238 240 239 //SpeedTest(); 241 240 //TestJobBytearrFetching(); 242 TestJobStreamFetching(); 243 244 } 245 246 private void TestJobStreamFetching() { 241 //TestJobStreamFetching(); 242 } 243 244 private void WriteToJobWithByte(object jobid) { 245 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, 246 new TransactionOptions 247 {IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE}) 248 ) { 249 Logger.Info("starting bytestuff for job " + jobid); 250 DaoLocator.JobDao.SetBinaryJobFile((Guid)jobid, jobmap[(Guid)jobid]); 251 scope.Complete(); 252 Logger.Info("ended bytestuff for job " + jobid); 253 } 254 } 255 256 private void UpdateJobStatus(object jobid) { 257 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, 258 new TransactionOptions 259 {IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE}) 260 ) { 261 Thread.Sleep(1500); 262 Logger.Info("starting now"); 263 JobDto job = DaoLocator.JobDao.FindById((Guid)jobid); 264 job.Percentage = new Random().NextDouble(); 265 DaoLocator.JobDao.Update(job); 266 scope.Complete(); 267 Logger.Info("ended"); 268 } 269 } 270 271 Dictionary<Guid, byte[]> jobmap = new Dictionary<Guid, byte[]>(); 272 273 274 private void TestLinqFileHandling() { 275 List<Thread> jobupdateThreads = new List<Thread>(); 276 List<Thread> jobProgressThreads = new List<Thread>(); 277 278 Random r = new Random(); 279 Stack<JobDto> jobs = new Stack<JobDto>(DaoLocator.JobDao.FindAll()); 280 Logger.Info("Fetched jobs"); 281 for (int x = 0; x < 10 && jobs.Count > 0; x++ ) { 282 Logger.Info("Creating data for Job"); 283 JobDto job = jobs.Pop(); 284 byte[] jobarr = new byte[50*1024*1024]; 285 for (int i = 0; i < jobarr.Length; i++) { 286 jobarr[i] = (byte) r.Next(255); 287 } 288 jobmap.Add(job.Id, jobarr); 289 } 290 Logger.Info("filled"); 291 foreach(KeyValuePair<Guid, byte[]> kvp in jobmap) { 292 Thread tjob = new Thread(new ParameterizedThreadStart(WriteToJobWithByte)); 293 Thread tupdate = new Thread(new ParameterizedThreadStart(UpdateJobStatus)); 294 jobupdateThreads.Add(tupdate); 295 jobProgressThreads.Add(tjob); 296 tupdate.Start(kvp.Key); 297 tjob.Start(kvp.Key); 298 } 299 foreach (Thread t in jobupdateThreads) { 300 t.Join(); 301 } 302 foreach (Thread t in jobProgressThreads) { 303 t.Join(); 304 } 305 } 306 307 308 private 309 void TestJobStreamFetching() { 247 310 //using (TransactionScope scope = new TransactionScope()) { 311 248 312 HiveDataContext context = ContextFactory.Context; 249 313 250 ContextFactory.Context.Connection.Open(); 251 ContextFactory.Context.Transaction = ContextFactory.Context.Connection.BeginTransaction(); 252 314 ContextFactory.Context.Connection.Open 315 (); 316 ContextFactory.Context.Transaction 317 = 318 ContextFactory.Context.Connection.BeginTransaction 319 (); 320 321 253 322 ClientFacade facade = new ClientFacade(); 323 254 324 Stream stream = facade.SendStreamedJob(new Guid("F5CFB334-66A0-417C-A585-71711BA21D3F")); 255 325 326 256 327 byte[] buffer = new byte[3024]; 328 257 329 int read = 0; 258 259 while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) {} 260 261 stream.Close(); 330 331 while (( 332 read 333 = 334 stream.Read 335 ( 336 buffer 337 , 0, 338 buffer.Length 339 )) > 0) {} 340 341 stream.Close 342 (); 262 343 263 344 //Stream stream = DaoLocator.JobDao.GetSerializedJobStream(new Guid("bbb51f87-4e2f-4499-a9b6-884e589c78b6")); … … 265 346 } 266 347 267 private void TestJobBytearrFetching() { 348 private 349 void TestJobBytearrFetching() { 268 350 byte[] arr = DaoLocator.JobDao.GetBinaryJobFile(new Guid("A3386907-2B3C-4976-BE07-04D660D40A5B")); 269 Console.WriteLine(arr); 270 } 271 272 private void SpeedTest() { 351 Console.WriteLine 352 ( 353 arr 354 ); 355 } 356 357 private 358 void SpeedTest() { 273 359 DateTime start = new DateTime(); 360 274 361 List<ClientGroupDto> list = new List<ClientGroupDto>(cgd.FindAllWithSubGroupsAndClients()); 362 275 363 DateTime end = new DateTime(); 364 276 365 TimeSpan used = end - start; 277 Console.WriteLine(used.TotalMilliseconds); 278 } 279 280 366 Console.WriteLine 367 ( 368 used.TotalMilliseconds 369 ); 370 } 281 371 } 282 372 } -
branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/InternalInterfaces/IInternalJobManager.cs
r3011 r3931 28 28 29 29 namespace HeuristicLab.Hive.Server.Core.InternalInterfaces { 30 interface IInternalJobManager { 31 void ResetJobsDependingOnResults(JobDto job); 32 30 interface IInternalJobManager { 33 31 Stream GetJobStreamById(Guid jobId); 32 byte[] GetSerializedJobDataById(Guid jobId); 33 void SetSerializedJobDataById(Guid jobId, byte[] data); 34 34 } 35 35 } -
branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs
r3578 r3931 1 1 #region License Information 2 2 3 /* HeuristicLab 3 4 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 18 19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 20 */ 21 20 22 #endregion 21 23 … … 38 40 39 41 namespace HeuristicLab.Hive.Server.Core { 40 class JobManager: IJobManager, IInternalJobManager { 41 42 internal class JobManager : IJobManager, IInternalJobManager { 42 43 //ISessionFactory factory; 43 ILifecycleManager lifecycleManager;44 private ILifecycleManager lifecycleManager; 44 45 45 46 #region IJobManager Members … … 53 54 } 54 55 55 private JobDto GetLastJobResult(Guid jobId) { 56 private JobDto GetLastJobResult(Guid jobId) { 56 57 return DaoLocator.JobDao.FindById(jobId); 57 58 } 58 59 59 public void ResetJobsDependingOnResults(JobDto job) { 60 Logger.Info("Setting job " + job.Id + " offline"); 61 if (job != null) { 62 DaoLocator.JobDao.SetJobOffline(job); 63 } 64 } 65 66 67 void checkForDeadJobs() { 60 61 private void checkForDeadJobs() { 68 62 Logger.Info("Searching for dead Jobs"); 69 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 63 using ( 64 TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, 65 new TransactionOptions 66 {IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE})) { 70 67 List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll()); 71 68 foreach (JobDto curJob in allJobs) { 72 if (curJob.State != State.calculating ) {73 ResetJobsDependingOnResults(curJob);69 if (curJob.State != State.calculating && curJob.State != State.finished) { 70 DaoLocator.JobDao.SetJobOffline(curJob); 74 71 } 75 72 } … … 79 76 } 80 77 81 void lifecycleManager_OnStartup(object sender, EventArgs e) { 78 private void lifecycleManager_OnStartup(object sender, EventArgs e) { 79 Logger.Info("Startup Event Fired, Checking DB for consistency"); 82 80 checkForDeadJobs(); 83 } 84 85 void lifecycleManager_OnShutdown(object sender, EventArgs e) { 81 Logger.Info("Startup Event Done"); 82 } 83 84 private void lifecycleManager_OnShutdown(object sender, EventArgs e) { 85 Logger.Info("Startup Event Fired, Checking DB for consistency"); 86 86 checkForDeadJobs(); 87 Logger.Info("Startup Event Done"); 87 88 } 88 89 … … 92 93 /// <returns></returns> 93 94 public ResponseList<JobDto> GetAllJobs() { 94 95 96 97 98 99 100 95 ResponseList<JobDto> response = new ResponseList<JobDto>(); 96 97 response.List = new List<JobDto>(DaoLocator.JobDao.FindAll()); 98 response.Success = true; 99 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ALL_JOBS; 100 101 return response; 101 102 } 102 103 … … 105 106 response.List = new List<JobDto>(DaoLocator.JobDao.FindWithLimitations(jobState, offset, count)); 106 107 return response; 107 } 108 } 108 109 109 110 /// <summary> … … 112 113 /// <param name="jobId"></param> 113 114 /// <returns></returns> 114 public Stream GetJobStreamById(Guid jobId) { 115 public Stream GetJobStreamById(Guid jobId) { 115 116 return DaoLocator.JobDao.GetSerializedJobStream(jobId); 116 117 117 } 118 118 … … 122 122 /// <returns></returns> 123 123 public ResponseObject<JobDto> GetJobById(Guid jobId) { 124 124 ResponseObject<JobDto> response = new ResponseObject<JobDto>(); 125 125 126 126 response.Obj = DaoLocator.JobDao.FindById(jobId); 127 if (response.Obj != null) { 128 response.Success = true; 129 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_GET_JOB_BY_ID; 130 } else { 131 response.Success = false; 132 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 133 } 134 135 return response; 136 } 127 if (response.Obj != null) { 128 response.Success = true; 129 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_GET_JOB_BY_ID; 130 } 131 else { 132 response.Success = false; 133 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 134 } 135 136 return response; 137 } 137 138 138 139 public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) { … … 144 145 145 146 job.Obj.Client = DaoLocator.ClientDao.GetClientForJob(jobId); 146 } else { 147 } 148 else { 147 149 job.Success = false; 148 150 job.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 149 } 151 } 150 152 return job; 151 153 } … … 154 156 IClientGroupDao cgd = DaoLocator.ClientGroupDao; 155 157 foreach (string res in resources) { 156 foreach (ClientGroupDto cg in cgd.FindByName(res)) {158 foreach (ClientGroupDto cg in cgd.FindByName(res)) { 157 159 job.JobInfo.AssignedResourceIds.Add(cg.Id); 158 160 } … … 167 169 /// <returns></returns> 168 170 public ResponseObject<JobDto> AddNewJob(SerializedJob job) { 169 ResponseObject<JobDto> response = new ResponseObject<JobDto>(); 170 171 if (job != null && job.JobInfo != null) { 172 if (job.JobInfo.State != State.offline) { 173 response.Success = false; 174 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE; 175 return response; 176 } 177 if (job.JobInfo.Id != Guid.Empty) { 178 response.Success = false; 179 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ID_MUST_NOT_BE_SET; 180 return response; 181 } 182 if (job.SerializedJobData == null) { 183 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_NULL; 184 response.Success = false; 185 return response; 186 } 187 188 job.JobInfo.DateCreated = DateTime.Now; 189 DaoLocator.JobDao.InsertWithAttachedJob(job); 190 DaoLocator.PluginInfoDao.InsertPluginDependenciesForJob(job.JobInfo); 191 192 response.Success = true; 193 response.Obj = job.JobInfo; 194 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_ADDED; 195 } else { 171 ResponseObject<JobDto> response = new ResponseObject<JobDto>(); 172 173 if (job != null && job.JobInfo != null) { 174 if (job.JobInfo.State != State.offline) { 196 175 response.Success = false; 176 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOBSTATE_MUST_BE_OFFLINE; 177 return response; 178 } 179 if (job.JobInfo.Id != Guid.Empty) { 180 response.Success = false; 181 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ID_MUST_NOT_BE_SET; 182 return response; 183 } 184 if (job.SerializedJobData == null) { 197 185 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_NULL; 198 } 199 186 response.Success = false; 187 return response; 188 } 189 190 job.JobInfo.DateCreated = DateTime.Now; 191 DaoLocator.JobDao.InsertWithAttachedJob(job); 192 DaoLocator.PluginInfoDao.InsertPluginDependenciesForJob(job.JobInfo); 193 194 response.Success = true; 195 response.Obj = job.JobInfo; 196 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_ADDED; 197 } 198 else { 199 response.Success = false; 200 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_NULL; 201 } 202 203 return response; 204 } 205 206 /// <summary> 207 /// Removes a job from the database 208 /// </summary> 209 /// <param name="jobId"></param> 210 /// <returns></returns> 211 public Response RemoveJob(Guid jobId) { 212 Response response = new Response(); 213 214 JobDto job = DaoLocator.JobDao.FindById(jobId); 215 if (job == null) { 216 response.Success = false; 217 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 200 218 return response; 201 219 } 202 /* finally { 203 if (session != null) 204 session.EndSession(); 205 } 206 } */ 207 208 /// <summary> 209 /// Removes a job from the database 210 /// </summary> 211 /// <param name="jobId"></param> 212 /// <returns></returns> 213 public Response RemoveJob(Guid jobId) { 214 Response response = new Response(); 215 216 JobDto job = DaoLocator.JobDao.FindById(jobId); 217 if (job == null) { 218 response.Success = false; 219 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 220 return response; 221 } 222 DaoLocator.JobDao.Delete(job); 223 response.Success = false; 224 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_REMOVED; 225 226 return response; 227 } 220 DaoLocator.JobDao.Delete(job); 221 response.Success = false; 222 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_REMOVED; 223 224 return response; 225 } 228 226 229 227 public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { … … 231 229 new ResponseObject<JobDto>(); 232 230 233 234 235 236 237 238 231 result.Obj = 232 GetLastJobResult(jobId); 233 result.Success = 234 result.Obj != null; 235 236 return result; 239 237 } 240 238 241 239 public ResponseObject<SerializedJob> 242 240 GetLastSerializedJobResultOf(Guid jobId, bool requested) { 243 244 ResponseObject<SerializedJob> response = 245 new ResponseObject<SerializedJob>(); 241 ResponseObject<SerializedJob> response = 242 new ResponseObject<SerializedJob>(); 246 243 247 244 JobDto job = DaoLocator.JobDao.FindById(jobId); 248 if (requested && (job.State == State.requestSnapshot || job.State == State.requestSnapshotSent)) { 249 response.Success = true; 250 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; 251 252 //tx.Commit(); 253 254 return response; 255 } 256 257 /*JobResult lastResult = 258 jobResultsAdapter.GetLastResultOf(job.Id);*/ 259 260 //if (lastResult != null) { 261 response.Success = true; 262 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT; 263 response.Obj = new SerializedJob(); 264 response.Obj.JobInfo = job; 265 response.Obj.SerializedJobData = 266 DaoLocator.JobDao.GetBinaryJobFile(jobId); 267 //} else { 268 // response.Success = false; 269 //} 270 271 //tx.Commit(); 245 if (requested && (job.State == State.requestSnapshot || job.State == State.requestSnapshotSent)) { 246 response.Success = true; 247 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE; 248 272 249 return response; 273 250 } 274 /*catch (Exception ex) { 275 if (tx != null) 276 tx.Rollback(); 277 throw ex; 278 } 279 finally { 280 if (session != null) 281 session.EndSession(); 282 } 283 } */ 251 252 response.Success = true; 253 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT; 254 response.Obj = new SerializedJob(); 255 response.Obj.JobInfo = job; 256 response.Obj.SerializedJobData = 257 DaoLocator.JobDao.GetBinaryJobFile(jobId); 258 return response; 259 } 284 260 285 261 286 262 public Response RequestSnapshot(Guid jobId) { 287 // ISession session = factory.GetSessionForCurrentThread();288 263 Response response = new Response(); 289 290 /* try { 291 IJobAdapter jobAdapter = session.GetDataAdapter<JobDto, IJobAdapter>();*/ 292 293 JobDto job = DaoLocator.JobDao.FindById(jobId); 294 if (job.State == State.requestSnapshot || job.State == State.requestSnapshotSent) { 295 response.Success = true; 296 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET; 297 return response; // no commit needed 298 } 299 if (job.State != State.calculating) { 300 response.Success = false; 301 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 302 return response; // no commit needed 303 } 304 // job is in correct state 305 job.State = State.requestSnapshot; 306 DaoLocator.JobDao.Update(job); 307 308 response.Success = true; 309 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_SET; 310 264 265 266 JobDto job = DaoLocator.JobDao.FindById(jobId); 267 if (job.State == State.requestSnapshot || job.State == State.requestSnapshotSent) { 268 response.Success = true; 269 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_ALLREADY_SET; 311 270 return response; 312 271 } 313 /* finally { 314 if (session != null) 315 session.EndSession(); 316 } 317 } */ 272 if (job.State != State.calculating) { 273 response.Success = false; 274 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 275 return response; 276 } 277 // job is in correct state 278 job.State = State.requestSnapshot; 279 DaoLocator.JobDao.Update(job); 280 281 response.Success = true; 282 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_REQUEST_SET; 283 284 return response; 285 } 318 286 319 287 public Response AbortJob(Guid jobId) { 320 //ISession session = factory.GetSessionForCurrentThread();321 288 Response response = new Response(); 322 289 323 /* try {324 IJobAdapter jobAdapter = session.GetDataAdapter<JobDto, IJobAdapter>();*/325 326 // JobDto job = jobAdapter.GetById(jobId);327 290 JobDto job = DaoLocator.JobDao.FindById(jobId); 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 291 if (job == null) { 292 response.Success = false; 293 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 294 return response; // no commit needed 295 } 296 if (job.State == State.abort) { 297 response.Success = true; 298 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_ALLREADY_SET; 299 return response; // no commit needed 300 } 301 if (job.State != State.calculating && job.State != State.requestSnapshot && job.State != State.requestSnapshotSent) { 302 response.Success = false; 303 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED; 304 return response; // no commit needed 305 } 306 // job is in correct state 307 job.State = State.abort; 345 308 DaoLocator.JobDao.Update(job); 346 309 347 response.Success = true; 348 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_SET; 349 350 return response; 351 } 352 /*finally { 353 if (session != null) 354 session.EndSession(); 355 } 356 } */ 310 response.Success = true; 311 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_SET; 312 313 return response; 314 } 357 315 358 316 public ResponseList<JobResult> GetAllJobResults(Guid jobId) { … … 381 339 382 340 public ResponseList<JobDto> GetJobsByProject(Guid projectId) { 383 return null; 384 } 341 return null; 342 } 343 344 public byte[] GetSerializedJobDataById(Guid jobId) { 345 return DaoLocator.JobDao.GetBinaryJobFile(jobId); 346 } 347 348 public void SetSerializedJobDataById(Guid jobId, byte[] data) { 349 DaoLocator.JobDao.SetBinaryJobFile(jobId, data); 350 } 351 385 352 #endregion 386 353 } -
branches/3.2/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IJobDao.cs
r3578 r3931 23 23 24 24 IEnumerable<JobDto> FindWithLimitations(State jobState, int offset, int count); 25 26 void SetBinaryJobFile(Guid jobId, byte[] data); 25 27 } 26 28 } -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/BaseDao.cs
r3578 r3931 15 15 16 16 protected void CommitChanges() { 17 //TODO: DoWhile 17 18 try { 18 19 Context.SubmitChanges(ConflictMode.ContinueOnConflict); 19 20 } catch (ChangeConflictException e) { 20 21 Logger.Warn("Concurrency Exception! " + e.Message); 21 foreach (ObjectChangeConflict conflict in Context.ChangeConflicts) { 22 foreach (ObjectChangeConflict conflict in Context.ChangeConflicts) { 23 Logger.Info("Conflicted: "); 24 foreach (MemberChangeConflict memberChangeConflict in conflict.MemberConflicts) { 25 Logger.Info(" Member in Conflict: " + memberChangeConflict.Member.Name); 26 Logger.Info(" Database Value: " + memberChangeConflict.DatabaseValue); 27 Logger.Info(" Original value: " + memberChangeConflict.OriginalValue); 28 Logger.Info(" Current value: " + memberChangeConflict.CurrentValue); 29 } 22 30 conflict.Resolve(RefreshMode.KeepChanges); 23 31 } 32 Context.SubmitChanges(ConflictMode.FailOnFirstConflict); 24 33 } 25 34 } -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientDao.cs
r3578 r3931 14 14 15 15 public ClientDto FindById(Guid id) { 16 return (from client in Context. Clients16 return (from client in Context.Resources.OfType<Client>() 17 17 where client.ResourceId.Equals(id) 18 18 select EntityToDto(client, null) … … 21 21 22 22 public IEnumerable<ClientDto> FindAll() { 23 return (from client in Context. Clients23 return (from client in Context.Resources.OfType<Client>() 24 24 select 25 25 EntityToDto(client, null) … … 28 28 29 29 public IEnumerable<ClientDto> FindAllClientsWithoutGroup() { 30 return (from client in Context. Clients31 where client. Resource.ClientGroup_Resources.Count == 030 return (from client in Context.Resources.OfType<Client>() 31 where client.ClientGroup_Resources_Parents.Count == 0 32 32 select EntityToDto(client, null)).ToList(); 33 33 } … … 40 40 41 41 public void SetServerSideCalendar(ClientDto client, Guid clientGroupId) { 42 Client dbclient = Context. Clients.SingleOrDefault(c => c.ResourceId.Equals(client.Id));42 Client dbclient = Context.Resources.OfType<Client>().SingleOrDefault(c => c.ResourceId.Equals(client.Id)); 43 43 dbclient.UseCalendarFromResourceId = clientGroupId; 44 44 dbclient.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), CalendarState.Fetch); … … 48 48 public ClientDto Insert(ClientDto info) { 49 49 Client c = DtoToEntity(info, null); 50 Context. Clients.InsertOnSubmit(c);50 Context.Resources.InsertOnSubmit(c); 51 51 CommitChanges(); 52 52 info.Id = c.ResourceId; … … 62 62 63 63 public void Update(ClientDto info) { 64 Client client = Context. Clients.SingleOrDefault(c => c.ResourceId.Equals(info.Id));64 Client client = Context.Resources.OfType<Client>().SingleOrDefault(c => c.ResourceId.Equals(info.Id)); 65 65 DtoToEntity(info, client); 66 66 CommitChanges(); … … 75 75 target.CPUSpeed = source.CpuSpeedPerCore; 76 76 77 if(target.Resource == null)78 target.Resource = new Resource();79 80 77 target.FreeMemory = source.FreeMemory; 81 target. Resource.Name = source.Name;82 target.Resource .ResourceId = source.Id;78 target.Name = source.Name; 79 target.ResourceId = source.Id; 83 80 target.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), source.CalendarSyncStatus); 84 81 target.Login = source.Login; … … 96 93 target = new ClientDto(); 97 94 target.CpuSpeedPerCore = source.CPUSpeed; 98 target.FreeMemory = source.FreeMemory ;95 target.FreeMemory = source.FreeMemory ?? 0; 99 96 target.Id = source.ResourceId; 100 97 target.CalendarSyncStatus = (CalendarState) Enum.Parse(typeof (CalendarState), source.CalendarSyncStatus); 101 98 target.Login = source.Login; 102 target.Memory = source.Memory ;103 target.Name = source. Resource.Name;104 target.NrOfCores = source.NumberOfCores ;105 target.NrOfFreeCores = source.NumberOfFreeCores ;99 target.Memory = source.Memory ?? 0; 100 target.Name = source.Name; 101 target.NrOfCores = source.NumberOfCores ?? 0; 102 target.NrOfFreeCores = source.NumberOfFreeCores ?? 0; 106 103 target.State = (State) Enum.Parse(typeof (State), source.Status); 107 104 return target; -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientGroupDao.cs
r3578 r3931 13 13 14 14 public ClientGroupDto FindById(Guid id) { 15 return (from cc in Context. ClientGroups15 return (from cc in Context.Resources.OfType<ClientGroup>() 16 16 where cc.ResourceId.Equals(id) 17 17 select EntityToDto(cc, null)).SingleOrDefault(); … … 20 20 21 21 public IEnumerable<ClientGroupDto> FindAll() { 22 return (from cc in Context. ClientGroups22 return (from cc in Context.Resources.OfType<ClientGroup>() 23 23 select EntityToDto(cc, null)).ToList(); 24 24 } … … 30 30 31 31 ClientGroup cc = DtoToEntity(bObj, null); 32 Context. ClientGroups.InsertOnSubmit(cc);32 Context.Resources.InsertOnSubmit(cc); 33 33 CommitChanges(); 34 34 bObj.Id = cc.ResourceId; … … 48 48 49 49 public void Update(ClientGroupDto bObj) { 50 ClientGroup client = Context. ClientGroups.SingleOrDefault(c => c.ResourceId.Equals(bObj.Id));50 ClientGroup client = Context.Resources.OfType<ClientGroup>().SingleOrDefault(c => c.ResourceId.Equals(bObj.Id)); 51 51 DtoToEntity(bObj, client); 52 52 CommitChanges(); … … 54 54 55 55 public void AddRessourceToClientGroup(Guid resource, Guid clientGroupId) { 56 ClientGroup cg = Context. ClientGroups.SingleOrDefault(c => c.ResourceId.Equals(clientGroupId));56 ClientGroup cg = Context.Resources.OfType<ClientGroup>().SingleOrDefault(c => c.ResourceId.Equals(clientGroupId)); 57 57 Resource res = Context.Resources.SingleOrDefault(r => r.ResourceId.Equals(resource)); 58 cg.ClientGroup_Resources .Add(new ClientGroup_Resource { ClientGroup = cg, Resource = res });58 cg.ClientGroup_Resources_Children.Add(new ClientGroup_Resource { ClientGroup = cg, Resource = res }); 59 59 CommitChanges(); 60 60 } … … 77 77 List<ClientGroupDto> groupList = new List<ClientGroupDto>(); 78 78 79 var q = (from cg in Context. ClientGroups79 var q = (from cg in Context.Resources.OfType<ClientGroup>() 80 80 where !Context.ClientGroup_Resources.Any(cgr => cgr.ResourceId.Equals(cg.ResourceId)) 81 81 select cg); … … 84 84 ClientGroupDto cgd = EntityToDto(cg, null); 85 85 groupList.Add(cgd); 86 FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources );86 FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources_Children); 87 87 } 88 88 return groupList; … … 93 93 //Get all the Groups 94 94 95 var qGroups = (from cg in Context. ClientGroups96 where cg. Resource.ClientGroup_Resources.Any(cgr => cgr.ClientGroupId.Equals(parentClientGroup.Id))95 var qGroups = (from cg in Context.Resources.OfType<ClientGroup>() 96 where cg.ClientGroup_Resources_Parents.Any(cgr => cgr.ClientGroupId.Equals(parentClientGroup.Id)) 97 97 select cg); 98 98 … … 100 100 ClientGroupDto cgd = EntityToDto(cg, null); 101 101 parentClientGroup.Resources.Add(cgd); 102 FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources );102 FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources_Children); 103 103 } 104 104 105 105 //get the clients 106 var qClients = (from cl in Context. Clients107 where cl. Resource.ClientGroup_Resources.Any(cgr => cgr.ClientGroupId.Equals(parentClientGroup.Id))106 var qClients = (from cl in Context.Resources.OfType<Client>() 107 where cl.ClientGroup_Resources_Parents.Any(cgr => cgr.ClientGroupId.Equals(parentClientGroup.Id)) 108 108 select cl); 109 109 foreach (Client client in qClients) { … … 114 114 public IEnumerable<Guid> FindAllGroupAndParentGroupIdsForClient(Guid clientId) { 115 115 List<Guid> guids = new List<Guid>(); 116 Client c = Context. Clients.SingleOrDefault(client => client.ResourceId.Equals(clientId));117 FindAllGroupAndParentGroupIdsForClientRecursive(c .Resource, guids);116 Client c = Context.Resources.OfType<Client>().SingleOrDefault(client => client.ResourceId.Equals(clientId)); 117 FindAllGroupAndParentGroupIdsForClientRecursive(c, guids); 118 118 return guids; 119 119 } 120 120 121 //Massivly error Prone 121 122 private void FindAllGroupAndParentGroupIdsForClientRecursive(Resource resource, List<Guid> guids) { 122 foreach (ClientGroup_Resource cgr in resource.ClientGroup_Resources ) {123 foreach (ClientGroup_Resource cgr in resource.ClientGroup_Resources_Parents) { 123 124 guids.Add(cgr.ClientGroupId); 124 FindAllGroupAndParentGroupIdsForClientRecursive(cgr.ClientGroup .Resource, guids);125 FindAllGroupAndParentGroupIdsForClientRecursive(cgr.ClientGroup, guids); 125 126 } 126 127 } … … 133 134 if (target == null) 134 135 target = new ClientGroup(); 135 if (target.Resource == null)136 target.Resource = new Resource();137 136 138 target. Resource.Name = source.Name;139 target.Resource .ResourceId = source.Id;137 target.Name = source.Name; 138 target.ResourceId = source.Id; 140 139 141 140 return target; … … 149 148 150 149 target.Id = source.ResourceId; 151 target.Name = source. Resource.Name;150 target.Name = source.Name; 152 151 153 152 return target; … … 155 154 156 155 public IEnumerable<ClientGroupDto> FindByName(string res) { 157 return (from cq in Context. ClientGroups158 where cq. Resource.Name == res156 return (from cq in Context.Resources.OfType<ClientGroup>() 157 where cq.Name == res 159 158 select EntityToDto(cq, null)).ToList(); 160 159 } -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ContextFactory.cs
r3578 r3931 5 5 using System.Data.Common; 6 6 using System.Data.SqlClient; 7 using HeuristicLab.Tracing; 7 8 8 9 namespace HeuristicLab.Hive.Server.LINQDataAccess { … … 16 17 public static HiveDataContext Context { 17 18 get { 18 if(_hiveDataContext == null) 19 _hiveDataContext = new HiveDataContext(); 19 if (_hiveDataContext == null) { 20 Logger.Debug("Requested new Data Context"); 21 _hiveDataContext = new HiveDataContext("Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq.Test;Integrated Security=SSPI"); 22 _hiveDataContext.CommandTimeout = 240; 23 } 20 24 return _hiveDataContext; 21 25 } … … 32 36 } 33 37 } 38 39 public static bool IsContextNull() { 40 return _hiveDataContext == null; 41 } 34 42 } 35 43 } -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj
r3578 r3931 91 91 <Compile Include="ClientGroupDao.cs" /> 92 92 <Compile Include="ContextFactory.cs" /> 93 <Compile Include="Hive.designer.cs"> 94 <AutoGen>True</AutoGen> 95 <DesignTime>True</DesignTime> 96 <DependentUpon>Hive.dbml</DependentUpon> 97 </Compile> 93 <Compile Include="HiveDataContext.cs" /> 98 94 <Compile Include="JobDao.cs" /> 99 95 <Compile Include="LINQDataAccessPlugin.cs" /> … … 109 105 </ItemGroup> 110 106 <ItemGroup> 111 <None Include="Hive.dbml">112 <Generator>MSLinqToSQLGenerator</Generator>113 <LastGenOutput>Hive.designer.cs</LastGenOutput>114 <SubType>Designer</SubType>115 </None>116 107 <None Include="HeuristicLab.snk" /> 117 108 <None Include="Properties\AssemblyInfo.frame" /> … … 144 135 <ItemGroup> 145 136 <None Include="app.config" /> 146 <None Include="Hive.dbml.layout">147 <DependentUpon>Hive.dbml</DependentUpon>148 </None>149 137 <None Include="Properties\Settings.settings"> 150 138 <Generator>SettingsSingleFileGenerator</Generator> 151 139 <LastGenOutput>Settings.Designer.cs</LastGenOutput> 152 140 </None> 141 </ItemGroup> 142 <ItemGroup> 143 <Content Include="HiveDataContext.xml" /> 153 144 </ItemGroup> 154 145 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml
r3578 r3931 78 78 <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" /> 79 79 <Association Name="Resource_Client" Member="Client" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" Cardinality="One" /> 80 <Association Name="Resource_Client1" Member="Client1" ThisKey="ResourceId" OtherKey="ResourceId" Type="Client" Cardinality="One" />81 80 </Type> 82 81 </Table> … … 133 132 <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" /> 134 133 <Association Name="Resource_Client" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" DeleteOnNull="true" /> 135 <Association Name="Resource_Client1" Member="Resource1" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />136 134 <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="ClientConfig" IsForeignKey="true" DeleteRule="SET NULL" /> 137 135 </Type> -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout
r3203 r3931 166 166 </nodes> 167 167 </associationConnector> 168 <associationConnector edgePoints="[(5.0625 : 6.94399251302083); (5.0625 : 8.25)]" fixedFrom="NotFixed" fixedTo="NotFixed">169 <AssociationMoniker Name="/HiveDataContext/Resource/Resource_Client1" />170 <nodes>171 <classShapeMoniker Id="e44e8355-4290-42f0-8b46-4473e91e504b" />172 <classShapeMoniker Id="51cb317e-413a-4e25-a9b6-e903322f0371" />173 </nodes>174 </associationConnector>175 168 <associationConnector edgePoints="[(4.75 : 12); (4.75 : 11.1747054036458)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 176 169 <AssociationMoniker Name="/HiveDataContext/ClientConfig/ClientConfig_Client" /> -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs
r3578 r3931 1512 1512 private EntityRef<Client> _Client; 1513 1513 1514 private EntityRef<Client> _Client1;1515 1516 1514 #region Extensibility Method Definitions 1517 1515 partial void OnLoaded(); … … 1531 1529 this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars)); 1532 1530 this._Client = default(EntityRef<Client>); 1533 this._Client1 = default(EntityRef<Client>);1534 1531 OnCreated(); 1535 1532 } … … 1668 1665 } 1669 1666 this.SendPropertyChanged("Client"); 1670 }1671 }1672 }1673 1674 [Association(Name="Resource_Client1", Storage="_Client1", ThisKey="ResourceId", OtherKey="ResourceId", IsUnique=true, IsForeignKey=false)]1675 public Client Client11676 {1677 get1678 {1679 return this._Client1.Entity;1680 }1681 set1682 {1683 Client previousValue = this._Client1.Entity;1684 if (((previousValue != value)1685 || (this._Client1.HasLoadedOrAssignedValue == false)))1686 {1687 this.SendPropertyChanging();1688 if ((previousValue != null))1689 {1690 this._Client1.Entity = null;1691 previousValue.Resource1 = null;1692 }1693 this._Client1.Entity = value;1694 if ((value != null))1695 {1696 value.Resource1 = this;1697 }1698 this.SendPropertyChanged("Client1");1699 1667 } 1700 1668 } … … 2620 2588 private EntityRef<Resource> _Resource; 2621 2589 2622 private EntityRef<Resource> _Resource1;2623 2624 2590 private EntityRef<ClientConfig> _ClientConfig; 2625 2591 … … 2657 2623 this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs)); 2658 2624 this._Resource = default(EntityRef<Resource>); 2659 this._Resource1 = default(EntityRef<Resource>);2660 2625 this._ClientConfig = default(EntityRef<ClientConfig>); 2661 2626 OnCreated(); … … 2950 2915 } 2951 2916 2952 [Association(Name="Resource_Client1", Storage="_Resource1", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]2953 public Resource Resource12954 {2955 get2956 {2957 return this._Resource1.Entity;2958 }2959 set2960 {2961 Resource previousValue = this._Resource1.Entity;2962 if (((previousValue != value)2963 || (this._Resource1.HasLoadedOrAssignedValue == false)))2964 {2965 this.SendPropertyChanging();2966 if ((previousValue != null))2967 {2968 this._Resource1.Entity = null;2969 previousValue.Client1 = null;2970 }2971 this._Resource1.Entity = value;2972 if ((value != null))2973 {2974 value.Client1 = this;2975 this._ResourceId = value.ResourceId;2976 }2977 else2978 {2979 this._ResourceId = default(System.Guid);2980 }2981 this.SendPropertyChanged("Resource1");2982 }2983 }2984 }2985 2986 2917 [Association(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")] 2987 2918 public ClientConfig ClientConfig -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HiveDataContext.xml
r3808 r3931 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <Database Name="HeuristicLab.Hive.Linq " Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">2 <Database Name="HeuristicLab.Hive.Linq.Test" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007"> 3 3 <Table Name="dbo.AssignedResources" Member="AssignedResources"> 4 4 <Type Name="AssignedResource"> … … 6 6 <Column Name="JobId" Member="JobId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" /> 7 7 <Column Name="AssignedRessourcesId" Member="AssignedRessourcesId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" /> 8 <Association Name="Resource_AssignedResource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" DeleteOnNull="true"IsForeignKey="true" Type="Resource"/>9 <Association Name="Job_AssignedResource" Member="Job" ThisKey="JobId" OtherKey="JobId" DeleteRule="CASCADE" DeleteOnNull="true"IsForeignKey="true" Type="Job"/>8 <Association Name="Resource_AssignedResource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" IsForeignKey="true" Type="Resource"/> 9 <Association Name="Job_AssignedResource" Member="Job" ThisKey="JobId" OtherKey="JobId" DeleteRule="CASCADE" IsForeignKey="true" Type="Job"/> 10 10 </Type> 11 11 </Table> … … 23 23 <Column Name="ClientConfigId" Member="ClientConfigId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" /> 24 24 <Column Name="UpDownTimeCalendar" Member="UpDownTimeCalendar" DbType="Xml" UpdateCheck="Never" Type="System.Xml.Linq.XElement"/> 25 <Column Name="HeartBeatIntervall" Member="HeartBeatIntervall" DbType="Int" Type="System.Int32" />25 <Column Name="HeartBeatIntervall" Member="HeartBeatIntervall" DbType="Int" Type="System.Int32" CanBeNull="true"/> 26 26 <Association Name="ClientConfig_Client" Member="Clients" ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="Client"/> 27 27 </Type> … … 30 30 <Table Name="dbo.ClientGroup_Resource" Member="ClientGroup_Resources"> 31 31 <Type Name="ClientGroup_Resource"> 32 <Column Name="ClientGroup_RessourceId" Member="ClientGroup_RessourceId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" />32 <Column Name="ClientGroup_RessourceId" Member="ClientGroup_RessourceId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" /> 33 33 <Column Name="ClientGroupId" Member="ClientGroupId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" /> 34 34 <Column Name="ResourceId" Member="ResourceId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" /> 35 35 36 36 <Association Name="ClientGroup_ClientGroup_Resource" Member="ClientGroup" ThisKey="ClientGroupId" OtherKey="ResourceId" IsForeignKey="true" Type="ClientGroup" /> 37 <Association Name="Resource_ClientGroup_Resource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" DeleteOnNull="true"IsForeignKey="true" Type="Resource"/>37 <Association Name="Resource_ClientGroup_Resource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" IsForeignKey="true" Type="Resource"/> 38 38 </Type> 39 39 </Table> … … 59 59 <Column Name="JobId" Member="JobId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" /> 60 60 <Column Name="PluginId" Member="PluginId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" /> 61 <Association Name="PluginInfo_RequiredPlugin" Member="PluginInfo" ThisKey="PluginId" OtherKey="PluginId" DeleteRule="CASCADE" DeleteOnNull="true"IsForeignKey="true" Type="PluginInfo"/>61 <Association Name="PluginInfo_RequiredPlugin" Member="PluginInfo" ThisKey="PluginId" OtherKey="PluginId" DeleteRule="CASCADE" IsForeignKey="true" Type="PluginInfo"/> 62 62 <Association Name="Job_RequiredPlugin" Member="Job" ThisKey="JobId" OtherKey="JobId" IsForeignKey="true" Type="Job"/> 63 63 </Type> … … 69 69 <Column Name="ResourceType" Member="ResourceType" IsDiscriminator="true" Type="System.String"/> 70 70 <Association Name="Resource_AssignedResource" Member="AssignedResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedResource"/> 71 <Association Name="Resource_ClientGroup_Resource" Member="ClientGroup_Resources " ThisKey="ResourceId" OtherKey="ResourceId" Type="ClientGroup_Resource" />71 <Association Name="Resource_ClientGroup_Resource" Member="ClientGroup_Resources_Parents" ThisKey="ResourceId" OtherKey="ResourceId" Type="ClientGroup_Resource" /> 72 72 <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" /> 73 73 <Type Name="Client" InheritanceCode="CLIENT" IsInheritanceDefault="true"> 74 <Column Name="CPUSpeed" Member="CPUSpeed" DbType="Int NOT NULL" Type="System.Int32"/>75 <Column Name="Memory" Member="Memory" DbType="Int NOT NULL" Type="System.Int32"/>76 <Column Name="Login" Member="Login" DbType="DateTime NOT NULL" Type="System.DateTime"/>77 <Column Name="Status" Member="Status" DbType="VarChar(MAX)" Type="System.String" />78 <Column Name="CalendarSyncStatus" Member="CalendarSyncStatus" DbType="VarChar(MAX)" Type="System.String" />79 <Column Name="UseCalendarFromResourceId" Member="UseCalendarFromResourceId" DbType="UniqueIdentifier" Type="System.Guid" />80 <Column Name="ClientConfigId" Member="ClientConfigId" DbType="UniqueIdentifier" Type="System.Guid" />81 <Column Name="NumberOfCores" Member="NumberOfCores" DbType="Int NOT NULL" Type="System.Int32"/>82 <Column Name="NumberOfFreeCores" Member="NumberOfFreeCores" DbType="Int NOT NULL" Type="System.Int32"/>83 <Column Name="FreeMemory" Member="FreeMemory" DbType="Int NOT NULL" Type="System.Int32"/>74 <Column Name="CPUSpeed" Member="CPUSpeed" DbType="Int" Type="System.Int32" CanBeNull="true"/> 75 <Column Name="Memory" Member="Memory" DbType="Int" Type="System.Int32" CanBeNull="true"/> 76 <Column Name="Login" Member="Login" DbType="DateTime" Type="System.DateTime" CanBeNull="true"/> 77 <Column Name="Status" Member="Status" DbType="VarChar(MAX)" Type="System.String" CanBeNull="true"/> 78 <Column Name="CalendarSyncStatus" Member="CalendarSyncStatus" DbType="VarChar(MAX)" Type="System.String" CanBeNull="true"/> 79 <Column Name="UseCalendarFromResourceId" Member="UseCalendarFromResourceId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/> 80 <Column Name="ClientConfigId" Member="ClientConfigId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/> 81 <Column Name="NumberOfCores" Member="NumberOfCores" DbType="Int" Type="System.Int32" CanBeNull="true"/> 82 <Column Name="NumberOfFreeCores" Member="NumberOfFreeCores" DbType="Int" Type="System.Int32" CanBeNull="true"/> 83 <Column Name="FreeMemory" Member="FreeMemory" DbType="Int" Type="System.Int32" CanBeNull="true"/> 84 84 <Association Name="Client_UptimeStatistic" Member="UptimeStatistics" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeStatistic"/> 85 <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" />85 <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" DeleteRule="SET NULL"/> 86 86 <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" DeleteRule="SET NULL" IsForeignKey="true" Type="ClientConfig"/> 87 87 </Type> 88 88 <Type Name="ClientGroup" InheritanceCode="GROUP" IsInheritanceDefault="false"> 89 <Association Name="ClientGroup_ClientGroup_Resource" Member="ClientGroup_Resources " ThisKey="ResourceId" OtherKey="ClientGroupId" Type="ClientGroup_Resource" />89 <Association Name="ClientGroup_ClientGroup_Resource" Member="ClientGroup_Resources_Children" ThisKey="ResourceId" OtherKey="ClientGroupId" Type="ClientGroup_Resource" /> 90 90 </Type> 91 91 </Type> … … 95 95 <Type Name="Job"> 96 96 <Column Name="JobId" Member="JobId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" /> 97 <Column Name="ParentJobId" Member="ParentJobId" DbType="UniqueIdentifier" Type="System.Guid" />97 <Column Name="ParentJobId" Member="ParentJobId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true" /> 98 98 <Column Name="JobState" Member="JobState" DbType="VarChar(MAX)" Type="System.String"/> 99 <Column Name="ResourceId" Member="ResourceId" DbType="UniqueIdentifier" Type="System.Guid" />100 <Column Name="Percentage" Member="Percentage" DbType="Float" Type="System.Double" />101 <Column Name="SerializedJob" Member="SerializedJob" DbType="VarBinary(MAX)" UpdateCheck="Never" Type="System.Data.Linq.Binary" />102 <Column Name="DateCreated" Member="DateCreated" DbType="DateTime" Type="System.DateTime" />103 <Column Name="DateCalculated" Member="DateCalculated" DbType="DateTime" Type="System.DateTime" />104 <Column Name="DateFinished" Member="DateFinished" DbType="DateTime" Type="System.DateTime" />99 <Column Name="ResourceId" Member="ResourceId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/> 100 <Column Name="Percentage" Member="Percentage" DbType="Float" Type="System.Double" CanBeNull="true"/> 101 <Column Name="SerializedJob" Member="SerializedJob" DbType="VarBinary(MAX)" UpdateCheck="Never" Type="System.Data.Linq.Binary" IsDelayLoaded="true"/> 102 <Column Name="DateCreated" Member="DateCreated" DbType="DateTime" Type="System.DateTime" CanBeNull="true"/> 103 <Column Name="DateCalculated" Member="DateCalculated" DbType="DateTime" Type="System.DateTime" CanBeNull="true"/> 104 <Column Name="DateFinished" Member="DateFinished" DbType="DateTime" Type="System.DateTime" CanBeNull="true"/> 105 105 <Column Name="Priority" Member="Priority" DbType="Int NOT NULL" Type="System.Int32"/> 106 <Column Name="ProjectId" Member="ProjectId" DbType="UniqueIdentifier" Type="System.Guid" />107 <Column Name="UserId" Member="UserId" DbType="UniqueIdentifier" Type="System.Guid" />106 <Column Name="ProjectId" Member="ProjectId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/> 107 <Column Name="UserId" Member="UserId" DbType="UniqueIdentifier" Type="System.Guid" CanBeNull="true"/> 108 108 <Column Name="CoresNeeded" Member="CoresNeeded" DbType="Int NOT NULL" Type="System.Int32"/> 109 109 <Column Name="MemoryNeeded" Member="MemoryNeeded" DbType="Int NOT NULL" Type="System.Int32"/> … … 125 125 <Column Name="Recurring" Member="Recurring" DbType="Bit NOT NULL" Type="System.Boolean"/> 126 126 <Column Name="RecurringId" Member="RecurringId" DbType="UniqueIdentifier" Type="System.Guid"/> 127 <Association Name="Resource_UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" DeleteOnNull="true"IsForeignKey="true" Type="Resource"/>127 <Association Name="Resource_UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" DeleteRule="CASCADE" IsForeignKey="true" Type="Resource"/> 128 128 </Type> 129 129 </Table> -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs
r3578 r3931 63 63 } 64 64 65 public void SetBinaryJobFile(Guid jobId, byte[] data) { 66 Job j = (from job in Context.Jobs 67 where job.JobId.Equals(jobId) 68 select job).SingleOrDefault(); 69 j.SerializedJob = data; 70 CommitChanges(); 71 } 72 65 73 public SerializedJob InsertWithAttachedJob(SerializedJob job) { 66 74 Job j = DtoToEntity(job.JobInfo, null); … … 121 129 122 130 public void AssignClientToJob(Guid clientId, Guid jobId) { 123 Client c = Context. Clients.SingleOrDefault(client => client.ResourceId.Equals(clientId));131 Client c = Context.Resources.OfType<Client>().SingleOrDefault(client => client.ResourceId.Equals(clientId)); 124 132 Job j = Context.Jobs.SingleOrDefault(job => job.JobId.Equals(jobId)); 125 133 c.Jobs.Add(j); -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.Designer.cs
r3578 r3931 28 28 [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] 29 29 [global::System.Configuration.DefaultSettingValueAttribute("Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=" + 30 "True ")]30 "True;MultipleActiveResultSets=True")] 31 31 public string HeuristicLab_Hive_LinqConnectionString { 32 32 get { -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.settings
r3578 r3931 6 6 <DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?> 7 7 <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 8 <ConnectionString>Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True </ConnectionString>8 <ConnectionString>Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True;MultipleActiveResultSets=True</ConnectionString> 9 9 <ProviderName>System.Data.SqlClient</ProviderName> 10 10 </SerializableConnectionString></DesignTimeValue> 11 <Value Profile="(Default)">Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True </Value>11 <Value Profile="(Default)">Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True;MultipleActiveResultSets=True</Value> 12 12 </Setting> 13 13 </Settings> -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs
r3578 r3931 99 99 100 100 public IEnumerable<AppointmentDto> GetCalendarForClient(ClientDto client) { 101 Client dbc = Context. Clients.SingleOrDefault(c => c.ResourceId.Equals(client.Id));101 Client dbc = Context.Resources.OfType<Client>().SingleOrDefault(c => c.ResourceId.Equals(client.Id)); 102 102 IList<AppointmentDto> appointments = new List<AppointmentDto>(); 103 103 if (dbc != null) { 104 104 ClientGroup cg = 105 Context. ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId));105 Context.Resources.OfType<ClientGroup>().SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId)); 106 106 //in case no plan has been set 107 107 if (cg == null) 108 if (dbc. Resource.ClientGroup_Resources.FirstOrDefault() != null)109 cg = dbc. Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;108 if (dbc.ClientGroup_Resources_Parents.FirstOrDefault() != null) 109 cg = dbc.ClientGroup_Resources_Parents.FirstOrDefault().ClientGroup; 110 110 111 111 if (cg == null) 112 112 return appointments; 113 113 114 while (cg. Resource.UptimeCalendars.Count == 0) {115 if (cg. Resource.ClientGroup_Resources.FirstOrDefault() != null)116 cg = cg. Resource.ClientGroup_Resources.FirstOrDefault().ClientGroup;114 while (cg.UptimeCalendars.Count == 0) { 115 if (cg.ClientGroup_Resources_Parents.FirstOrDefault() != null) 116 cg = cg.ClientGroup_Resources_Parents.FirstOrDefault().ClientGroup; 117 117 else { 118 118 break; … … 120 120 } 121 121 122 foreach (UptimeCalendar appointment in cg. Resource.UptimeCalendars) {122 foreach (UptimeCalendar appointment in cg.UptimeCalendars) { 123 123 appointments.Add(EntityToDto(appointment,null)); 124 124 } … … 131 131 132 132 //Get the current ClientGroup 133 ClientGroup cg = Context. ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(groupId));133 ClientGroup cg = Context.Resources.OfType<ClientGroup>().SingleOrDefault(cgroup => cgroup.ResourceId.Equals(groupId)); 134 134 if(cg == null) 135 135 return; 136 136 137 137 //Get all the affected clients 138 List<Client> clients = Context. Clients.Where(c => c.UseCalendarFromResourceId.Equals(cg.ResourceId)).ToList();138 List<Client> clients = Context.Resources.OfType<Client>().Where(c => c.UseCalendarFromResourceId.Equals(cg.ResourceId)).ToList(); 139 139 140 140 //Set new state … … 146 146 147 147 //Get all Subgroups 148 List<ClientGroup> groups = (from cg1 in Context. ClientGroups149 where cg1. Resource.ClientGroup_Resources.Any(148 List<ClientGroup> groups = (from cg1 in Context.Resources.OfType<ClientGroup>() 149 where cg1.ClientGroup_Resources_Parents.Any( 150 150 cgr => cgr.ClientGroupId.Equals(groupId)) 151 151 select cg1).ToList(); … … 154 154 //otherweise - propagate 155 155 foreach (ClientGroup cgroup in groups) { 156 if(cgroup. Resource.UptimeCalendars.Count == 0)157 NotifyClientsOfNewCalendar( groupId, forcePush);156 if(cgroup.UptimeCalendars.Count == 0) 157 NotifyClientsOfNewCalendar(cgroup.ResourceId, forcePush); 158 158 } 159 159 } -
branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/app.config
r3578 r3931 5 5 <connectionStrings> 6 6 <add name="HeuristicLab.Hive.Server.LINQDataAccess.Properties.Settings.HeuristicLab_Hive_LinqConnectionString" 7 connectionString="Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True "7 connectionString="Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True;MultipleActiveResultSets=True" 8 8 providerName="System.Data.SqlClient" /> 9 9 </connectionStrings> -
branches/3.2/sources/HeuristicLab.Hive.Server/3.2/ServiceCallInterception.cs
r3578 r3931 16 16 17 17 public object Invoke(IMethodInvocation invocation) { 18 DateTime start = DateTime.Now; 18 19 Logger.Info("Entering Method: " + invocation.Method.Name); 19 20 20 if( ContextFactory.Context != null) {21 if(!ContextFactory.IsContextNull()) { 21 22 Logger.Info("Not null context found - why wasn't this disposed?"); 22 23 try { … … 28 29 ContextFactory.Context = null; 29 30 } 30 31 Logger.Info("Context info: Timeout: " + ContextFactory.Context.Connection.ConnectionTimeout + " | " + 32 ContextFactory.Context.Connection.State + " | Conn: " + ContextFactory.Context + " | HashCode is: " + ContextFactory.Context.Connection.GetHashCode()); 31 33 Object obj = null; 32 34 33 if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) {35 /*if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) { 34 36 ContextFactory.Context.Connection.Open(); 35 37 if(UseTransactions) { … … 48 50 ContextFactory.Context = null; 49 51 } 50 } else { 52 } else { */ 51 53 if(UseTransactions) { 52 54 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { … … 57 59 } 58 60 catch (Exception e) { 59 Logger.Error("Exception occured during method invocation", e); 61 Logger.Error("Exception occured during method invocation", e); 62 Logger.Error("Inner Exception: ", e.InnerException); 60 63 } 61 64 finally { … … 80 83 } 81 84 } 85 //} 86 TimeSpan ts = DateTime.Now - start; 87 if (ts.Seconds > 2) { 88 Logger.Warn("Invocation took: " + ts); 89 } else if (ts.Seconds > 10) { 90 Logger.Error("Invocation took: " + ts); 91 } else { 92 Logger.Info("Invocation took: " + ts); ; 82 93 } 83 94 Logger.Info("Leaving Method: " + invocation.Method.Name); 84 95 85 96 return obj; 86 97 } -
branches/3.2/sources/HeuristicLab.Tracing/3.2/HeuristicLab.Hive.log4net.xml
r3578 r3931 6 6 <rollingStyle value="Size" /> 7 7 <maxSizeRollBackups value="10" /> 8 <maximumFileSize value="100 0KB" />8 <maximumFileSize value="100MB" /> 9 9 <staticLogFileName value="true" /> 10 10 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> 11 11 <layout type="HeuristicLab.Tracing.MethodCallPatternLayout, HeuristicLab.Tracing-3.2"> 12 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level % logger.%RM - %message%newline%exception" />12 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level %-5thread %logger.%RM - %message%newline%exception" /> 13 13 </layout> 14 14 </appender> … … 19 19 <rollingStyle value="Size" /> 20 20 <maxSizeRollBackups value="10" /> 21 <maximumFileSize value="100 0KB" />21 <maximumFileSize value="100MB" /> 22 22 <staticLogFileName value="true" /> 23 23 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> 24 24 <layout type="HeuristicLab.Tracing.MethodCallPatternLayout, HeuristicLab.Tracing-3.2"> 25 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level % logger.%RM - %message%newline%exception" />25 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level %-5thread %logger.%RM - %message%newline%exception" /> 26 26 </layout> 27 27 </appender> … … 32 32 <rollingStyle value="Size" /> 33 33 <maxSizeRollBackups value="10" /> 34 <maximumFileSize value="100 0KB" />34 <maximumFileSize value="100MB" /> 35 35 <staticLogFileName value="true" /> 36 36 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> 37 37 <layout type="HeuristicLab.Tracing.MethodCallPatternLayout, HeuristicLab.Tracing-3.2"> 38 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level % logger.%RM - %message%newline%exception" />38 <conversionPattern value="%date{yyyy-MM-dd HH:mm:ss.ffff} %-4timestamp %-5level %-5thread %logger.%RM - %message%newline%exception" /> 39 39 </layout> 40 40 </appender> … … 48 48 <appender-ref ref="RollingFileAppender" /> 49 49 </appender> 50 51 <appender name="ClientBufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > 52 <bufferSize value="128" /> 53 <lossy value="true" /> 54 <evaluator type="log4net.Core.LevelEvaluator"> 55 <threshold value="DEBUG"/> 56 </evaluator> 57 <appender-ref ref="ClientRollingFileAppender" /> 58 </appender> 59 60 <appender name="ServerBufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > 61 <bufferSize value="128" /> 62 <lossy value="true" /> 63 <evaluator type="log4net.Core.LevelEvaluator"> 64 <threshold value="DEBUG"/> 65 </evaluator> 66 <appender-ref ref="ServertRollingFileAppender" /> 67 </appender> 68 69 <appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > 70 <bufferSize value="128" /> 71 <lossy value="true" /> 72 <evaluator type="log4net.Core.LevelEvaluator"> 73 <threshold value="DEBUG"/> 74 </evaluator> 75 <appender-ref ref="RollingFileAppender" /> 76 </appender> 50 77 51 78 <root> 52 <level value=" INFO" />79 <level value="DEBUG" /> 53 80 <appender-ref ref="BufferingForwardingAppender" /> 54 81 </root> … … 56 83 <logger name="HeuristicLab.Hive.Server"> 57 84 <level value="DEBUG" /> 58 <appender-ref ref="Server RollingFileAppender" />85 <appender-ref ref="ServerBufferingForwardingAppender" /> 59 86 </logger> 60 87 61 88 <logger name="HeuristicLab.Hive.Client"> 62 89 <level value="DEBUG" /> 63 <appender-ref ref="Client RollingFileAppender" />90 <appender-ref ref="ClientBufferingForwardingAppender" /> 64 91 </logger> 65 92 -
branches/3.2/sources/HeuristicLab.Tracing/3.2/app.config
r1622 r3931 9 9 <HeuristicLab.Tracing.Properties.Settings> 10 10 <setting name="TracingLog4netConfigFile" serializeAs="String"> 11 <value />11 <value>HeuristicLab.Hive.log4net.xml</value> 12 12 </setting> 13 13 </HeuristicLab.Tracing.Properties.Settings>
Note: See TracChangeset
for help on using the changeset viewer.