Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/24/11 16:55:48 (14 years ago)
Author:
cneumuel
Message:

#1233

  • extended statistics recording:
    • execution times of users are captured
    • execution times and start-to-finish time of finished jobs is captured (to computer hive overhead)
    • data of deleted jobs is automatically captured in DeletedJobStatistics
  • changed ExecutionTime type in database from string to float (milliseconds are stored instead of TimeSpan.ToString())
  • added IsPrivileged field to job to indicate if it should be executed in a privileged sandbox
  • added CpuUtilization field to slave to be able to report cpu utilization
  • added GetJobsByResourceId to retrieve all jobs which are currently beeing calculated in a slave(-group)
  • TransactionManager now allows to use serializable tranactions (used for lifecycle trigger)
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs

    r6200 r6267  
    150150    }
    151151
     152    protected virtual void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {
     153      if (InvokeRequired) {
     154        Invoke(new EventHandler(OptimizerJob_ComputeInParallelChanged), sender, e);
     155      } else {
     156        computeInParallelCheckBox.Checked = Content.ItemJob.ComputeInParallel;
     157      }
     158    }
     159    #endregion
     160
     161    #region Child Control Events
     162     protected virtual void computeInParallelCheckBox_CheckedChanged(object sender, EventArgs e) {
     163      if (Content != null && Content.ItemJob != null) {
     164        this.Content.ItemJob.ComputeInParallel = this.computeInParallelCheckBox.Checked;
     165      }
     166    }
     167
     168    protected virtual void exceptionTextBox_DoubleClick(object sender, EventArgs e) {
     169      using (TextDialog dialog = new TextDialog("Exception", exceptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) {
     170        if (dialog.ShowDialog(this) == DialogResult.OK)
     171          Content.Description = dialog.Content;
     172      }
     173    }
     174
     175    protected virtual void modifyItemButton_Click(object sender, EventArgs e) {
     176      MainFormManager.MainForm.ShowContent(Content.ItemJob.Item);
     177    }
     178    #endregion
     179
    152180    protected override void SetEnabledStateOfControls() {
    153181      base.SetEnabledStateOfControls();
     
    171199      optimizerItemView.ReadOnly = true;
    172200    }
    173 
    174     protected virtual void OptimizerJob_ComputeInParallelChanged(object sender, EventArgs e) {
    175       if (InvokeRequired) {
    176         Invoke(new EventHandler(OptimizerJob_ComputeInParallelChanged), sender, e);
    177       } else {
    178         computeInParallelCheckBox.Checked = Content.ItemJob.ComputeInParallel;
    179       }
    180     }
    181     #endregion
    182 
    183     #region Child Control Events
    184      protected virtual void computeInParallelCheckBox_CheckedChanged(object sender, EventArgs e) {
    185       if (Content != null && Content.ItemJob != null) {
    186         this.Content.ItemJob.ComputeInParallel = this.computeInParallelCheckBox.Checked;
    187       }
    188     }
    189 
    190     protected virtual void exceptionTextBox_DoubleClick(object sender, EventArgs e) {
    191       using (TextDialog dialog = new TextDialog("Exception", exceptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) {
    192         if (dialog.ShowDialog(this) == DialogResult.OK)
    193           Content.Description = dialog.Content;
    194       }
    195     }
    196 
    197     protected virtual void modifyItemButton_Click(object sender, EventArgs e) {
    198       MainFormManager.MainForm.ShowContent(Content.ItemJob.Item);
    199     }
    200     #endregion
    201201  }
    202202}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/OptimizerHiveJobView.cs

    r6178 r6267  
    5050    }
    5151    #region Content Events
    52 
    53     protected override void SetEnabledStateOfControls() {
    54       base.SetEnabledStateOfControls();
    55 
    56       this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Paused;
    57       this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating;
    58       this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);
    59     }
    6052    #endregion
    6153
     
    7365    }
    7466    #endregion
     67
     68    protected override void SetEnabledStateOfControls() {
     69      base.SetEnabledStateOfControls();
     70
     71      this.restartButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Paused || Content.Job.State == JobState.Failed || Content.Job.State == JobState.Aborted);
     72      this.pauseButton.Enabled = Content != null && !Content.Job.Command.HasValue && Content.Job.State == JobState.Calculating;
     73      this.stopButton.Enabled = Content != null && !Content.Job.Command.HasValue && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);
     74    }
    7575  }
    7676}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/RefreshableHiveExperiment.cs

    r6229 r6267  
    276276    }
    277277    public void UpdateTotalExecutionTime() {
    278       hiveExperiment.ExecutionTime = TimeSpan.FromMilliseconds(hiveExperiment.GetAllHiveJobs().Sum(x => x.Job.ExecutionTime.HasValue ? x.Job.ExecutionTime.Value.TotalMilliseconds : 0));
     278      hiveExperiment.ExecutionTime = TimeSpan.FromMilliseconds(hiveExperiment.GetAllHiveJobs().Sum(x => x.Job.ExecutionTime.TotalMilliseconds));
    279279    }
    280280    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs

    r6006 r6267  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.208
     4//     Runtime Version:4.0.30319.225
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    9191       
    9292        [System.Runtime.Serialization.OptionalFieldAttribute()]
    93         private System.Nullable<System.TimeSpan> ExecutionTimeField;
     93        private System.TimeSpan ExecutionTimeField;
    9494       
    9595        [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    123123       
    124124        [System.Runtime.Serialization.DataMemberAttribute()]
    125         public System.Nullable<System.TimeSpan> ExecutionTime
     125        public System.TimeSpan ExecutionTime
    126126        {
    127127            get
     
    358358       
    359359        [System.Runtime.Serialization.OptionalFieldAttribute()]
     360        private bool IsPrivilegedField;
     361       
     362        [System.Runtime.Serialization.OptionalFieldAttribute()]
    360363        private System.Nullable<System.DateTime> LastHeartbeatField;
    361364       
     
    433436                    this.IsParentJobField = value;
    434437                    this.RaisePropertyChanged("IsParentJob");
     438                }
     439            }
     440        }
     441       
     442        [System.Runtime.Serialization.DataMemberAttribute()]
     443        public bool IsPrivileged
     444        {
     445            get
     446            {
     447                return this.IsPrivilegedField;
     448            }
     449            set
     450            {
     451                if ((this.IsPrivilegedField.Equals(value) != true))
     452                {
     453                    this.IsPrivilegedField = value;
     454                    this.RaisePropertyChanged("IsPrivileged");
    435455                }
    436456            }
     
    758778       
    759779        [System.Runtime.Serialization.OptionalFieldAttribute()]
     780        private double CpuUtilizationField;
     781       
     782        [System.Runtime.Serialization.OptionalFieldAttribute()]
    760783        private System.Nullable<int> FreeCoresField;
    761784       
     
    825848                    this.CpuSpeedField = value;
    826849                    this.RaisePropertyChanged("CpuSpeed");
     850                }
     851            }
     852        }
     853       
     854        [System.Runtime.Serialization.DataMemberAttribute()]
     855        public double CpuUtilization
     856        {
     857            get
     858            {
     859                return this.CpuUtilizationField;
     860            }
     861            set
     862            {
     863                if ((this.CpuUtilizationField.Equals(value) != true))
     864                {
     865                    this.CpuUtilizationField = value;
     866                    this.RaisePropertyChanged("CpuUtilization");
    827867                }
    828868            }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Job.cs

    r6200 r6267  
    3838      this.FinishWhenChildJobsFinished = original.FinishWhenChildJobsFinished;
    3939      this.HiveExperimentId = original.HiveExperimentId;
     40      this.IsPrivileged = original.IsPrivileged;
    4041    }
    4142
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/Slave.cs

    r5955 r6267  
    4242      this.CpuArchitecture = original.CpuArchitecture;
    4343      this.LastHeartbeat = original.LastHeartbeat;
     44      this.CpuUtilization = original.CpuUtilization;
    4445    }
    4546
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ApplicationConstants.cs

    r5786 r6267  
    2828    public static System.Data.IsolationLevel IsolationLevel = IsolationLevel.ReadUncommitted;
    2929
    30     /// <summary>
    31     /// ReadUncommitted to minimize deadlocks.
    32     /// </summary>
    33     public static System.Transactions.IsolationLevel IsolationLevelScope = System.Transactions.IsolationLevel.ReadUncommitted;
    34 
    3530    public static TimeSpan SlaveHeartbeatTimeout = TimeSpan.FromMinutes(1);
    3631
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Job.cs

    r6006 r6267  
    4444    [DataMember]
    4545    public Guid HiveExperimentId { get; set; }
     46    [DataMember]
     47    public bool IsPrivileged { get; set; }
    4648
    4749    public Job() {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/LightweightJob.cs

    r5786 r6267  
    3030  public class LightweightJob : HiveItem {
    3131    [DataMember]
    32     public TimeSpan? ExecutionTime { get; set; }
     32    public TimeSpan ExecutionTime { get; set; }
    3333    [DataMember]
    3434    public Guid? ParentJobId { get; set; }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs

    r6006 r6267  
    155155
    156156    [OperationContract]
     157    IEnumerable<Job> GetJobsByResourceId(Guid resourceId);
     158
     159    [OperationContract]
    157160    void TriggerLifecycle(bool force);
    158161    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r6229 r6267  
    3434        Id = source.JobId,
    3535        CoresNeeded = source.CoresNeeded,
    36         ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime),
     36        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
    3737        MemoryNeeded = source.MemoryNeeded,
    3838        ParentJobId = source.ParentJobId,
     
    4646        Command = source.Command,
    4747        LastJobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
    48         HiveExperimentId = source.HiveExperimentId
     48        HiveExperimentId = source.HiveExperimentId,
     49        IsPrivileged = source.IsPrivileged
    4950      };
    5051    }
     
    5859        target.JobId = source.Id;
    5960        target.CoresNeeded = source.CoresNeeded;
    60         target.ExecutionTime = source.ExecutionTime.ToString();
     61        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
    6162        target.MemoryNeeded = source.MemoryNeeded;
    6263        target.ParentJobId = source.ParentJobId;
     
    6869          target.StateLogs.Add(Convert.ToEntity(sl));
    6970        }
    70         //target.StateLogs.AddRange(source.StateLog.Select(x => Convert.ToEntity(x)).OrderBy(x => x.DateTime));
    7171        target.IsParentJob = source.IsParentJob;
    7272        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
     
    7474        // RequiredPlugins are added by Dao
    7575        target.HiveExperimentId = source.HiveExperimentId;
     76        target.IsPrivileged = source.IsPrivileged;
    7677      }
    7778    }
     
    338339        UserId = source.UserId,
    339340        UsedCores = source.UsedCores,
    340         ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime),
    341         ExecutionTimeFinishedJobs = string.IsNullOrEmpty(source.ExecutionTimeFinishedJobs) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTimeFinishedJobs),
    342         StartToEndTime = string.IsNullOrEmpty(source.StartToEndTime) ? TimeSpan.Zero : TimeSpan.Parse(source.StartToEndTime)
     341        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
     342        ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs),
     343        StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs)
    343344      };
    344345    }
     
    353354        target.UserId = source.UserId;
    354355        target.UsedCores = source.UsedCores;
    355         target.ExecutionTime = source.ExecutionTime.ToString();
    356         target.ExecutionTimeFinishedJobs = source.ExecutionTimeFinishedJobs.ToString();
    357         target.StartToEndTime = source.StartToEndTime.ToString();
     356        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
     357        target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds;
     358        target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds;
    358359      }
    359360    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r6229 r6267  
    559559      CollectParentResources(resources, resource.ParentResource);
    560560    }
     561
     562    /// <summary>
     563    /// Returns all child resources of a resource (without the given resource)
     564    /// </summary>
     565    public IEnumerable<DT.Resource> GetChildResources(Guid resourceId) {
     566      using (var db = CreateContext()) {
     567        var childs = new List<DT.Resource>();
     568        foreach (var child in db.Resources.Where(x => x.ParentResourceId == resourceId)) {
     569          childs.Add(Convert.ToDto(child));
     570          childs.AddRange(GetChildResources(child.ResourceId));
     571        }
     572        return childs;
     573      }
     574    }
     575
     576    public IEnumerable<DT.Job> GetJobsByResourceId(Guid resourceId) {
     577      using (var db = CreateContext()) {
     578        var resources = GetChildResources(resourceId).Select(x => x.Id).ToList();
     579        resources.Add(resourceId);
     580
     581        var jobs = db.Jobs.Where(j =>
     582          j.State == JobState.Calculating &&
     583          j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.HasValue &&
     584          resources.Contains(j.StateLogs.OrderByDescending(x => x.DateTime).First().SlaveId.Value));
     585        return jobs.Select(j => Convert.ToDto(j)).ToArray();
     586      }
     587    }
    561588    #endregion
    562589
     
    689716    public List<DT.UserStatistics> GetUserStatistics() {
    690717      using (var db = CreateContext()) {
     718        var userStats = new Dictionary<Guid, DT.UserStatistics>();
     719
     720        var usedCoresByUser = from job in db.Jobs
     721                              where job.State == JobState.Calculating
     722                              group job by job.HiveExperiment.OwnerUserId into g
     723                              select new { UserId = g.Key, UsedCores = g.Count() };
     724
     725        foreach (var item in usedCoresByUser) {
     726          if (!userStats.ContainsKey(item.UserId)) {
     727            userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId });
     728          }
     729          userStats[item.UserId].UsedCores += item.UsedCores;
     730        }
     731
    691732        var executionTimesByUser = from job in db.Jobs
    692733                                   group job by job.HiveExperiment.OwnerUserId into g
    693                                    select new { UserId = g.Key, ExecutionTimes = g.Select(x => x.ExecutionTime) };
    694 
    695         var userStats = new List<DT.UserStatistics>();
     734                                   select new { UserId = g.Key, ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) };
    696735        foreach (var item in executionTimesByUser) {
    697           userStats.Add(new DT.UserStatistics() {
    698             UserId = item.UserId,
    699             ExecutionTime = TimeSpan.FromMilliseconds(item.ExecutionTimes.Select(x => string.IsNullOrEmpty(x) ? 0 : TimeSpan.Parse(x).TotalMilliseconds).Sum())
    700           });
    701         }
    702 
    703         // Todo: also consider executiontimes of DeletedJobStats
    704         // Todo: compute executionTimeFinishedJobs und StartToEndTime (=> dient zum errechnen der Efficiency/Overhead)
    705 
    706         return userStats;
     736          if (!userStats.ContainsKey(item.UserId)) {
     737            userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId });
     738          }
     739          userStats[item.UserId].ExecutionTime += item.ExecutionTime;
     740        }
     741
     742        // execution times only of finished jobs - necessary to compute efficieny
     743        var executionTimesFinishedJobs = from job in db.Jobs
     744                                         where job.State == JobState.Finished
     745                                         group job by job.HiveExperiment.OwnerUserId into g
     746                                         select new { UserId = g.Key, ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) };
     747
     748        foreach (var item in executionTimesFinishedJobs) {
     749          if (!userStats.ContainsKey(item.UserId)) {
     750            userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId });
     751          }
     752          userStats[item.UserId].ExecutionTimeFinishedJobs += item.ExecutionTimeFinishedJobs;
     753        }
     754
     755        // start to end times only of finished jobs - necessary to compute efficiency
     756        var startToEndTimesFinishedJobs = from job in db.Jobs
     757                                          where job.State == JobState.Finished
     758                                          group job by job.HiveExperiment.OwnerUserId into g
     759                                          select new {
     760                                            UserId = g.Key,
     761                                            StartToEndTime = g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum()
     762                                          };
     763        foreach (var item in startToEndTimesFinishedJobs) {
     764          if (!userStats.ContainsKey(item.UserId)) {
     765            userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId });
     766          }
     767          userStats[item.UserId].StartToEndTime += item.StartToEndTime;
     768        }
     769
     770        // also consider executiontimes of DeletedJobStats
     771        var deletedJobsExecutionTimesByUsers = from del in db.DeletedJobStatistics
     772                                               group del by del.UserId into g
     773                                               select new {
     774                                                 UserId = g.Key,
     775                                                 ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()),
     776                                                 ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMsFinishedJobs).Sum()),
     777                                                 StartToEndTime = TimeSpan.FromMilliseconds(g.Select(x => x.StartToEndTimeMs).Sum())
     778                                               };
     779        foreach (var item in deletedJobsExecutionTimesByUsers) {
     780          if (!userStats.ContainsKey(item.UserId)) {
     781            userStats.Add(item.UserId, new DT.UserStatistics() { UserId = item.UserId });
     782          }
     783          userStats[item.UserId].ExecutionTime += item.ExecutionTime;
     784          userStats[item.UserId].ExecutionTimeFinishedJobs += item.ExecutionTimeFinishedJobs;
     785          userStats[item.UserId].StartToEndTime += item.StartToEndTime;
     786        }
     787
     788        return userStats.Values.ToList();
    707789      }
    708790    }
     
    719801    }
    720802    #endregion
    721 
    722 
    723 
     803  }
     804
     805  public static class TimeSpanExtensions {
     806    public static TimeSpan Sum(this IEnumerable<TimeSpan> ts) {
     807      return new TimeSpan(ts.Sum(r => r.Ticks));
     808    }
    724809  }
    725810}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r6229 r6267  
    6262      <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    6363      <Column Name="JobState" Member="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30)" CanBeNull="false" />
    64       <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="true" />
     64      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
    6565      <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    6666      <Column Name="ParentJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
     
    7272      <Column Name="Command" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.Command?" DbType="VarChar(30)" CanBeNull="true" />
    7373      <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
     74      <Column Name="IsPrivileged" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    7475      <Association Name="Job_AssignedResource" Member="AssignedResources" ThisKey="JobId" OtherKey="JobId" Type="AssignedResource" />
    7576      <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" />
     
    154155  <Table Name="" Member="DeletedJobStatistics">
    155156    <Type Name="DeletedJobStatistics">
    156       <Column Member="UserId" Type="System.String" IsPrimaryKey="true" CanBeNull="false" />
    157       <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
    158       <Column Name="ExecutionTimeFinishedJobs" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
    159       <Column Name="StartToEndTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     157      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
     158      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
     159      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
     160      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
     161      <Column Name="DeletedJobStatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    160162    </Type>
    161163  </Table>
     
    164166      <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    165167      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    166       <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     168      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
    167169      <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int" CanBeNull="false" />
    168       <Column Name="ExecutionTimeFinishedJobs" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
    169       <Column Name="StartToEndTime" Type="System.String" DbType="VarChar(30)" CanBeNull="false" />
     170      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
     171      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
    170172      <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
    171173    </Type>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r6229 r6267  
    2727      </nestedChildShapes>
    2828    </classShape>
    29     <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.1170068359374996">
     29    <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.3093082682291666">
    3030      <DataClassMoniker Name="/HiveDataContext/Job" />
    3131      <nestedChildShapes>
    32         <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.5570068359375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     32        <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.7493082682291665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    3333      </nestedChildShapes>
    3434    </classShape>
     
    6969      </nodes>
    7070    </inheritanceConnector>
    71     <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     71    <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.69314697265625); (10.875 : 4.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    7272      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
    7373      <nodes>
     
    7676      </nodes>
    7777    </associationConnector>
    78     <associationConnector edgePoints="[(7.5 : 4.1170068359375); (7.5 : 4.751650890625); (8.875 : 4.751650890625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     78    <associationConnector edgePoints="[(7.803710203125 : 4.30930826822917); (7.803710203125 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7979      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
    8080      <nodes>
     
    8383      </nodes>
    8484    </associationConnector>
    85     <associationConnector edgePoints="[(7.10742140625 : 4.1170068359375); (7.10742140625 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     85    <associationConnector edgePoints="[(7.0893551015625 : 4.30930826822917); (7.0893551015625 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    8686      <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
    8787      <nodes>
     
    123123      </nodes>
    124124    </associationConnector>
    125     <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     125    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    126126      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
    127127      <nodes>
     
    156156      </nestedChildShapes>
    157157    </classShape>
    158     <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     158    <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    159159      <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" />
    160160      <nodes>
     
    163163      </nodes>
    164164    </associationConnector>
    165     <associationConnector edgePoints="[(11.25 : 1.36339684440104); (10.9375 : 1.36339684440104); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     165    <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    166166      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" />
    167167      <nodes>
     
    183183      </nestedChildShapes>
    184184    </classShape>
    185     <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     185    <associationConnector edgePoints="[(6.125 : 3.46715413411458); (6.5 : 3.46715413411458)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    186186      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_Job" />
    187187      <nodes>
     
    190190      </nodes>
    191191    </associationConnector>
    192     <classShape Id="cdddf4da-eaef-46a1-9cfd-987bb6b3d03e" absoluteBounds="17, 3.125, 2, 1.5785953776041666">
     192    <classShape Id="cdddf4da-eaef-46a1-9cfd-987bb6b3d03e" absoluteBounds="17, 3.125, 2.5, 1.7708968098958327">
    193193      <DataClassMoniker Name="/HiveDataContext/DeletedJobStatistics" />
    194194      <nestedChildShapes>
    195         <elementListCompartment Id="b8738381-f696-4dba-a517-47e9cd96a9a6" absoluteBounds="17.015, 3.585, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     195        <elementListCompartment Id="b8738381-f696-4dba-a517-47e9cd96a9a6" absoluteBounds="17.015, 3.585, 2.4699999999999998, 1.2108968098958333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    196196      </nestedChildShapes>
    197197    </classShape>
     
    214214      </nestedChildShapes>
    215215    </classShape>
    216     <associationConnector edgePoints="[(21.4375 : 4.19399251302083); (21.4375 : 4.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     216    <associationConnector edgePoints="[(21.4375 : 4.19399251302083); (21.4375 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    217217      <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_SlaveStatistics" />
    218218      <nodes>
     
    221221      </nodes>
    222222    </associationConnector>
    223     <associationConnector edgePoints="[(22.5 : 4.19399251302083); (22.5 : 4.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     223    <associationConnector edgePoints="[(22.5 : 4.19399251302083); (22.5 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    224224      <AssociationMoniker Name="/HiveDataContext/Statistics/Statistics_UserStatistics" />
    225225      <nodes>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r6229 r6267  
    14741474    private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State;
    14751475   
    1476     private string _ExecutionTime;
     1476    private double _ExecutionTime;
    14771477   
    14781478    private System.Nullable<System.DateTime> _LastHeartbeat;
     
    14931493   
    14941494    private System.Guid _HiveExperimentId;
     1495   
     1496    private bool _IsPrivileged;
    14951497   
    14961498    private EntitySet<AssignedResource> _AssignedResources;
     
    15161518    partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value);
    15171519    partial void OnStateChanged();
    1518     partial void OnExecutionTimeChanging(string value);
    1519     partial void OnExecutionTimeChanged();
     1520    partial void OnExecutionTimeMsChanging(double value);
     1521    partial void OnExecutionTimeMsChanged();
    15201522    partial void OnLastHeartbeatChanging(System.Nullable<System.DateTime> value);
    15211523    partial void OnLastHeartbeatChanged();
     
    15361538    partial void OnHiveExperimentIdChanging(System.Guid value);
    15371539    partial void OnHiveExperimentIdChanged();
     1540    partial void OnIsPrivilegedChanging(bool value);
     1541    partial void OnIsPrivilegedChanged();
    15381542    #endregion
    15391543   
     
    15901594    }
    15911595   
    1592     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)")]
    1593     public string ExecutionTime
     1596    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
     1597    public double ExecutionTimeMs
    15941598    {
    15951599      get
     
    16011605        if ((this._ExecutionTime != value))
    16021606        {
    1603           this.OnExecutionTimeChanging(value);
     1607          this.OnExecutionTimeMsChanging(value);
    16041608          this.SendPropertyChanging();
    16051609          this._ExecutionTime = value;
    1606           this.SendPropertyChanged("ExecutionTime");
    1607           this.OnExecutionTimeChanged();
     1610          this.SendPropertyChanged("ExecutionTimeMs");
     1611          this.OnExecutionTimeMsChanged();
    16081612        }
    16091613      }
     
    17941798          this.SendPropertyChanged("HiveExperimentId");
    17951799          this.OnHiveExperimentIdChanged();
     1800        }
     1801      }
     1802    }
     1803   
     1804    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsPrivileged", DbType="Bit")]
     1805    public bool IsPrivileged
     1806    {
     1807      get
     1808      {
     1809        return this._IsPrivileged;
     1810      }
     1811      set
     1812      {
     1813        if ((this._IsPrivileged != value))
     1814        {
     1815          this.OnIsPrivilegedChanging(value);
     1816          this.SendPropertyChanging();
     1817          this._IsPrivileged = value;
     1818          this.SendPropertyChanged("IsPrivileged");
     1819          this.OnIsPrivilegedChanged();
    17961820        }
    17971821      }
     
    34303454    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    34313455   
    3432     private string _UserId;
    3433    
    3434     private string _ExecutionTime;
    3435    
    3436     private string _ExecutionTimeFinishedJobs;
    3437    
    3438     private string _StartToEndTime;
     3456    private System.Guid _UserId;
     3457   
     3458    private double _ExecutionTime;
     3459   
     3460    private double _ExecutionTimeFinishedJobs;
     3461   
     3462    private double _StartToEndTime;
     3463   
     3464    private System.Guid _DeletedJobStatisticsId;
    34393465   
    34403466    #region Extensibility Method Definitions
     
    34423468    partial void OnValidate(System.Data.Linq.ChangeAction action);
    34433469    partial void OnCreated();
    3444     partial void OnUserIdChanging(string value);
     3470    partial void OnUserIdChanging(System.Guid value);
    34453471    partial void OnUserIdChanged();
    3446     partial void OnExecutionTimeChanging(string value);
    3447     partial void OnExecutionTimeChanged();
    3448     partial void OnExecutionTimeFinishedJobsChanging(string value);
    3449     partial void OnExecutionTimeFinishedJobsChanged();
    3450     partial void OnStartToEndTimeChanging(string value);
    3451     partial void OnStartToEndTimeChanged();
     3472    partial void OnExecutionTimeMsChanging(double value);
     3473    partial void OnExecutionTimeMsChanged();
     3474    partial void OnExecutionTimeMsFinishedJobsChanging(double value);
     3475    partial void OnExecutionTimeMsFinishedJobsChanged();
     3476    partial void OnStartToEndTimeMsChanging(double value);
     3477    partial void OnStartToEndTimeMsChanged();
     3478    partial void OnDeletedJobStatisticsIdChanging(System.Guid value);
     3479    partial void OnDeletedJobStatisticsIdChanged();
    34523480    #endregion
    34533481   
     
    34573485    }
    34583486   
    3459     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", CanBeNull=false, IsPrimaryKey=true)]
    3460     public string UserId
     3487    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier NOT NULL")]
     3488    public System.Guid UserId
    34613489    {
    34623490      get
     
    34773505    }
    34783506   
    3479     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)", CanBeNull=false)]
    3480     public string ExecutionTime
     3507    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
     3508    public double ExecutionTimeMs
    34813509    {
    34823510      get
     
    34883516        if ((this._ExecutionTime != value))
    34893517        {
    3490           this.OnExecutionTimeChanging(value);
     3518          this.OnExecutionTimeMsChanging(value);
    34913519          this.SendPropertyChanging();
    34923520          this._ExecutionTime = value;
    3493           this.SendPropertyChanged("ExecutionTime");
    3494           this.OnExecutionTimeChanged();
    3495         }
    3496       }
    3497     }
    3498    
    3499     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="VarChar(30)", CanBeNull=false)]
    3500     public string ExecutionTimeFinishedJobs
     3521          this.SendPropertyChanged("ExecutionTimeMs");
     3522          this.OnExecutionTimeMsChanged();
     3523        }
     3524      }
     3525    }
     3526   
     3527    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
     3528    public double ExecutionTimeMsFinishedJobs
    35013529    {
    35023530      get
     
    35083536        if ((this._ExecutionTimeFinishedJobs != value))
    35093537        {
    3510           this.OnExecutionTimeFinishedJobsChanging(value);
     3538          this.OnExecutionTimeMsFinishedJobsChanging(value);
    35113539          this.SendPropertyChanging();
    35123540          this._ExecutionTimeFinishedJobs = value;
    3513           this.SendPropertyChanged("ExecutionTimeFinishedJobs");
    3514           this.OnExecutionTimeFinishedJobsChanged();
    3515         }
    3516       }
    3517     }
    3518    
    3519     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="VarChar(30)", CanBeNull=false)]
    3520     public string StartToEndTime
     3541          this.SendPropertyChanged("ExecutionTimeMsFinishedJobs");
     3542          this.OnExecutionTimeMsFinishedJobsChanged();
     3543        }
     3544      }
     3545    }
     3546   
     3547    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
     3548    public double StartToEndTimeMs
    35213549    {
    35223550      get
     
    35283556        if ((this._StartToEndTime != value))
    35293557        {
    3530           this.OnStartToEndTimeChanging(value);
     3558          this.OnStartToEndTimeMsChanging(value);
    35313559          this.SendPropertyChanging();
    35323560          this._StartToEndTime = value;
    3533           this.SendPropertyChanged("StartToEndTime");
    3534           this.OnStartToEndTimeChanged();
     3561          this.SendPropertyChanged("StartToEndTimeMs");
     3562          this.OnStartToEndTimeMsChanged();
     3563        }
     3564      }
     3565    }
     3566   
     3567    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DeletedJobStatisticsId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     3568    public System.Guid DeletedJobStatisticsId
     3569    {
     3570      get
     3571      {
     3572        return this._DeletedJobStatisticsId;
     3573      }
     3574      set
     3575      {
     3576        if ((this._DeletedJobStatisticsId != value))
     3577        {
     3578          this.OnDeletedJobStatisticsIdChanging(value);
     3579          this.SendPropertyChanging();
     3580          this._DeletedJobStatisticsId = value;
     3581          this.SendPropertyChanged("DeletedJobStatisticsId");
     3582          this.OnDeletedJobStatisticsIdChanged();
    35353583        }
    35363584      }
     
    35683616    private System.Guid _UserId;
    35693617   
    3570     private string _ExecutionTime;
     3618    private double _ExecutionTime;
    35713619   
    35723620    private int _CoresUsed;
    35733621   
    3574     private string _ExecutionTimeFinishedJobs;
    3575    
    3576     private string _StartToEndTime;
     3622    private double _ExecutionTimeFinishedJobs;
     3623   
     3624    private double _StartToEndTime;
    35773625   
    35783626    private EntityRef<Statistics> _Statistics;
     
    35863634    partial void OnUserIdChanging(System.Guid value);
    35873635    partial void OnUserIdChanged();
    3588     partial void OnExecutionTimeChanging(string value);
    3589     partial void OnExecutionTimeChanged();
     3636    partial void OnExecutionTimeMsChanging(double value);
     3637    partial void OnExecutionTimeMsChanged();
    35903638    partial void OnUsedCoresChanging(int value);
    35913639    partial void OnUsedCoresChanged();
    3592     partial void OnExecutionTimeFinishedJobsChanging(string value);
    3593     partial void OnExecutionTimeFinishedJobsChanged();
    3594     partial void OnStartToEndTimeChanging(string value);
    3595     partial void OnStartToEndTimeChanged();
     3640    partial void OnExecutionTimeMsFinishedJobsChanging(double value);
     3641    partial void OnExecutionTimeMsFinishedJobsChanged();
     3642    partial void OnStartToEndTimeMsChanging(double value);
     3643    partial void OnStartToEndTimeMsChanged();
    35963644    #endregion
    35973645   
     
    36463694    }
    36473695   
    3648     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)", CanBeNull=false)]
    3649     public string ExecutionTime
     3696    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
     3697    public double ExecutionTimeMs
    36503698    {
    36513699      get
     
    36573705        if ((this._ExecutionTime != value))
    36583706        {
    3659           this.OnExecutionTimeChanging(value);
     3707          this.OnExecutionTimeMsChanging(value);
    36603708          this.SendPropertyChanging();
    36613709          this._ExecutionTime = value;
    3662           this.SendPropertyChanged("ExecutionTime");
    3663           this.OnExecutionTimeChanged();
     3710          this.SendPropertyChanged("ExecutionTimeMs");
     3711          this.OnExecutionTimeMsChanged();
    36643712        }
    36653713      }
     
    36863734    }
    36873735   
    3688     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="VarChar(30)", CanBeNull=false)]
    3689     public string ExecutionTimeFinishedJobs
     3736    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
     3737    public double ExecutionTimeMsFinishedJobs
    36903738    {
    36913739      get
     
    36973745        if ((this._ExecutionTimeFinishedJobs != value))
    36983746        {
    3699           this.OnExecutionTimeFinishedJobsChanging(value);
     3747          this.OnExecutionTimeMsFinishedJobsChanging(value);
    37003748          this.SendPropertyChanging();
    37013749          this._ExecutionTimeFinishedJobs = value;
    3702           this.SendPropertyChanged("ExecutionTimeFinishedJobs");
    3703           this.OnExecutionTimeFinishedJobsChanged();
    3704         }
    3705       }
    3706     }
    3707    
    3708     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="VarChar(30)", CanBeNull=false)]
    3709     public string StartToEndTime
     3750          this.SendPropertyChanged("ExecutionTimeMsFinishedJobs");
     3751          this.OnExecutionTimeMsFinishedJobsChanged();
     3752        }
     3753      }
     3754    }
     3755   
     3756    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
     3757    public double StartToEndTimeMs
    37103758    {
    37113759      get
     
    37173765        if ((this._StartToEndTime != value))
    37183766        {
    3719           this.OnStartToEndTimeChanging(value);
     3767          this.OnStartToEndTimeMsChanging(value);
    37203768          this.SendPropertyChanging();
    37213769          this._StartToEndTime = value;
    3722           this.SendPropertyChanged("StartToEndTime");
    3723           this.OnStartToEndTimeChanged();
     3770          this.SendPropertyChanged("StartToEndTimeMs");
     3771          this.OnStartToEndTimeMsChanged();
    37243772        }
    37253773      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs

    r6229 r6267  
    9595    IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
    9696    IEnumerable<DT.Resource> GetParentResources(Guid resourceId);
     97    IEnumerable<DT.Job> GetJobsByResourceId(Guid resourceId);
    9798    #endregion
    9899
     
    123124    List<DT.UserStatistics> GetUserStatistics();
    124125    #endregion
    125 
    126 
    127 
    128126  }
    129127}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql

    r6229 r6267  
     1USE [HeuristicLab.Hive-3.4]
    12/* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */
    23
     
    108109GO
    109110
     111ALTER TABLE [dbo].[DeletedJobStatistics] ALTER COLUMN DeletedJobStatisticsId ADD ROWGUIDCOL;
     112ALTER TABLE [dbo].[DeletedJobStatistics] WITH NOCHECK ADD CONSTRAINT [DF_DeletedJobStatistics_DeletedJobStatisticsId] DEFAULT (newid()) FOR DeletedJobStatisticsId;
     113GO
     114
    110115ALTER TABLE [dbo].[SlaveStatistics]  DROP  CONSTRAINT [Statistics_SlaveStatistics]
    111116ALTER TABLE [dbo].[SlaveStatistics]  WITH CHECK ADD  CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY([StatisticsId])
     
    124129/* create indices */
    125130CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
     131GO
     132
     133/* views */
     134-- =============================================
     135-- Author:    cneumuel
     136-- Description: Returns the first StateLog entry for each job
     137-- =============================================
     138CREATE VIEW [dbo].[view_FirstState]
     139AS
     140SELECT     sl.JobId, sl.DateTime, sl.State
     141FROM         dbo.StateLog AS sl INNER JOIN
     142                          (SELECT     JobId, MIN(DateTime) AS DateTime
     143                            FROM          dbo.StateLog
     144                            GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
     145
     146GO
     147
     148-- =============================================
     149-- Author:    cneumuel
     150-- Description: Returns the last StateLog entry for each job
     151-- =============================================
     152CREATE VIEW [dbo].[view_LastState]
     153AS
     154SELECT     sl.JobId, sl.DateTime, sl.State
     155FROM         dbo.StateLog AS sl INNER JOIN
     156                          (SELECT     JobId, MAX(DateTime) AS DateTime
     157                            FROM          dbo.StateLog
     158                            GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
     159
     160GO
    126161
    127162/* triggers */
    128 USE [HeuristicLab.Hive-3.4]
    129163GO
    130164/****** Object:  Trigger [dbo].[tr_HiveExperimentDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
     
    136170-- Author:    cneumuel
    137171-- Create date: 19.04.2011
    138 -- Description: Deletes all associated jobs. This cannot be done with cascading delete,
     172-- Description: (1) Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics
     173--        (2) Deletes all associated jobs. This cannot be done with cascading delete,
    139174--              because the job table defines a INSTEAD OF DELETE trigger itself, which
    140175--              is not compatible with cascading deletes.
     
    154189CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS
    155190BEGIN
     191  -- add statistics
     192  INSERT INTO dbo.DeletedJobStatistics (UserId, ExecutionTimeMs, ExecutionTimeMsFinishedJobs, StartToEndTimeMs)
     193  SELECT
     194    he.OwnerUserId AS UserId,
     195    SUM(j.ExecutionTimeMs) AS ExecutionTimeMs,
     196    SUM(CASE ls.State WHEN 'Finished' THEN j.ExecutionTimeMs END) AS ExecutionTimeMsFinishedJobs,
     197    SUM(CASE ls.State WHEN 'Finished' THEN DATEDIFF(MS,fs.DateTime,ls.DateTime) ELSE 0 END) AS StartToEndMs
     198  FROM
     199    deleted j,
     200    HiveExperiment he,
     201    view_FirstState fs,
     202    view_LastState ls
     203  WHERE
     204    he.HiveExperimentId = j.HiveExperimentId AND
     205    fs.JobId = j.JobId AND
     206    ls.JobId = j.JobId
     207  GROUP BY he.OwnerUserId
     208
     209  -- recursively delete jobs
    156210  CREATE TABLE #Table(
    157211    JobId uniqueidentifier
     
    186240--CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Job] AFTER DELETE AS
    187241--BEGIN
    188 --  INSERT INTO DeletedJobStats SELECT JobId, ExecutionTime FROM deleted
     242
     243
    189244--END
     245--GO
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs

    r5708 r6267  
    11using System;
    22using System.Transactions;
    3 using HeuristicLab.Services.Hive.Common;
    43
    54namespace HeuristicLab.Services.Hive.DataAccess {
    65  public class TransactionManager {
    7     public void UseTransaction(Action call) {
    8       TransactionScope transaction = CreateTransaction();
     6    public void UseTransaction(Action call, bool serializable = false) {
     7      TransactionScope transaction = serializable ? CreateSerializableTransaction() : CreateTransaction();
    98      try {
    109        call();
     
    1615    }
    1716
    18     public T UseTransaction<T>(Func<T> call) {
    19       TransactionScope transaction = CreateTransaction();
     17    public T UseTransaction<T>(Func<T> call, bool serializable = false) {
     18      TransactionScope transaction = serializable ? CreateSerializableTransaction() : CreateTransaction();
    2019      try {
    2120        T result = call();
     
    2928
    3029    private static TransactionScope CreateTransaction() {
    31       return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.IsolationLevelScope });
     30      return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted });
     31    }
     32    private static TransactionScope CreateSerializableTransaction() {
     33      return new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.Serializable });
    3234    }
    3335  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r6229 r6267  
    3939      job1.Command = Command.Pause;
    4040      job1.HiveExperimentId = he.Id;
     41      job1.IsPrivileged = true;
    4142
    4243      DT.JobData jobData1 = new DT.JobData();
     
    7576      Assert.AreEqual(job1.Command, job1loaded.Command);
    7677      Assert.AreEqual(job1.HiveExperimentId, job1loaded.HiveExperimentId);
     78      Assert.AreEqual(job1.IsPrivileged, job1loaded.IsPrivileged);
    7779      Assert.IsTrue(Math.Abs((job1loaded.LastJobDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1);
    7880      for (int i = 0; i < job1.StateLog.Count; i++) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs

    r6006 r6267  
    147147      jobLoaded = service.GetJob(job.Id);
    148148      Assert.AreEqual(JobState.Calculating, jobLoaded.State);
    149       Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime.Value);
     149      Assert.AreEqual(new TimeSpan(1, 5, 10, 20, 30), jobLoaded.ExecutionTime);
     150
     151      // test if the job is returned for the resource
     152      var jobsBySlave = service.GetJobsByResourceId(slave.Id);
     153      Assert.AreEqual(1, jobsBySlave.Count());
     154      Assert.AreEqual(job.Id, jobsBySlave.Single().Id);
     155     
     156      // set it to finished
     157      service.UpdateJobState(jobLoaded.Id, JobState.Finished, slave.Id, null, null);
     158
     159      // test if the job is returned for the resource
     160      var jobsBySlave2 = service.GetJobsByResourceId(slave.Id);
     161      Assert.AreEqual(0, jobsBySlave2.Count());
    150162
    151163      // delete
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r6168 r6267  
    147147      return trans.UseTransaction(() => {
    148148        Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception);
    149        
     149
    150150        if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == JobState.Paused) {
    151151          job.Command = null;
     
    280280          dbSlave.Memory = slaveInfo.Memory;
    281281          dbSlave.OperatingSystem = slaveInfo.OperatingSystem;
    282          
    283           dbSlave.LastHeartbeat = DateTime.Now;         
     282
     283          dbSlave.LastHeartbeat = DateTime.Now;
    284284          dbSlave.SlaveState = SlaveState.Idle;
    285285
     
    472472
    473473    public void TriggerLifecycle(bool force) {
     474      // use a serializable transaction here to ensure not two threads execute this simultaniously (locking would not work since IIS may use multiple AppDomains)
    474475      trans.UseTransaction(() => {
    475476        DateTime lastCleanup = dao.GetLastCleanup();
     
    478479          lifecycleManager.Cleanup();
    479480        }
    480       });
     481      }, true);
    481482    }
    482483    #endregion
     
    526527      return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
    527528    }
     529
     530    public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) {
     531      return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
     532    }
    528533    #endregion
    529534  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs

    r6229 r6267  
    5252
    5353      dao.AddStatistics(stats);
    54 
    55       //int slaveCount = slaves.Count();
    56       //int cores = slaves.Select(x => x.Cores.HasValue ? x.Cores.Value : 0).Sum();
    57       //int usedCores = slaves.Select(x => x.FreeCores.HasValue ? x.FreeCores.Value : 0).Sum();
    58 
    59       //long memoryMb = slaves.Select(x => x.Memory.HasValue ? x.Memory.Value : 0).Sum(); ;
    60       //long memoryUsedMb = slaves.Select(x => x.FreeMemory.HasValue ? x.FreeMemory.Value : 0).Sum();
    61 
    62       //double averageCpuUtilization = slaves.Select(x => x.CpuUtilization.HasValue ? x.CpuUtilization.Value : 0).Average();
    63 
    64       //int executionTimeDelta = 0; // since last update
    65 
    66       //{ // per user
    67       //  int activeJobs = 0; // calculating, transferring
    68       //  int waitingJobs = 0; // waiting
    69       //  int stoppedJobs = 0; // finished, failed, aborted, paused
    70       //}
    71 
    72       //{ // per slave
    73       //  int activeJobs = 0; // calculating, transferring
    74       //  double cpuUtilization = 0.0;
    75       //}
    76 
    7754    }
    7855
Note: See TracChangeset for help on using the changeset viewer.