Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/11 13:41:25 (13 years ago)
Author:
ascheibe
Message:

#1233 Review comments: renamed Job to Task

Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r6712 r6721  
    55CREATE TABLE [dbo].[AssignedResources](
    66  [ResourceId] UniqueIdentifier NOT NULL,
    7   [JobId] UniqueIdentifier NOT NULL,   
    8   CONSTRAINT [PK_dbo.ResourceIdJobId] PRIMARY KEY ([ResourceId], [JobId])
     7  [TaskId] UniqueIdentifier NOT NULL,   
     8  CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId])
    99  )
    1010CREATE TABLE [dbo].[Plugin](
     
    1919CREATE TABLE [dbo].[RequiredPlugins](
    2020  [RequiredPluginId] UniqueIdentifier NOT NULL,
    21   [JobId] UniqueIdentifier NOT NULL,
     21  [TaskId] UniqueIdentifier NOT NULL,
    2222  [PluginId] UniqueIdentifier NOT NULL,
    2323  CONSTRAINT [PK_dbo.RequiredPlugins] PRIMARY KEY ([RequiredPluginId])
     
    4242  CONSTRAINT [PK_dbo.Resource] PRIMARY KEY ([ResourceId])
    4343  )
    44 CREATE TABLE [dbo].[Job](
    45   [JobId] UniqueIdentifier NOT NULL,
    46   [JobState] VarChar(30),
     44CREATE TABLE [dbo].[Task](
     45  [TaskId] UniqueIdentifier NOT NULL,
     46  [TaskState] VarChar(30),
    4747  [ExecutionTimeMs] float,
    4848  [LastHeartbeat] DateTime,
    49   [ParentJobId] UniqueIdentifier,
     49  [ParentTaskId] UniqueIdentifier,
    5050  [Priority] Int NOT NULL,
    5151  [CoresNeeded] Int NOT NULL,
    5252  [MemoryNeeded] Int NOT NULL,
    53   [IsParentJob] Bit,
     53  [IsParentTask] Bit,
    5454  [FinishWhenChildJobsFinished] Bit,
    5555  [Command] VarChar(30),
    5656  [HiveExperimentId] UniqueIdentifier NOT NULL,
    5757  [IsPrivileged] Bit,
    58   CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
     58  CONSTRAINT [PK_dbo.Task] PRIMARY KEY ([TaskId])
    5959  )
    6060CREATE TABLE [dbo].[Downtime](
     
    7979  CONSTRAINT [PK_dbo.HiveExperiment] PRIMARY KEY ([HiveExperimentId])
    8080  )
    81 CREATE TABLE [dbo].[JobData](
    82   [JobId] UniqueIdentifier NOT NULL,
     81CREATE TABLE [dbo].[TaskData](
     82  [TaskId] UniqueIdentifier NOT NULL,
    8383  [Data] VarBinary(MAX),
    8484  [LastUpdate] DateTime,
    85   CONSTRAINT [PK_dbo.JobData] PRIMARY KEY ([JobId])
     85  CONSTRAINT [PK_dbo.TaskData] PRIMARY KEY ([TaskId])
    8686  )
    8787CREATE TABLE [dbo].[PluginData](
     
    9696  [State] VarChar(30) NOT NULL,
    9797  [DateTime] DateTime NOT NULL,
    98   [JobId] UniqueIdentifier NOT NULL,
     98  [TaskId] UniqueIdentifier NOT NULL,
    9999  [UserId] UniqueIdentifier,
    100100  [SlaveId] UniqueIdentifier,
     
    149149  ADD CONSTRAINT [Resource_AssignedResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
    150150ALTER TABLE [dbo].[AssignedResources]
    151   ADD CONSTRAINT [Job_AssignedResource] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
     151  ADD CONSTRAINT [Task_AssignedResource] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
    152152ALTER TABLE [dbo].[RequiredPlugins]
    153153  ADD CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
    154154ALTER TABLE [dbo].[RequiredPlugins]
    155   ADD CONSTRAINT [Job_RequiredPlugin] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
     155  ADD CONSTRAINT [Task_RequiredPlugin] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
    156156ALTER TABLE [dbo].[Resource]
    157157  ADD CONSTRAINT [Resource_Resource] FOREIGN KEY ([ParentResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
    158 ALTER TABLE [dbo].[Job]
    159   ADD CONSTRAINT [Job_Job] FOREIGN KEY ([ParentJobId]) REFERENCES [dbo].[Job]([JobId])
    160 ALTER TABLE [dbo].[Job]
     158ALTER TABLE [dbo].[Task]
     159  ADD CONSTRAINT [Task_Task] FOREIGN KEY ([ParentTaskId]) REFERENCES [dbo].[Task]([TaskId])
     160ALTER TABLE [dbo].[Task]
    161161  ADD CONSTRAINT [HiveExperiment_Job] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
    162162ALTER TABLE [dbo].[Downtime]
    163163  ADD CONSTRAINT [Resource_Downtime] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
    164 ALTER TABLE [dbo].[JobData]
    165   ADD CONSTRAINT [Job_JobData] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
     164ALTER TABLE [dbo].[TaskData]
     165  ADD CONSTRAINT [Task_TaskData] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
    166166ALTER TABLE [dbo].[PluginData]
    167167  ADD CONSTRAINT [Plugin_PluginData] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
    168168ALTER TABLE [dbo].[StateLog]
    169   ADD CONSTRAINT [Job_StateLog] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
     169  ADD CONSTRAINT [Task_StateLog] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
    170170ALTER TABLE [dbo].[StateLog]
    171171  ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY ([SlaveId]) REFERENCES [dbo].[Resource]([ResourceId])
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql

    r6712 r6721  
    88
    99
    10 ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Job_AssignedResource]
    11 ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Job_AssignedResource] FOREIGN KEY([JobId])
    12 REFERENCES [dbo].[Job] ([JobId])
     10ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Task_AssignedResource]
     11ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Task_AssignedResource] FOREIGN KEY([TaskId])
     12REFERENCES [dbo].[Task] ([TaskId])
    1313ON UPDATE CASCADE
    1414ON DELETE CASCADE
     
    2121GO
    2222
    23 ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
    24 ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (NEWSEQUENTIALID()) FOR JobId;
    25 GO
    26 
    27 ALTER TABLE [dbo].[StateLog]  DROP  CONSTRAINT [Job_StateLog]
    28 ALTER TABLE [dbo].[StateLog]  WITH CHECK ADD CONSTRAINT [Job_StateLog] FOREIGN KEY([JobId])
    29 REFERENCES [dbo].[Job] ([JobId])
     23ALTER TABLE dbo.Task ALTER COLUMN TaskId ADD ROWGUIDCOL;
     24ALTER TABLE dbo.Task WITH NOCHECK ADD CONSTRAINT [DF_Task_TaskId] DEFAULT (NEWSEQUENTIALID()) FOR TaskId;
     25GO
     26
     27ALTER TABLE [dbo].[StateLog]  DROP  CONSTRAINT [Task_StateLog]
     28ALTER TABLE [dbo].[StateLog]  WITH CHECK ADD CONSTRAINT [Task_StateLog] FOREIGN KEY([TaskId])
     29REFERENCES [dbo].[Task] ([TaskId])
    3030ON UPDATE CASCADE
    3131ON DELETE CASCADE
     
    5454ALTER TABLE dbo.RequiredPlugins WITH NOCHECK ADD CONSTRAINT [DF_RequiredPlugins_RequiredPluginId] DEFAULT (NEWSEQUENTIALID()) FOR RequiredPluginId;
    5555
    56 ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [Job_RequiredPlugin]
    57 ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [Job_RequiredPlugin] FOREIGN KEY([JobId])
    58 REFERENCES [dbo].[Job] ([JobId])
     56ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [Task_RequiredPlugin]
     57ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [Task_RequiredPlugin] FOREIGN KEY([TaskId])
     58REFERENCES [dbo].[Task] ([TaskId])
    5959ON UPDATE CASCADE
    6060ON DELETE CASCADE
     
    110110
    111111/* create indices */
    112 CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
     112CREATE INDEX Index_RequiredPlugins_TaskId ON RequiredPlugins(TaskId);
    113113GO
    114114
     
    120120CREATE VIEW [dbo].[view_FirstState]
    121121AS
    122 SELECT     sl.JobId, sl.DateTime, sl.State
     122SELECT     sl.TaskId, sl.DateTime, sl.State
    123123FROM         dbo.StateLog AS sl INNER JOIN
    124                           (SELECT     JobId, MIN(DateTime) AS DateTime
     124                          (SELECT     TaskId, MIN(DateTime) AS DateTime
    125125                            FROM          dbo.StateLog
    126                             GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
     126                            GROUP BY TaskId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.TaskId = minDate.TaskId
    127127
    128128GO
     
    134134CREATE VIEW [dbo].[view_LastState]
    135135AS
    136 SELECT     sl.JobId, sl.DateTime, sl.State
     136SELECT     sl.TaskId, sl.DateTime, sl.State
    137137FROM         dbo.StateLog AS sl INNER JOIN
    138                           (SELECT     JobId, MAX(DateTime) AS DateTime
     138                          (SELECT     TaskId, MAX(DateTime) AS DateTime
    139139                            FROM          dbo.StateLog
    140                             GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
     140                            GROUP BY TaskId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.TaskId = minDate.TaskId
    141141GO
    142142
     
    176176CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] INSTEAD OF DELETE AS
    177177BEGIN
    178   DELETE Job FROM deleted, Job WHERE deleted.HiveExperimentId = Job.HiveExperimentId
     178  DELETE Task FROM deleted, Task WHERE deleted.HiveExperimentId = Task.HiveExperimentId
    179179  DELETE HiveExperiment FROM deleted, HiveExperiment WHERE deleted.HiveExperimentId = HiveExperiment.HiveExperimentId
    180180END
     
    186186-- Description: Recursively deletes all child-jobs of a job when it is deleted. (Source: http://devio.wordpress.com/2008/05/23/recursive-delete-in-sql-server/)
    187187-- =============================================
    188 CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS
     188CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS
    189189BEGIN
    190190  -- add statistics
     
    202202  WHERE
    203203    he.HiveExperimentId = j.HiveExperimentId AND
    204     fs.JobId = j.JobId AND
    205     ls.JobId = j.JobId
     204    fs.TaskId = j.TaskId AND
     205    ls.TaskId = j.TaskId
    206206  GROUP BY he.OwnerUserId
    207207
    208208  -- recursively delete jobs
    209209  CREATE TABLE #Table(
    210     JobId uniqueidentifier
     210    TaskId uniqueidentifier
    211211  )
    212   INSERT INTO #Table (JobId)
    213   SELECT JobId FROM deleted
     212  INSERT INTO #Table (TaskId)
     213  SELECT TaskId FROM deleted
    214214 
    215215  DECLARE @c INT
    216216  SET @c = 0
    217217 
    218   WHILE @c <> (SELECT COUNT(JobId) FROM #Table) BEGIN
    219     SELECT @c = COUNT(JobId) FROM #Table
     218  WHILE @c <> (SELECT COUNT(TaskId) FROM #Table) BEGIN
     219    SELECT @c = COUNT(TaskId) FROM #Table
    220220   
    221     INSERT INTO #Table (JobId)
    222       SELECT Job.JobId
    223       FROM Job
    224       LEFT OUTER JOIN #Table ON Job.JobId = #Table.JobId
    225       WHERE Job.ParentJobId IN (SELECT JobId FROM #Table)
    226         AND #Table.JobId IS NULL
     221    INSERT INTO #Table (TaskId)
     222      SELECT Task.TaskId
     223      FROM Task
     224      LEFT OUTER JOIN #Table ON Task.TaskId = #Table.TaskId
     225      WHERE Task.ParentTaskId IN (SELECT TaskId FROM #Table)
     226        AND #Table.TaskId IS NULL
    227227  END
    228228 
    229   DELETE JobData FROM JobData INNER JOIN #Table ON JobData.JobId = #Table.JobId
    230   DELETE Job FROM Job INNER JOIN #Table ON Job.JobId = #Table.JobId
     229  DELETE TaskData FROM TaskData INNER JOIN #Table ON TaskData.TaskId = #Table.TaskId
     230  DELETE Task FROM Task INNER JOIN #Table ON Task.TaskId = #Table.TaskId
    231231END
    232232GO
     
    235235-- Author:    cneumuel
    236236-- Create date: 17.05.2011
    237 -- Description: Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics
    238 -- =============================================
    239 --CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Job] AFTER DELETE AS
     237-- Description: Writes the execution times of deleted Tasks into DeletedJobStats to ensure correct statistics
     238-- =============================================
     239--CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Task] AFTER DELETE AS
    240240--BEGIN
    241241
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Query Jobs.sql

    r6712 r6721  
    11/****** Script for SelectTopNRows command from SSMS  ******/
    2 SELECT j.[JobId]
    3       ,j.[JobState]
     2SELECT j.[TaskId]
     3      ,j.[TaskState]
    44      ,j.[ExecutionTimeMs]/1000/60/60 AS ExecutionTimeHours
    55      ,DATALENGTH(jd.data)/1024.0/1024.0 AS MB
     
    1313      ,j.[IsPrivileged]
    1414      ,j.[Command]
    15       ,j.[IsParentJob]   
     15      ,j.[IsParentTask]   
    1616      ,j.[FinishWhenChildJobsFinished]
    17       ,j.[ParentJobId]
     17      ,j.[ParentTaskId]
    1818      , he.HiveExperimentId
    1919  FROM
    20   [HeuristicLab.Hive-3.3].[dbo].[Job] j
     20  [HeuristicLab.Hive-3.3].[dbo].[Task] j
    2121  ,[HeuristicLab.Hive-3.3].[dbo].[HiveExperiment] he
    2222  ,[HeuristicLab.Authentication].dbo.aspnet_Users u
    23   ,[HeuristicLab.Hive-3.3].dbo.JobData jd
     23  ,[HeuristicLab.Hive-3.3].dbo.TaskData jd
    2424  WHERE
    2525  j.HiveExperimentId = he.HiveExperimentId
    26   AND j.JobId = jd.JobId
     26  AND j.TaskId = jd.TaskId
    2727  AND he.OwnerUserId = u.UserId
    2828  --AND he.DateCreated > '06-03-2011 10:30'
    2929 
    30 ORDER BY j.JobState, he.DateCreated DESC
     30ORDER BY j.TaskState, he.DateCreated DESC
Note: See TracChangeset for help on using the changeset viewer.