Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3931 for branches/3.2


Ignore:
Timestamp:
06/19/10 09:17:24 (14 years ago)
Author:
kgrading
Message:

added minor speedups and better transaction handling to the server (#828)

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  
    326326    #region Heartbeat
    327327
    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) {
    330330      if (ConnState == NetworkEnum.WcfConnState.Loggedin)
    331331        Logger.Debug("STARTING: sending heartbeat");
     
    334334
    335335    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);
    338338        Logger.Debug("ENDED: sending heartbeats");
    339339      } else {
     
    376376    }
    377377
    378     public ResponseResultReceived SendStoredJobResultsSync(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) {     
    379379      return proxy.StoreFinishedJobResultStreamed(
    380380        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  
    202202    <None Include="Properties\DataSources\Calendar.Appointment.datasource" />
    203203    <None Include="Resources\shutdown-icon.png" />
    204     <None Include="Service References\ClientService\Calendar.xsd" />
    205     <None Include="Service References\ClientService\System.Drawing.xsd" />
    206204  </ItemGroup>
    207205  <ItemGroup>
     
    213211  <ItemGroup>
    214212    <None Include="Resources\exit-48.png" />
     213    <None Include="Service References\ClientService\Calendar1.xsd" />
     214    <None Include="Service References\ClientService\System.Drawing1.xsd" />
    215215  </ItemGroup>
    216216  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/HiveClientConsole.cs

    r3220 r3931  
    187187    }
    188188
    189     private void UpdateGraph(JobStatus[] jobs)
     189    private void UpdateGraph(StatusCommons sc)
    190190    {
    191191      ZedGraphControl zgc = new ZedGraphControl();
     
    208208      double done = 0;
    209209
    210       if (jobs.Length == 0)
     210     
     211      /*if (jobs.Length == 0)
    211212      {
    212213        myPane.AddPieSlice(100, Color.Green, 0.1, "");
     
    217218        {
    218219          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     // }
    226227      //Hides the slice labels
    227228      PieItem.Default.LabelType = PieLabelType.None;
     
    586587        }
    587588
    588         UpdateGraph(sc.Jobs);
     589        UpdateGraph(sc);
    589590
    590591        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  
    77      <xs:element minOccurs="0" name="ClientGuid" type="ser:guid" />
    88      <xs:element minOccurs="0" name="ConnectedSince" type="xs:dateTime" />
     9      <xs:element minOccurs="0" name="FreeCores" type="xs:int" />
    910      <xs:element minOccurs="0" name="Jobs" nillable="true" type="tns:ArrayOfJobStatus" />
    1011      <xs:element minOccurs="0" name="JobsAborted" type="xs:int" />
     
    1213      <xs:element minOccurs="0" name="JobsFetched" type="xs:int" />
    1314      <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" />
    1416    </xs:sequence>
    1517  </xs:complexType>
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/Reference.cs

    r2023 r3931  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:2.0.50727.3082
     4//     Runtime Version:2.0.50727.4927
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    3131       
    3232        [System.Runtime.Serialization.OptionalFieldAttribute()]
     33        private int FreeCoresField;
     34       
     35        [System.Runtime.Serialization.OptionalFieldAttribute()]
    3336        private HeuristicLab.Hive.Client.Console.ClientService.JobStatus[] JobsField;
    3437       
     
    4447        [System.Runtime.Serialization.OptionalFieldAttribute()]
    4548        private HeuristicLab.Hive.Client.Console.ClientService.NetworkEnumWcfConnState StatusField;
     49       
     50        [System.Runtime.Serialization.OptionalFieldAttribute()]
     51        private int TotalCoresField;
    4652       
    4753        [global::System.ComponentModel.BrowsableAttribute(false)]
     
    8288       
    8389        [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()]
    84103        public HeuristicLab.Hive.Client.Console.ClientService.JobStatus[] Jobs {
    85104            get {
     
    142161                    this.StatusField = value;
    143162                    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");
    144176                }
    145177            }
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/Reference.svcmap

    r2023 r3931  
    2626    <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" />
    2727    <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" />
    3030  </Metadata>
    3131  <Extensions>
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/configuration.svcinfo

    r2023 r3931  
    66  </bindings>
    77  <endpoints>
    8     <endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IClientConsoleCommunicator&quot; contract=&quot;ClientService.IClientConsoleCommunicator&quot; name=&quot;NetTcpBinding_IClientConsoleCommunicator&quot;&gt;&lt;identity&gt;&lt;userPrincipalName value=&quot;mse08004@fhs-hagenberg.ac.at&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IClientConsoleCommunicator&quot; contract=&quot;ClientService.IClientConsoleCommunicator&quot; name=&quot;NetTcpBinding_IClientConsoleCommunicator&quot;&gt;&lt;identity&gt;&lt;userPrincipalName value=&quot;mse08004@fhs-hagenberg.ac.at&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator" />
     8    <endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IClientConsoleCommunicator&quot; contract=&quot;ClientService.IClientConsoleCommunicator&quot; name=&quot;NetTcpBinding_IClientConsoleCommunicator&quot;&gt;&lt;identity&gt;&lt;userPrincipalName value=&quot;semteX-PC\semteX&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;NetTcpBinding_IClientConsoleCommunicator&quot; contract=&quot;ClientService.IClientConsoleCommunicator&quot; name=&quot;NetTcpBinding_IClientConsoleCommunicator&quot;&gt;&lt;identity&gt;&lt;userPrincipalName value=&quot;semteX-PC\semteX&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator" />
    99  </endpoints>
    1010</configurationSnapshot>
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/Service References/ClientService/configuration91.svcinfo

    r2023 r3931  
    11<?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=">
    33  <bindingConfigurations>
    44    <bindingConfiguration bindingType="netTcpBinding" name="NetTcpBinding_IClientConsoleCommunicator">
     
    9393        <property path="/security/transport/protectionLevel" isComplexType="false" isExplicitlyDefined="true" clrType="System.Net.Security.ProtectionLevel, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    9494          <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>
    95107        </property>
    96108        <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.MessageSecurityOverTcpElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     
    137149        </property>
    138150        <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>
    140152        </property>
    141153        <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  
    11<?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/">
    33  <wsp:Policy wsu:Id="NetTcpBinding_IClientConsoleCommunicator_policy">
    44    <wsp:ExactlyOne>
     
    190190        <wsa10:Address>net.tcp://127.0.0.1:8000/ClientConsole/ClientConsoleCommunicator</wsa10:Address>
    191191        <Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
    192           <Upn>mse08004@fhs-hagenberg.ac.at</Upn>
     192          <Upn>semteX-PC\semteX</Upn>
    193193        </Identity>
    194194      </wsa10:EndpointReference>
  • branches/3.2/sources/HeuristicLab.Hive.Client.Console/3.2/app.config

    r2023 r3931  
    2727                                          enabled="false" />
    2828                                   <security mode="Transport">
    29                                           <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
     29                                          <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign">
     30                                                 <extendedProtectionPolicy policyEnforcement="Never" />
     31                                          </transport>
    3032                                          <message clientCredentialType="Windows" />
    3133                                   </security>
     
    3840                            contract="ClientService.IClientConsoleCommunicator" name="NetTcpBinding_IClientConsoleCommunicator">
    3941                            <identity>
    40                                    <userPrincipalName value="mse08004@fhs-hagenberg.ac.at" />
     42                                   <userPrincipalName value="semteX-PC\semteX" />
    4143                            </identity>
    4244                     </endpoint>
  • branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/ClientConsoleService/TransferObjects/StatusCommons.cs

    r1132 r3931  
    4040    public DateTime ConnectedSince { get; set; }
    4141    [DataMember]
     42    public int TotalCores { get; set; }
     43    [DataMember]
     44    public int FreeCores { get; set; }
     45    [DataMember]
    4246    public int JobsFetched { get; set; }
    4347    [DataMember]
  • branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/ConfigurationManager/ConfigManager.cs

    r3011 r3931  
    108108      st.ConnectedSince = WcfService.Instance.ConnectedSince;
    109109
     110      st.TotalCores = hardwareInfo.NrOfCores;
     111      st.FreeCores = hardwareInfo.NrOfCores - GetUsedCores();
     112
    110113      st.JobsAborted = ClientStatusInfo.JobsAborted;
    111114      st.JobsDone = ClientStatusInfo.JobsProcessed;
  • branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/Core.cs

    r3578 r3931  
    259259          lock (engines) {
    260260            appDomains[jId].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
     261           
     262            //Disposing it
     263            engines[jId].Dispose();
     264           
    261265            AppDomain.Unload(appDomains[jId]);
    262266            Logger.Debug("Unloaded appdomain");
     
    478482      lock (engines) {
    479483        try {
     484          engines[id].Dispose(); 
    480485          appDomains[id].UnhandledException -= new UnhandledExceptionEventHandler(appDomain_UnhandledException);
    481486          AppDomain.Unload(appDomains[id]);
  • branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/Heartbeat.cs

    r3578 r3931  
    6565      heartbeatTimer.Elapsed += new ElapsedEventHandler(heartbeatTimer_Elapsed);
    6666      wcfService = WcfService.Instance;
    67       wcfService.SendHeartBeatCompleted += new EventHandler<ProcessHeartBeatCompletedEventArgs>(wcfService_ProcessHeartBeatCompleted);
     67      wcfService.ProcessHeartBeatCompleted += new EventHandler<ProcessHeartBeatCompletedEventArgs>(wcfService_ProcessHeartBeatCompleted);
    6868      heartbeatTimer.Start();
    6969    }
     
    105105      } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) {
    106106        Logger.Debug("Sending Heartbeat: " + heartBeatData);       
    107         wcfService.SendHeartBeatAsync(heartBeatData);
     107        wcfService.ProcessHeartBeatAsync(heartBeatData);
    108108      }
    109109    }
  • branches/3.2/sources/HeuristicLab.Hive.Client.Core/3.2/JobStorage/JobStorageManager.cs

    r3578 r3931  
    1 using System;
     1using System;
    22using System.Collections.Generic;
    33using System.Linq;
     
    5151            byte[] job = File.ReadAllBytes(path + filename + ".dat");
    5252            if (WcfService.Instance.IsJobStillNeeded(storedJobsList[index - 1].JobID).StatusMessage == ApplicationConstants.RESPONSE_COMMUNICATOR_SEND_JOBRESULT) {
    53               ResponseResultReceived res = WcfService.Instance.SendStoredJobResultsSync(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);
    5454              if (!res.Success)
    5555                Logger.Error("sending of job failed: " + res.StatusMessage);
  • branches/3.2/sources/HeuristicLab.Hive.Client.ExecutionEngine/3.2/Executor.cs

    r2108 r3931  
    3333
    3434namespace HeuristicLab.Hive.Client.ExecutionEngine {
    35   public class Executor: MarshalByRefObject {
     35  public class Executor: MarshalByRefObject, IDisposable {
    3636    public Guid JobId { get; set; }
    3737    public IJob Job { get; set; }
     
    109109        throw new InvalidStateException("Job is still running");
    110110      } else {
    111         return SerializeJobObject();
     111        byte[] jobArr = SerializeJobObject();       
     112        return jobArr;
    112113      }
    113     }
     114    }   
    114115
    115116
     
    131132      JobIsFinished = false;
    132133      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
    134146  }
    135147}
  • branches/3.2/sources/HeuristicLab.Hive.Contracts/3.2/ApplicationConstants.cs

    r3578 r3931  
    2929  public class ApplicationConstants {
    3030
    31     public static System.Data.IsolationLevel ISOLATION_LEVEL = IsolationLevel.ReadCommitted;
     31    public static System.Data.IsolationLevel ISOLATION_LEVEL = IsolationLevel.ReadUncommitted;
    3232
    3333    public static System.Transactions.IsolationLevel ISOLATION_LEVEL_SCOPE =
    34       System.Transactions.IsolationLevel.ReadCommitted;
     34      System.Transactions.IsolationLevel.ReadUncommitted;
    3535    public static int HEARTBEAT_MAX_DIF = 120; // value in seconds
    3636    public static int JOB_TIME_TO_LIVE = 5;
  • branches/3.2/sources/HeuristicLab.Hive.Contracts/3.2/BusinessObjects/ClientDto.cs

    r3203 r3931  
    3939    public int NrOfFreeCores { get; set; }
    4040    [DataMember]
    41     public int CpuSpeedPerCore { get; set; }
     41    public int? CpuSpeedPerCore { get; set; }
    4242    [DataMember]
    4343    public int Memory { get; set; }
     
    4545    public int FreeMemory { get; set; }
    4646    [DataMember]
    47     public DateTime Login { get; set; }
     47    public DateTime? Login { get; set; }
    4848    [DataMember]
    4949    public State State { get; set; }
  • branches/3.2/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientAdapter.cs

    r3011 r3931  
    156156      if (client != null && row != null) {
    157157        row.ResourceId = client.Id;
    158         row.CPUSpeed = client.CpuSpeedPerCore;
     158       // row.CPUSpeed = client.CpuSpeedPerCore;
    159159        row.Memory = client.Memory;
    160         row.Login = client.Login;
     160       // row.Login = client.Login;
    161161        if (client.State != State.nullState)
    162162          row.Status = client.State.ToString();
  • branches/3.2/sources/HeuristicLab.Hive.Server.Console/3.2/HeuristicLab.Hive.Server.Console-3.2.csproj

    r3022 r3931  
    217217      <Name>HeuristicLab.PluginInfrastructure</Name>
    218218    </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>
    219223  </ItemGroup>
    220224  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3.2/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs

    r3578 r3931  
    3333using System.Threading;
    3434using System.ServiceModel;
     35using HeuristicLab.Tracing;
    3536
    3637namespace HeuristicLab.Hive.Server.ServerConsole {
     
    263264        IJobManager jobManager =
    264265          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();
    268275
    269276        ListViewGroup lvJobCalculating = new ListViewGroup("calculating", HorizontalAlignment.Left);
     
    311318      }
    312319      catch (Exception ex) {
     320        Logger.Error(ex);
    313321        closeFormEvent(true, true);
    314322        this.Close();
     
    790798    }
    791799
    792     private int CapacityRam(int noCores, int freeCores) {
     800    private int CapacityRam(int noCores, int freeCores) {   
    793801      if (noCores > 0) {
    794802        int capacity = ((noCores - freeCores) / noCores) * 100;
  • branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs

    r3578 r3931  
    120120                Logger.Info("Client timed out and is on RESET");
    121121                foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) {
    122                   jobManager.ResetJobsDependingOnResults(job);
     122                  DaoLocator.JobDao.SetJobOffline(job);
    123123                  lock (newAssignedJobs) {
    124124                    if (newAssignedJobs.ContainsKey(job.Id))
     
    149149              lastHeartbeats.Remove(client.Id);
    150150            foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) {
    151               jobManager.ResetJobsDependingOnResults(job);
     151              DaoLocator.JobDao.SetJobOffline(job);
    152152            }
    153153            heartbeatLock.ExitWriteLock();
     
    428428      JobDto job2Calculate = scheduler.GetNextJobForClient(clientId);
    429429      if (job2Calculate != null) {
    430         response.Job = job2Calculate;
     430        response.Job = job2Calculate;       
    431431        response.Job.PluginsNeeded = DaoLocator.PluginInfoDao.GetPluginDependenciesForJob(response.Job);
    432432        response.Success = true;
     
    481481
    482482      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");
    485486        byte[] buffer = new byte[3024];
     487        List<byte> serializedJob = new List<byte>();
    486488        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());
    491503      }
    492504      Logger.Info("END Job received for Storage:");
     505      stream.Dispose();
    493506      return response;
    494507    }
     
    656669        foreach (JobDto job in jobsOfClient) {
    657670          if (job.State != State.finished)
    658             jobManager.ResetJobsDependingOnResults(job);
     671            DaoLocator.JobDao.SetJobOffline(job);
    659672        }
    660673      }
  • branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/ClientFacade.cs

    r3220 r3931  
    114114      IJobManager jobManager =
    115115        ServiceLocator.GetJobManager();
    116 
     116      IInternalJobManager internalJobManager = (IInternalJobManager) jobManager;
     117     
    117118      //second stream the job binary data
    118      
     119      MemoryStream memoryStream = new MemoryStream();     
    119120      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)));
    124122     
    125123      OperationContext clientContext = OperationContext.Current;
  • branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/DbTestApp.cs

    r3220 r3931  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
     21
    2022#endregion
    2123
     
    3739using HeuristicLab.Hive.Server.LINQDataAccess;
    3840using System.Transactions;
     41using System.Threading;
     42using HeuristicLab.Tracing;
    3943
    4044namespace HeuristicLab.Hive.Server {
    4145  [Application("Hive DB Test App", "Test Application for the Hive DataAccess Layer")]
    42   class HiveDbTestApplication : ApplicationBase {
     46  internal class HiveDbTestApplication : ApplicationBase {
    4347    /*private void TestJobStreaming() {
    4448      ISessionFactory factory =
     
    111115    } */
    112116
    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() {
    119121      ClientDto c1 = new ClientDto();
    120122      c1.Id = Guid.NewGuid();
     
    143145      c2 = clientDao.Insert(c2);
    144146
    145       //ClientDto info2 = clientDao.FindById(info.Id);
    146       //Console.WriteLine(info2);
    147      
    148147      ClientGroupDto tg = new ClientGroupDto();
    149148      tg.Name = "TopGroup";
     
    174173
    175174      List<ClientGroupDto> list = new List<ClientGroupDto>(cgd.FindAllWithSubGroupsAndClients());
    176      
     175
    177176      cgd.RemoveRessourceFromClientGroup(sg.Id, tg.Id);
    178177
     
    181180      clientDao.Delete(c1);
    182181      clientDao.Delete(c2);
    183 
    184182    }
    185183
     
    220218        sg = cgd.Insert(sg);
    221219        cgd.AddRessourceToClientGroup(sg.Id, mg.Id);
    222         populateMainGroup(sg, p-1);
    223       }
    224 
    225      
    226     }
    227 
     220        populateMainGroup(sg, p - 1);
     221      }
     222    }
    228223
    229224
     
    235230      //TestJobResultDeserialization();
    236231
     232      //if (ContextFactory.Context.DatabaseExists())
     233      //  ContextFactory.Context.DeleteDatabase();
     234      //ContextFactory.Context.CreateDatabase();
    237235      //TestLINQImplementation();
     236      TestLinqFileHandling();
    238237      //StressTest();
    239238
    240239      //SpeedTest();
    241240      //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() {
    247310      //using (TransactionScope scope = new TransactionScope()) {
     311
    248312      HiveDataContext context = ContextFactory.Context;
    249313
    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
    253322      ClientFacade facade = new ClientFacade();
     323
    254324      Stream stream = facade.SendStreamedJob(new Guid("F5CFB334-66A0-417C-A585-71711BA21D3F"));
    255      
     325
     326
    256327      byte[] buffer = new byte[3024];
     328
    257329      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        ();
    262343
    263344      //Stream stream = DaoLocator.JobDao.GetSerializedJobStream(new Guid("bbb51f87-4e2f-4499-a9b6-884e589c78b6"));
     
    265346    }
    266347
    267     private void TestJobBytearrFetching() {
     348    private
     349      void TestJobBytearrFetching() {
    268350      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() {
    273359      DateTime start = new DateTime();
     360
    274361      List<ClientGroupDto> list = new List<ClientGroupDto>(cgd.FindAllWithSubGroupsAndClients());
     362
    275363      DateTime end = new DateTime();
     364
    276365      TimeSpan used = end - start;
    277       Console.WriteLine(used.TotalMilliseconds);
    278     }
    279 
    280 
     366      Console.WriteLine
     367        (
     368        used.TotalMilliseconds
     369        );
     370    }
    281371  }
    282372}
  • branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/InternalInterfaces/IInternalJobManager.cs

    r3011 r3931  
    2828
    2929namespace HeuristicLab.Hive.Server.Core.InternalInterfaces {
    30   interface IInternalJobManager {
    31     void ResetJobsDependingOnResults(JobDto job);
    32 
     30  interface IInternalJobManager {   
    3331    Stream GetJobStreamById(Guid jobId);
     32    byte[] GetSerializedJobDataById(Guid jobId);
     33    void SetSerializedJobDataById(Guid jobId, byte[] data);
    3434  }
    3535}
  • branches/3.2/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs

    r3578 r3931  
    11#region License Information
     2
    23/* HeuristicLab
    34 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     
    1819 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1920 */
     21
    2022#endregion
    2123
     
    3840
    3941namespace HeuristicLab.Hive.Server.Core {
    40   class JobManager: IJobManager, IInternalJobManager {
    41 
     42  internal class JobManager : IJobManager, IInternalJobManager {
    4243    //ISessionFactory factory;
    43     ILifecycleManager lifecycleManager;
     44    private ILifecycleManager lifecycleManager;
    4445
    4546    #region IJobManager Members
     
    5354    }
    5455
    55     private JobDto GetLastJobResult(Guid jobId) {     
     56    private JobDto GetLastJobResult(Guid jobId) {
    5657      return DaoLocator.JobDao.FindById(jobId);
    5758    }
    5859
    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() {
    6862      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})) {
    7067        List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll());
    7168        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);
    7471          }
    7572        }
     
    7976    }
    8077
    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");
    8280      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");
    8686      checkForDeadJobs();
     87      Logger.Info("Startup Event Done");
    8788    }
    8889
     
    9293    /// <returns></returns>
    9394    public ResponseList<JobDto> GetAllJobs() {
    94          ResponseList<JobDto> response = new ResponseList<JobDto>();
    95 
    96          response.List = new List<JobDto>(DaoLocator.JobDao.FindAll());
    97          response.Success = true;
    98          response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ALL_JOBS;
    99 
    100          return response;
     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;
    101102    }
    102103
     
    105106      response.List = new List<JobDto>(DaoLocator.JobDao.FindWithLimitations(jobState, offset, count));
    106107      return response;
    107     } 
     108    }
    108109
    109110    /// <summary>
     
    112113    /// <param name="jobId"></param>
    113114    /// <returns></returns>
    114     public Stream GetJobStreamById(Guid jobId) {           
     115    public Stream GetJobStreamById(Guid jobId) {
    115116      return DaoLocator.JobDao.GetSerializedJobStream(jobId);
    116      
    117117    }
    118118
     
    122122    /// <returns></returns>
    123123    public ResponseObject<JobDto> GetJobById(Guid jobId) {
    124         ResponseObject<JobDto> response = new ResponseObject<JobDto>();
     124      ResponseObject<JobDto> response = new ResponseObject<JobDto>();
    125125
    126126      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    }
    137138
    138139    public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) {
     
    144145
    145146        job.Obj.Client = DaoLocator.ClientDao.GetClientForJob(jobId);
    146       } else {
     147      }
     148      else {
    147149        job.Success = false;
    148150        job.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST;
    149       }     
     151      }
    150152      return job;
    151153    }
     
    154156      IClientGroupDao cgd = DaoLocator.ClientGroupDao;
    155157      foreach (string res in resources) {
    156         foreach(ClientGroupDto cg in cgd.FindByName(res)) {
     158        foreach (ClientGroupDto cg in cgd.FindByName(res)) {
    157159          job.JobInfo.AssignedResourceIds.Add(cg.Id);
    158160        }
     
    167169    /// <returns></returns>
    168170    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) {
    196175          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) {
    197185          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;
    200218        return response;
    201219      }
    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    }
    228226
    229227    public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) {
     
    231229        new ResponseObject<JobDto>();
    232230
    233        result.Obj =
    234          GetLastJobResult(jobId);
    235        result.Success =
    236          result.Obj != null;
    237 
    238        return result;
     231      result.Obj =
     232        GetLastJobResult(jobId);
     233      result.Success =
     234        result.Obj != null;
     235
     236      return result;
    239237    }
    240238
    241239    public ResponseObject<SerializedJob>
    242240      GetLastSerializedJobResultOf(Guid jobId, bool requested) {
    243 
    244         ResponseObject<SerializedJob> response =
    245           new ResponseObject<SerializedJob>();
     241      ResponseObject<SerializedJob> response =
     242        new ResponseObject<SerializedJob>();
    246243
    247244      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
    272249        return response;
    273250      }
    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    }
    284260
    285261
    286262    public Response RequestSnapshot(Guid jobId) {
    287      // ISession session = factory.GetSessionForCurrentThread();
    288263      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;
    311270        return response;
    312271      }
    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    }
    318286
    319287    public Response AbortJob(Guid jobId) {
    320       //ISession session = factory.GetSessionForCurrentThread();
    321288      Response response = new Response();
    322289
    323     /*  try {
    324         IJobAdapter jobAdapter = session.GetDataAdapter<JobDto, IJobAdapter>();*/
    325 
    326 //        JobDto job = jobAdapter.GetById(jobId);
    327290      JobDto job = DaoLocator.JobDao.FindById(jobId);
    328         if (job == null) {
    329           response.Success = false;
    330           response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST;
    331           return response; // no commit needed
    332         }
    333         if (job.State == State.abort) {
    334           response.Success = true;
    335           response.StatusMessage = ApplicationConstants.RESPONSE_JOB_ABORT_REQUEST_ALLREADY_SET;
    336           return response; // no commit needed
    337         }
    338         if (job.State != State.calculating && job.State != State.requestSnapshot && job.State != State.requestSnapshotSent) {
    339           response.Success = false;
    340           response.StatusMessage = ApplicationConstants.RESPONSE_JOB_IS_NOT_BEEING_CALCULATED;
    341           return response; // no commit needed
    342         }
    343         // job is in correct state
    344         job.State = State.abort;
     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;
    345308      DaoLocator.JobDao.Update(job);
    346309
    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    }
    357315
    358316    public ResponseList<JobResult> GetAllJobResults(Guid jobId) {
     
    381339
    382340    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
    385352    #endregion
    386353  }
  • branches/3.2/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IJobDao.cs

    r3578 r3931  
    2323
    2424    IEnumerable<JobDto> FindWithLimitations(State jobState, int offset, int count);
     25
     26    void SetBinaryJobFile(Guid jobId, byte[] data);
    2527  }
    2628}
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/BaseDao.cs

    r3578 r3931  
    1515
    1616    protected void CommitChanges() {
     17      //TODO: DoWhile
    1718      try {
    1819        Context.SubmitChanges(ConflictMode.ContinueOnConflict);
    1920      } catch (ChangeConflictException e) {
    2021        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          }
    2230          conflict.Resolve(RefreshMode.KeepChanges);
    2331        }
     32        Context.SubmitChanges(ConflictMode.FailOnFirstConflict);
    2433      }
    2534    }
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientDao.cs

    r3578 r3931  
    1414
    1515    public ClientDto FindById(Guid id) {
    16       return (from client in Context.Clients
     16      return (from client in Context.Resources.OfType<Client>()                         
    1717              where client.ResourceId.Equals(id)
    1818              select EntityToDto(client, null)
     
    2121
    2222    public IEnumerable<ClientDto> FindAll() {
    23       return (from client in Context.Clients
     23      return (from client in Context.Resources.OfType<Client>()
    2424              select
    2525                EntityToDto(client, null)
     
    2828
    2929    public IEnumerable<ClientDto> FindAllClientsWithoutGroup() {
    30       return (from client in Context.Clients
    31               where client.Resource.ClientGroup_Resources.Count == 0
     30      return (from client in Context.Resources.OfType<Client>()
     31              where client.ClientGroup_Resources_Parents.Count == 0
    3232              select EntityToDto(client, null)).ToList();
    3333    }
     
    4040
    4141    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));
    4343      dbclient.UseCalendarFromResourceId = clientGroupId;
    4444      dbclient.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), CalendarState.Fetch);
     
    4848    public ClientDto Insert(ClientDto info) {
    4949      Client c = DtoToEntity(info, null);     
    50       Context.Clients.InsertOnSubmit(c);
     50      Context.Resources.InsertOnSubmit(c);
    5151      CommitChanges();
    5252      info.Id = c.ResourceId;
     
    6262
    6363    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));
    6565      DtoToEntity(info, client);
    6666      CommitChanges();     
     
    7575      target.CPUSpeed = source.CpuSpeedPerCore;
    7676     
    77       if(target.Resource == null)
    78         target.Resource = new Resource();
    79 
    8077      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;
    8380      target.CalendarSyncStatus = Enum.GetName(typeof(CalendarState), source.CalendarSyncStatus);
    8481      target.Login = source.Login;
     
    9693        target = new ClientDto();
    9794      target.CpuSpeedPerCore = source.CPUSpeed;
    98       target.FreeMemory = source.FreeMemory;
     95      target.FreeMemory = source.FreeMemory ?? 0;
    9996      target.Id = source.ResourceId;
    10097      target.CalendarSyncStatus = (CalendarState) Enum.Parse(typeof (CalendarState), source.CalendarSyncStatus);
    10198      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;
    106103      target.State = (State) Enum.Parse(typeof (State), source.Status);
    107104      return target;
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ClientGroupDao.cs

    r3578 r3931  
    1313
    1414    public ClientGroupDto FindById(Guid id) {
    15       return (from cc in Context.ClientGroups
     15      return (from cc in Context.Resources.OfType<ClientGroup>()
    1616              where cc.ResourceId.Equals(id)
    1717              select EntityToDto(cc, null)).SingleOrDefault();
     
    2020
    2121    public IEnumerable<ClientGroupDto> FindAll() {
    22       return (from cc in Context.ClientGroups
     22      return (from cc in Context.Resources.OfType<ClientGroup>()
    2323              select EntityToDto(cc, null)).ToList();
    2424    }
     
    3030
    3131      ClientGroup cc = DtoToEntity(bObj, null);
    32       Context.ClientGroups.InsertOnSubmit(cc);
     32      Context.Resources.InsertOnSubmit(cc);
    3333      CommitChanges();
    3434      bObj.Id = cc.ResourceId;
     
    4848
    4949    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));
    5151      DtoToEntity(bObj, client);
    5252      CommitChanges();
     
    5454
    5555    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));
    5757      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 });     
    5959      CommitChanges();
    6060    }
     
    7777      List<ClientGroupDto> groupList = new List<ClientGroupDto>();
    7878
    79       var q = (from cg in Context.ClientGroups
     79      var q = (from cg in Context.Resources.OfType<ClientGroup>()
    8080               where !Context.ClientGroup_Resources.Any(cgr => cgr.ResourceId.Equals(cg.ResourceId))
    8181               select cg);
     
    8484        ClientGroupDto cgd = EntityToDto(cg, null);
    8585        groupList.Add(cgd);
    86         FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources);       
     86        FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources_Children);       
    8787      }
    8888      return groupList;
     
    9393      //Get all the Groups
    9494     
    95       var qGroups = (from cg in Context.ClientGroups
    96                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))
    9797               select cg);
    9898
     
    100100        ClientGroupDto cgd = EntityToDto(cg, null);
    101101        parentClientGroup.Resources.Add(cgd);
    102         FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources);
     102        FillSubGroupsAndClientsRecursivly(cgd, cg.ClientGroup_Resources_Children);
    103103      }
    104104
    105105      //get the clients
    106       var qClients = (from cl in Context.Clients
    107                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))
    108108               select cl);
    109109      foreach (Client client in qClients) {
     
    114114    public IEnumerable<Guid> FindAllGroupAndParentGroupIdsForClient(Guid clientId) {
    115115      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);
    118118      return guids;
    119119    }
    120120
     121    //Massivly error Prone
    121122    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) {
    123124        guids.Add(cgr.ClientGroupId);
    124         FindAllGroupAndParentGroupIdsForClientRecursive(cgr.ClientGroup.Resource, guids);       
     125        FindAllGroupAndParentGroupIdsForClientRecursive(cgr.ClientGroup, guids);       
    125126      }
    126127    }
     
    133134      if (target == null)
    134135        target = new ClientGroup();
    135       if (target.Resource == null)
    136         target.Resource = new Resource();
    137136
    138       target.Resource.Name = source.Name;
    139       target.Resource.ResourceId = source.Id;
     137      target.Name = source.Name;
     138      target.ResourceId = source.Id;
    140139
    141140      return target;
     
    149148
    150149      target.Id = source.ResourceId;
    151       target.Name = source.Resource.Name;
     150      target.Name = source.Name;
    152151
    153152      return target;
     
    155154
    156155    public IEnumerable<ClientGroupDto> FindByName(string res) {
    157       return (from cq in Context.ClientGroups
    158               where cq.Resource.Name == res
     156      return (from cq in Context.Resources.OfType<ClientGroup>()
     157              where cq.Name == res
    159158              select EntityToDto(cq, null)).ToList();     
    160159    }
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/ContextFactory.cs

    r3578 r3931  
    55using System.Data.Common;
    66using System.Data.SqlClient;
     7using HeuristicLab.Tracing;
    78
    89namespace HeuristicLab.Hive.Server.LINQDataAccess {
     
    1617    public static HiveDataContext Context {
    1718      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        }
    2024        return _hiveDataContext;       
    2125      }
     
    3236      }
    3337    }
     38
     39    public static bool IsContextNull() {
     40      return _hiveDataContext == null;
     41    }
    3442  }
    3543}
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HeuristicLab.Hive.Server.LINQDataAccess-3.2.csproj

    r3578 r3931  
    9191    <Compile Include="ClientGroupDao.cs" />
    9292    <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" />
    9894    <Compile Include="JobDao.cs" />
    9995    <Compile Include="LINQDataAccessPlugin.cs" />
     
    109105  </ItemGroup>
    110106  <ItemGroup>
    111     <None Include="Hive.dbml">
    112       <Generator>MSLinqToSQLGenerator</Generator>
    113       <LastGenOutput>Hive.designer.cs</LastGenOutput>
    114       <SubType>Designer</SubType>
    115     </None>
    116107    <None Include="HeuristicLab.snk" />
    117108    <None Include="Properties\AssemblyInfo.frame" />
     
    144135  <ItemGroup>
    145136    <None Include="app.config" />
    146     <None Include="Hive.dbml.layout">
    147       <DependentUpon>Hive.dbml</DependentUpon>
    148     </None>
    149137    <None Include="Properties\Settings.settings">
    150138      <Generator>SettingsSingleFileGenerator</Generator>
    151139      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    152140    </None>
     141  </ItemGroup>
     142  <ItemGroup>
     143    <Content Include="HiveDataContext.xml" />
    153144  </ItemGroup>
    154145  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml

    r3578 r3931  
    7878      <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />
    7979      <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" />
    8180    </Type>
    8281  </Table>
     
    133132      <Association Name="Client_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="ResourceId" Type="Job" />
    134133      <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" />
    136134      <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="ClientConfig" IsForeignKey="true" DeleteRule="SET NULL" />
    137135    </Type>
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.dbml.layout

    r3203 r3931  
    166166      </nodes>
    167167    </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>
    175168    <associationConnector edgePoints="[(4.75 : 12); (4.75 : 11.1747054036458)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    176169      <AssociationMoniker Name="/HiveDataContext/ClientConfig/ClientConfig_Client" />
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Hive.designer.cs

    r3578 r3931  
    15121512    private EntityRef<Client> _Client;
    15131513   
    1514     private EntityRef<Client> _Client1;
    1515    
    15161514    #region Extensibility Method Definitions
    15171515    partial void OnLoaded();
     
    15311529      this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));
    15321530      this._Client = default(EntityRef<Client>);
    1533       this._Client1 = default(EntityRef<Client>);
    15341531      OnCreated();
    15351532    }
     
    16681665          }
    16691666          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 Client1
    1676     {
    1677       get
    1678       {
    1679         return this._Client1.Entity;
    1680       }
    1681       set
    1682       {
    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");
    16991667        }
    17001668      }
     
    26202588    private EntityRef<Resource> _Resource;
    26212589   
    2622     private EntityRef<Resource> _Resource1;
    2623    
    26242590    private EntityRef<ClientConfig> _ClientConfig;
    26252591   
     
    26572623      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    26582624      this._Resource = default(EntityRef<Resource>);
    2659       this._Resource1 = default(EntityRef<Resource>);
    26602625      this._ClientConfig = default(EntityRef<ClientConfig>);
    26612626      OnCreated();
     
    29502915    }
    29512916   
    2952     [Association(Name="Resource_Client1", Storage="_Resource1", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
    2953     public Resource Resource1
    2954     {
    2955       get
    2956       {
    2957         return this._Resource1.Entity;
    2958       }
    2959       set
    2960       {
    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           else
    2978           {
    2979             this._ResourceId = default(System.Guid);
    2980           }
    2981           this.SendPropertyChanged("Resource1");
    2982         }
    2983       }
    2984     }
    2985    
    29862917    [Association(Name="ClientConfig_Client", Storage="_ClientConfig", ThisKey="ClientConfigId", OtherKey="ClientConfigId", IsForeignKey=true, DeleteRule="SET NULL")]
    29872918    public ClientConfig ClientConfig
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/HiveDataContext.xml

    r3808 r3931  
    11<?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">
    33  <Table Name="dbo.AssignedResources" Member="AssignedResources">
    44    <Type Name="AssignedResource">
     
    66      <Column Name="JobId" Member="JobId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" />
    77      <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"/>
    1010    </Type>
    1111  </Table>
     
    2323      <Column Name="ClientConfigId" Member="ClientConfigId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" IsPrimaryKey="true" IsDbGenerated="true" AutoSync="OnInsert" />
    2424      <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"/>
    2626      <Association Name="ClientConfig_Client" Member="Clients"  ThisKey="ClientConfigId" OtherKey="ClientConfigId" Type="Client"/>
    2727    </Type>
     
    3030  <Table Name="dbo.ClientGroup_Resource" Member="ClientGroup_Resources">
    3131    <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"  />
    3333      <Column Name="ClientGroupId" Member="ClientGroupId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" />
    3434      <Column Name="ResourceId" Member="ResourceId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" />
    3535   
    3636      <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"/>
    3838    </Type>
    3939  </Table>
     
    5959      <Column Name="JobId" Member="JobId" DbType="UniqueIdentifier NOT NULL" Type="System.Guid" />
    6060      <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"/>
    6262      <Association Name="Job_RequiredPlugin" Member="Job" ThisKey="JobId" OtherKey="JobId" IsForeignKey="true" Type="Job"/>
    6363    </Type>
     
    6969      <Column Name="ResourceType" Member="ResourceType" IsDiscriminator="true" Type="System.String"/>
    7070      <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" />
    7272      <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />     
    7373      <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"/>
    8484        <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"/>       
    8686        <Association Name="ClientConfig_Client" Member="ClientConfig" ThisKey="ClientConfigId" OtherKey="ClientConfigId" DeleteRule="SET NULL" IsForeignKey="true" Type="ClientConfig"/>
    8787      </Type>
    8888      <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" />
    9090      </Type>
    9191    </Type>
     
    9595    <Type Name="Job">
    9696      <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" />
    9898      <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"/>
    105105      <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"/>
    108108      <Column Name="CoresNeeded" Member="CoresNeeded" DbType="Int NOT NULL" Type="System.Int32"/>
    109109      <Column Name="MemoryNeeded" Member="MemoryNeeded" DbType="Int NOT NULL" Type="System.Int32"/>
     
    125125      <Column Name="Recurring" Member="Recurring" DbType="Bit NOT NULL" Type="System.Boolean"/>
    126126      <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"/>
    128128    </Type>
    129129  </Table>
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/JobDao.cs

    r3578 r3931  
    6363    }
    6464
     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
    6573    public SerializedJob InsertWithAttachedJob(SerializedJob job) {
    6674      Job j = DtoToEntity(job.JobInfo, null);
     
    121129
    122130    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));
    124132      Job j = Context.Jobs.SingleOrDefault(job => job.JobId.Equals(jobId));
    125133      c.Jobs.Add(j);
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.Designer.cs

    r3578 r3931  
    2828        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
    2929        [global::System.Configuration.DefaultSettingValueAttribute("Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=" +
    30             "True")]
     30            "True;MultipleActiveResultSets=True")]
    3131        public string HeuristicLab_Hive_LinqConnectionString {
    3232            get {
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/Properties/Settings.settings

    r3578 r3931  
    66      <DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
    77&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    8   &lt;ConnectionString&gt;Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True&lt;/ConnectionString&gt;
     8  &lt;ConnectionString&gt;Data Source=127.0.0.1;Initial Catalog=HeuristicLab.Hive.Linq;Integrated Security=True;MultipleActiveResultSets=True&lt;/ConnectionString&gt;
    99  &lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
    1010&lt;/SerializableConnectionString&gt;</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>
    1212    </Setting>
    1313  </Settings>
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/UptimeCalendarDao.cs

    r3578 r3931  
    9999
    100100    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));
    102102      IList<AppointmentDto> appointments = new List<AppointmentDto>();
    103103      if (dbc != null) {
    104104        ClientGroup cg =
    105           Context.ClientGroups.SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId));
     105          Context.Resources.OfType<ClientGroup>().SingleOrDefault(cgroup => cgroup.ResourceId.Equals(dbc.UseCalendarFromResourceId));
    106106        //in case no plan has been set
    107107        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;
    110110
    111111        if (cg == null)
    112112          return appointments;
    113113
    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;
    117117          else {
    118118            break;
     
    120120        }
    121121
    122         foreach (UptimeCalendar appointment in cg.Resource.UptimeCalendars) {
     122        foreach (UptimeCalendar appointment in cg.UptimeCalendars) {
    123123          appointments.Add(EntityToDto(appointment,null)); 
    124124        }
     
    131131     
    132132      //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));
    134134      if(cg == null)
    135135        return;
    136136
    137137      //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();
    139139     
    140140      //Set new state
     
    146146
    147147      //Get all Subgroups
    148       List<ClientGroup> groups = (from cg1 in Context.ClientGroups
    149                                   where cg1.Resource.ClientGroup_Resources.Any(
     148      List<ClientGroup> groups = (from cg1 in Context.Resources.OfType<ClientGroup>()
     149                                  where cg1.ClientGroup_Resources_Parents.Any(
    150150                                cgr => cgr.ClientGroupId.Equals(groupId))
    151151                              select cg1).ToList();
     
    154154      //otherweise - propagate
    155155      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);       
    158158      }
    159159    }
  • branches/3.2/sources/HeuristicLab.Hive.Server.LINQDataAccess/3.2/app.config

    r3578 r3931  
    55    <connectionStrings>
    66        <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"
    88            providerName="System.Data.SqlClient" />
    99    </connectionStrings>
  • branches/3.2/sources/HeuristicLab.Hive.Server/3.2/ServiceCallInterception.cs

    r3578 r3931  
    1616
    1717    public object Invoke(IMethodInvocation invocation) {
     18      DateTime start = DateTime.Now;
    1819      Logger.Info("Entering Method: " + invocation.Method.Name);
    1920
    20       if(ContextFactory.Context != null) {
     21      if(!ContextFactory.IsContextNull()) {
    2122        Logger.Info("Not null context found - why wasn't this disposed?");
    2223        try {
     
    2829        ContextFactory.Context = null;
    2930      }
    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());
    3133      Object obj = null;
    3234
    33       if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) {       
     35      /*if (invocation.Method.Name.Equals("SendStreamedJob") || invocation.Method.Name.Equals("StoreFinishedJobResultStreamed")) {       
    3436        ContextFactory.Context.Connection.Open();
    3537        if(UseTransactions) {
     
    4850          ContextFactory.Context = null;
    4951        }       
    50       } else {
     52      } else { */
    5153        if(UseTransactions) {
    5254          using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) {
     
    5759            }
    5860            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);
    6063            }
    6164            finally {
     
    8083          } 
    8184        }
     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); ;
    8293      }
    8394      Logger.Info("Leaving Method: " + invocation.Method.Name);
    84 
     95     
    8596      return obj;
    8697    }
  • branches/3.2/sources/HeuristicLab.Tracing/3.2/HeuristicLab.Hive.log4net.xml

    r3578 r3931  
    66    <rollingStyle value="Size" />
    77    <maxSizeRollBackups value="10" />
    8     <maximumFileSize value="1000KB" />
     8    <maximumFileSize value="100MB" />
    99    <staticLogFileName value="true" />
    1010    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    1111    <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" />
    1313    </layout>
    1414  </appender>
     
    1919    <rollingStyle value="Size" />
    2020    <maxSizeRollBackups value="10" />
    21     <maximumFileSize value="1000KB" />
     21    <maximumFileSize value="100MB" />
    2222    <staticLogFileName value="true" />
    2323    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    2424    <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" />
    2626    </layout>
    2727  </appender>
     
    3232    <rollingStyle value="Size" />
    3333    <maxSizeRollBackups value="10" />
    34     <maximumFileSize value="1000KB" />
     34    <maximumFileSize value="100MB" />
    3535    <staticLogFileName value="true" />
    3636    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    3737    <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" />
    3939    </layout>
    4040  </appender>
     
    4848    <appender-ref ref="RollingFileAppender" />
    4949  </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>
    5077 
    5178  <root>
    52     <level value="INFO" />
     79    <level value="DEBUG" />
    5380    <appender-ref ref="BufferingForwardingAppender" />
    5481  </root>
     
    5683  <logger name="HeuristicLab.Hive.Server">
    5784    <level value="DEBUG" />
    58     <appender-ref ref="ServerRollingFileAppender" />   
     85    <appender-ref ref="ServerBufferingForwardingAppender" />   
    5986  </logger>
    6087
    6188  <logger name="HeuristicLab.Hive.Client">
    6289    <level value="DEBUG" />
    63     <appender-ref ref="ClientRollingFileAppender" /> 
     90    <appender-ref ref="ClientBufferingForwardingAppender" /> 
    6491  </logger>
    6592 
  • branches/3.2/sources/HeuristicLab.Tracing/3.2/app.config

    r1622 r3931  
    99    <HeuristicLab.Tracing.Properties.Settings>
    1010      <setting name="TracingLog4netConfigFile" serializeAs="String">
    11         <value />
     11        <value>HeuristicLab.Hive.log4net.xml</value>
    1212      </setting>
    1313    </HeuristicLab.Tracing.Properties.Settings>
Note: See TracChangeset for help on using the changeset viewer.