Changeset 4769


Ignore:
Timestamp:
11/11/10 10:46:12 (9 years ago)
Author:
cneumuel
Message:

#1260

  • delete cascade for HiveExperiments and Jobs database
  • automatic downloading of HiveExperiments-List in HiveExperimentManager
Location:
branches/HeuristicLab.Hive/sources/HeuristicLab.Hive
Files:
1 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Calendar/3.3/Properties/AssemblyInfo.cs

    r4760 r4769  
    5858// [assembly: AssemblyVersion("1.0.*")]
    5959[assembly: AssemblyVersion("3.3.0.0")]
    60 [assembly: AssemblyFileVersion("3.3.0.4755")]
     60[assembly: AssemblyFileVersion("3.3.0.4760")]
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager.Views/3.3/HiveExperimentManagerView.cs

    r4760 r4769  
    5353      Content_HiveExperimentsChanged(this, EventArgs.Empty);
    5454      Content_IsProgressingChanged(this, EventArgs.Empty);
     55      if(Content != null) UpdateExperimentsAsync();
    5556    }
    5657
     
    7879
    7980    private void updateExperimentsButton_Click(object sender, EventArgs e) {
    80       MethodInvoker invoker = new MethodInvoker(Content.UpdateExperimentList);
    81       invoker.BeginInvoke((ar) => {
    82         try {
    83           invoker.EndInvoke(ar);
    84         }
    85         catch (Exception ex) {
    86           ThreadPool.QueueUserWorkItem(delegate(object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
    87         }
    88       }, null);
     81      if(Content != null) UpdateExperimentsAsync();
    8982    }
    9083
     
    116109      }
    117110    }
     111
     112    private void UpdateExperimentsAsync() {
     113      MethodInvoker invoker = new MethodInvoker(Content.UpdateExperimentList);
     114      invoker.BeginInvoke((ar) => {
     115        try {
     116          invoker.EndInvoke(ar);
     117        }
     118        catch (Exception ex) {
     119          ThreadPool.QueueUserWorkItem(delegate(object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex);
     120        }
     121      }, null);
     122    }
    118123  }
    119124}
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager.Views/3.3/HiveExperimentView.Designer.cs

    r4760 r4769  
    313313      this.disconnectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    314314      this.disconnectButton.Enabled = false;
    315       this.disconnectButton.Location = new System.Drawing.Point(131, 500);
     315      this.disconnectButton.Location = new System.Drawing.Point(234, 500);
    316316      this.disconnectButton.Name = "disconnectButton";
    317317      this.disconnectButton.Size = new System.Drawing.Size(120, 24);
    318318      this.disconnectButton.TabIndex = 15;
    319       this.disconnectButton.Text = "Disconnect from Hive";
     319      this.disconnectButton.Text = "Stop Result Polling";
    320320      this.toolTip.SetToolTip(this.disconnectButton, "Disconnect from Hive (Jobs will be continue to be calculated)");
    321321      this.disconnectButton.UseVisualStyleBackColor = true;
     
    326326      this.reconnectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    327327      this.reconnectButton.Enabled = false;
    328       this.reconnectButton.Location = new System.Drawing.Point(257, 500);
     328      this.reconnectButton.Location = new System.Drawing.Point(120, 500);
    329329      this.reconnectButton.Name = "reconnectButton";
    330       this.reconnectButton.Size = new System.Drawing.Size(77, 24);
     330      this.reconnectButton.Size = new System.Drawing.Size(108, 24);
    331331      this.reconnectButton.TabIndex = 16;
    332       this.reconnectButton.Text = "Reconnect";
     332      this.reconnectButton.Text = "Start Result Polling";
    333333      this.toolTip.SetToolTip(this.reconnectButton, "Reconnect to Hive");
    334334      this.reconnectButton.UseVisualStyleBackColor = true;
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager.Views/3.3/HiveExperimentView.resx

    r4423 r4769  
    204204        fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+
    205205        tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/
    206         6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAAOvgAADr4B6kKxwAAAA2JJREFUOE9lk31MFHQY
     206        6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAAOvQAADr0BR/uQrQAAA2JJREFUOE9lk31MFHQY
    207207        x59JZIU62/QPF1gauDJXjkpyZLxVMEEubgpKU0NePKS6yp168qaJ4OIlMhUH6hRWChyuuuTaQjqFk8j0
    208208        MEhlURdMRgp0XERccfjpx7G1Vn8822+/fb/fz/f54xFA/jtDf03S4fyTloE/6PhlFNfvY0xMTCjZ/7X/
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.ExperimentManager/3.3/HeuristicLab.Hive.ExperimentManager-3.3.csproj

    r4760 r4769  
    125125    <Compile Include="JobResultPoller.cs" />
    126126    <Compile Include="Exceptions\JobResultPollingException.cs" />
    127     <Compile Include="HiveClient.cs" />
     127    <Compile Include="HiveExperimentManager.cs" />
    128128    <Compile Include="HiveExperimentList.cs" />
    129129    <Compile Include="HeuristicLabHiveExperimentManagerPlugin.cs" />
  • branches/HeuristicLab.Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/Scripts/prepareHiveDatabase.sql

    r4423 r4769  
    11/* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */
     2USE [HeuristicLab.Hive]
     3GO
    24
    35/*
     
    3234ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId ADD ROWGUIDCOL;
    3335ALTER TABLE dbo.AssignedResources WITH NOCHECK ADD CONSTRAINT [DF_AssignedResources_AssignedRessourcesId] DEFAULT (newid()) FOR AssignedRessourcesId;
     36ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Job_AssignedResource]
     37ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Job_AssignedResource] FOREIGN KEY([JobId])
     38REFERENCES [dbo].[Job] ([JobId])
     39ON UPDATE CASCADE
     40ON DELETE CASCADE
     41GO
     42ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Resource_AssignedResource]
     43ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId])
     44REFERENCES [dbo].[Resource] ([ResourceId])
     45ON UPDATE CASCADE
     46ON DELETE CASCADE
     47GO
    3448
    3549ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
     
    5165ALTER TABLE dbo.RequiredPlugins WITH NOCHECK ADD CONSTRAINT [DF_RequiredPlugins_RequiredPluginId] DEFAULT (newid()) FOR RequiredPluginId;
    5266
     67ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [Job_RequiredPlugin]
     68ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [Job_RequiredPlugin] FOREIGN KEY([JobId])
     69REFERENCES [dbo].[Job] ([JobId])
     70ON UPDATE CASCADE
     71ON DELETE CASCADE
     72GO
     73
     74ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [PluginInfo_RequiredPlugin]
     75ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [PluginInfo_RequiredPlugin] FOREIGN KEY([PluginId])
     76REFERENCES [dbo].[PluginInfo] ([PluginId])
     77ON UPDATE CASCADE
     78ON DELETE CASCADE
     79GO
     80
    5381ALTER TABLE dbo.Resource ALTER COLUMN ResourceId ADD ROWGUIDCOL;
    5482ALTER TABLE dbo.Resource WITH NOCHECK ADD CONSTRAINT [DF_Resource_ResourceId] DEFAULT (newid()) FOR ResourceId;
     
    6593/* create indices */
    6694CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
     95
     96/* triggers */
     97SET ANSI_NULLS ON
     98GO
     99SET QUOTED_IDENTIFIER ON
     100GO
     101-- =============================================
     102-- Author:    cneumuel
     103-- Create date: 11.11.2010
     104-- Description: Deletes the root-job of the experiment when experiment is deleted
     105-- =============================================
     106CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] FOR DELETE AS
     107SET NOCOUNT ON
     108DELETE Job FROM deleted, Job WHERE Job.JobId = deleted.RootJobId
     109GO
     110
     111SET ANSI_NULLS ON
     112GO
     113SET QUOTED_IDENTIFIER ON
     114GO
     115-- =============================================
     116-- Author:    cneumuel
     117-- Create date: 11.11.2010
     118-- 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/)
     119-- =============================================
     120CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS
     121BEGIN
     122  CREATE TABLE #Table(
     123    JobId uniqueidentifier
     124  )
     125  INSERT INTO #Table (JobId)
     126  SELECT JobId FROM deleted
     127 
     128  DECLARE @c INT
     129  SET @c = 0
     130 
     131  WHILE @c <> (SELECT COUNT(JobId) FROM #Table) BEGIN
     132    SELECT @c = COUNT(JobId) FROM #Table
     133   
     134    INSERT INTO #Table (JobId)
     135      SELECT Job.JobId
     136      FROM Job
     137      LEFT OUTER JOIN #Table ON Job.JobId = #Table.JobId
     138      WHERE Job.ParentJobId IN (SELECT JobId FROM #Table)
     139        AND #Table.JobId IS NULL
     140  END
     141 
     142  DELETE Job FROM Job INNER JOIN #Table ON Job.JobId = #Table.JobId
     143END
Note: See TracChangeset for help on using the changeset viewer.