Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/24/11 16:55:48 (13 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)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.