Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/11 13:43:05 (13 years ago)
Author:
cneumuel
Message:

#1233

  • changed relationship between Job and HiveExperiment. There is no more HiveExperiment.RootJobId, instead there is Job.HiveExperimentId.
  • One HiveExperiment can now have multiple Experiments.
  • TreeView supports multiple root nodes
  • HiveEngine creates a HiveExperiment for each set of jobs, so jobs cannot be without an parent experiment anymore (no more loose jobs)
  • updated ExperimentManager binaries
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources

    • Property svn:ignore
      •  

        old new  
        44PrecompiledWeb
        55CreateEventLogSources
         6WindowsFormsTestProject
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r5786 r6006  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Data.Linq;
    2425using System.Linq;
     
    3738        ParentJobId = source.ParentJobId,
    3839        Priority = source.Priority,
    39         PluginsNeededIds = source.RequiredPlugins.Select(x => x.PluginId).ToList(),
     40        PluginsNeededIds = (source.RequiredPlugins == null ? new List<Guid>() : source.RequiredPlugins.Select(x => x.PluginId).ToList()),
    4041        LastHeartbeat = source.LastHeartbeat,
    4142        State = source.State,
    42         StateLog = source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList(),
     43        StateLog = (source.StateLogs == null ? new List<DT.StateLog>() : source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()),
    4344        IsParentJob = source.IsParentJob,
    4445        FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished,
    4546        Command = source.Command,
    46         LastJobDataUpdate = source.JobData.LastUpdate
     47        LastJobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
     48        HiveExperimentId = source.HiveExperimentId
    4749      };
    4850    }
     
    7173        target.Command = source.Command;
    7274        // RequiredPlugins are added by Dao
     75        target.HiveExperimentId = source.HiveExperimentId;
    7376      }
    7477    }
     
    129132    public static DT.HiveExperiment ToDto(HiveExperiment source) {
    130133      if (source == null) return null;
    131       return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
     134      return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
    132135    }
    133136    public static HiveExperiment ToEntity(DT.HiveExperiment source) {
     
    138141    public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) {
    139142      if ((source != null) && (target != null)) {
    140         target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
     143        target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
    141144      }
    142145    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r5955 r6006  
    237237
    238238    private DT.HiveExperiment AddStatsToExperiment(HiveDataContext db, DT.HiveExperiment exp) {
    239       var jobs = new List<Job>();
    240       CollectChildJobs(db, exp.RootJobId, jobs);
    241       exp.JobCount = jobs.Count;
     239      if (exp == null)
     240        return null;
     241
     242      var jobs = db.Jobs.Where(j => j.HiveExperimentId == exp.Id);
     243      exp.JobCount = jobs.Count();
    242244      exp.CalculatingCount = jobs.Count(j => j.State == JobState.Calculating);
    243245      exp.FinishedCount = jobs.Count(j => j.State == JobState.Finished);
     
    575577    public Guid GetExperimentForJob(Guid jobId) {
    576578      using (var db = CreateContext()) {
    577         var job = db.Jobs.SingleOrDefault(j => j.JobId == jobId);
    578         if (job.ParentJobId.HasValue) {
    579           return GetExperimentForJob(job.ParentJobId.Value);
    580         } else {
    581           return db.HiveExperiments.SingleOrDefault(he => he.RootJobId == jobId).HiveExperimentId;
    582         }
     579        return db.Jobs.Single(j => j.JobId == jobId).HiveExperimentId;
    583580      }
    584581    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r5779 r6006  
    7070      <Column Name="FinishWhenChildJobsFinished" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    7171      <Column Name="Command" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.Command?" DbType="VarChar(30)" CanBeNull="true" />
     72      <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    7273      <Association Name="Job_AssignedResource" Member="AssignedResources" ThisKey="JobId" OtherKey="JobId" Type="AssignedResource" />
    7374      <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" />
     
    7677      <Association Name="Job_StateLog" Member="StateLogs" ThisKey="JobId" OtherKey="JobId" Type="StateLog" />
    7778      <Association Name="Job_Job" Member="ParentJob" Storage="_Job1" ThisKey="ParentJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
     79      <Association Name="HiveExperiment_Job" Member="HiveExperiment" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperiment" IsForeignKey="true" />
    7880    </Type>
    7981  </Table>
     
    9799      <Column Name="ResourceIds" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
    98100      <Column Name="OwnerUserId" Storage="_UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
    99       <Column Name="RootJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
    100101      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
    101102      <Column Name="LastAccessed" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    102103      <Column Name="IsHiveEngine" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    103104      <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperimentPermissions" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperimentPermission" />
    104       <Association Name="Job_HiveExperiment" Member="RootJob" Storage="_Job" ThisKey="RootJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" DeleteRule="CASCADE" />
     105      <Association Name="HiveExperiment_Job" Member="Jobs" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="Job" />
    105106    </Type>
    106107  </Table>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r5779 r6006  
    2727      </nestedChildShapes>
    2828    </classShape>
    29     <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 2.9247054036458331">
     29    <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.1170068359374996">
    3030      <DataClassMoniker Name="/HiveDataContext/Job" />
    3131      <nestedChildShapes>
    32         <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.364705403645833" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     32        <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 2.5570068359375" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    3333      </nestedChildShapes>
    3434    </classShape>
     
    3939      </nestedChildShapes>
    4040    </classShape>
    41     <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.5401025390624996">
     41    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.3478011067708326">
    4242      <DataClassMoniker Name="/HiveDataContext/HiveExperiment" />
    4343      <nestedChildShapes>
    44         <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.9801025390625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     44        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    4545      </nestedChildShapes>
    4646    </classShape>
     
    7676      </nodes>
    7777    </associationConnector>
    78     <associationConnector edgePoints="[(7.98437325 : 3.92470540364583); (7.98437325 : 4.59300017447917); (8.875 : 4.59300017447917)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     78    <associationConnector edgePoints="[(7.8398428125 : 4.1170068359375); (7.8398428125 : 4.689150890625); (8.875 : 4.689150890625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    7979      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
    8080      <nodes>
     
    8383      </nodes>
    8484    </associationConnector>
    85     <associationConnector edgePoints="[(7.179686625 : 3.92470540364583); (7.179686625 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     85    <associationConnector edgePoints="[(7.10742140625 : 4.1170068359375); (7.10742140625 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    8686      <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
    8787      <nodes>
     
    102102        <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
    103103        <classShapeMoniker Id="8d5712f7-7a1a-4a89-bd4d-fd60200d3306" />
    104       </nodes>
    105     </associationConnector>
    106     <associationConnector edgePoints="[(6.5 : 3.27485270182292); (6.125 : 3.27485270182292)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    107       <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" />
    108       <nodes>
    109         <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
    110         <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
    111104      </nodes>
    112105    </associationConnector>
     
    177170      </nodes>
    178171    </associationConnector>
    179     <associationConnector edgePoints="[(4.125 : 4.39505126953125); (3.75 : 4.39505126953125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     172    <associationConnector edgePoints="[(4.125 : 4.29890055338542); (3.75 : 4.29890055338542)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    180173      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_HiveExperimentPermission" />
    181174      <nodes>
     
    190183      </nestedChildShapes>
    191184    </classShape>
     185    <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     186      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_Job" />
     187      <nodes>
     188        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
     189        <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
     190      </nodes>
     191    </associationConnector>
    192192  </nestedChildShapes>
    193193</ordesignerObjectsDiagram>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r5779 r6006  
    14241424    private global::HeuristicLab.Services.Hive.Common.DataTransfer.Command? _Command;
    14251425   
     1426    private System.Guid _HiveExperimentId;
     1427   
    14261428    private EntitySet<AssignedResource> _AssignedResources;
    14271429   
     
    14351437   
    14361438    private EntityRef<Job> _Job1;
     1439   
     1440    private EntityRef<HiveExperiment> _HiveExperiment;
    14371441   
    14381442    #region Extensibility Method Definitions
     
    14621466    partial void OnCommandChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.Command? value);
    14631467    partial void OnCommandChanged();
     1468    partial void OnHiveExperimentIdChanging(System.Guid value);
     1469    partial void OnHiveExperimentIdChanged();
    14641470    #endregion
    14651471   
     
    14721478      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
    14731479      this._Job1 = default(EntityRef<Job>);
     1480      this._HiveExperiment = default(EntityRef<HiveExperiment>);
    14741481      OnCreated();
    14751482    }
     
    16991706    }
    17001707   
     1708    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", DbType="UniqueIdentifier NOT NULL")]
     1709    public System.Guid HiveExperimentId
     1710    {
     1711      get
     1712      {
     1713        return this._HiveExperimentId;
     1714      }
     1715      set
     1716      {
     1717        if ((this._HiveExperimentId != value))
     1718        {
     1719          if (this._HiveExperiment.HasLoadedOrAssignedValue)
     1720          {
     1721            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     1722          }
     1723          this.OnHiveExperimentIdChanging(value);
     1724          this.SendPropertyChanging();
     1725          this._HiveExperimentId = value;
     1726          this.SendPropertyChanged("HiveExperimentId");
     1727          this.OnHiveExperimentIdChanged();
     1728        }
     1729      }
     1730    }
     1731   
    17011732    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedResource", Storage="_AssignedResources", ThisKey="JobId", OtherKey="JobId")]
    17021733    public EntitySet<AssignedResource> AssignedResources
     
    18101841          }
    18111842          this.SendPropertyChanged("ParentJob");
     1843        }
     1844      }
     1845    }
     1846   
     1847    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Job", Storage="_HiveExperiment", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId", IsForeignKey=true)]
     1848    public HiveExperiment HiveExperiment
     1849    {
     1850      get
     1851      {
     1852        return this._HiveExperiment.Entity;
     1853      }
     1854      set
     1855      {
     1856        HiveExperiment previousValue = this._HiveExperiment.Entity;
     1857        if (((previousValue != value)
     1858              || (this._HiveExperiment.HasLoadedOrAssignedValue == false)))
     1859        {
     1860          this.SendPropertyChanging();
     1861          if ((previousValue != null))
     1862          {
     1863            this._HiveExperiment.Entity = null;
     1864            previousValue.Jobs.Remove(this);
     1865          }
     1866          this._HiveExperiment.Entity = value;
     1867          if ((value != null))
     1868          {
     1869            value.Jobs.Add(this);
     1870            this._HiveExperimentId = value.HiveExperimentId;
     1871          }
     1872          else
     1873          {
     1874            this._HiveExperimentId = default(System.Guid);
     1875          }
     1876          this.SendPropertyChanged("HiveExperiment");
    18121877        }
    18131878      }
     
    21462211    private System.Guid _UserId;
    21472212   
    2148     private System.Guid _RootJobId;
    2149    
    21502213    private System.DateTime _DateCreated;
    21512214   
     
    21562219    private EntitySet<HiveExperimentPermission> _HiveExperimentPermissions;
    21572220   
    2158     private EntityRef<Job> _Job;
     2221    private EntitySet<Job> _Jobs;
    21592222   
    21602223    #region Extensibility Method Definitions
     
    21722235    partial void OnOwnerUserIdChanging(System.Guid value);
    21732236    partial void OnOwnerUserIdChanged();
    2174     partial void OnRootJobIdChanging(System.Guid value);
    2175     partial void OnRootJobIdChanged();
    21762237    partial void OnDateCreatedChanging(System.DateTime value);
    21772238    partial void OnDateCreatedChanged();
     
    21852246    {
    21862247      this._HiveExperimentPermissions = new EntitySet<HiveExperimentPermission>(new Action<HiveExperimentPermission>(this.attach_HiveExperimentPermissions), new Action<HiveExperimentPermission>(this.detach_HiveExperimentPermissions));
    2187       this._Job = default(EntityRef<Job>);
     2248      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    21882249      OnCreated();
    21892250    }
     
    22892350    }
    22902351   
    2291     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RootJobId", DbType="UniqueIdentifier")]
    2292     public System.Guid RootJobId
    2293     {
    2294       get
    2295       {
    2296         return this._RootJobId;
    2297       }
    2298       set
    2299       {
    2300         if ((this._RootJobId != value))
    2301         {
    2302           if (this._Job.HasLoadedOrAssignedValue)
    2303           {
    2304             throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    2305           }
    2306           this.OnRootJobIdChanging(value);
    2307           this.SendPropertyChanging();
    2308           this._RootJobId = value;
    2309           this.SendPropertyChanged("RootJobId");
    2310           this.OnRootJobIdChanged();
    2311         }
    2312       }
    2313     }
    2314    
    23152352    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")]
    23162353    public System.DateTime DateCreated
     
    23862423    }
    23872424   
    2388     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_HiveExperiment", Storage="_Job", ThisKey="RootJobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE")]
    2389     public Job RootJob
    2390     {
    2391       get
    2392       {
    2393         return this._Job.Entity;
    2394       }
    2395       set
    2396       {
    2397         if ((this._Job.Entity != value))
    2398         {
    2399           this.SendPropertyChanging();
    2400           this._Job.Entity = value;
    2401           this.SendPropertyChanged("RootJob");
    2402         }
     2425    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Job", Storage="_Jobs", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
     2426    public EntitySet<Job> Jobs
     2427    {
     2428      get
     2429      {
     2430        return this._Jobs;
     2431      }
     2432      set
     2433      {
     2434        this._Jobs.Assign(value);
    24032435      }
    24042436    }
     
    24312463   
    24322464    private void detach_HiveExperimentPermissions(HiveExperimentPermission entity)
     2465    {
     2466      this.SendPropertyChanging();
     2467      entity.HiveExperiment = null;
     2468    }
     2469   
     2470    private void attach_Jobs(Job entity)
     2471    {
     2472      this.SendPropertyChanging();
     2473      entity.HiveExperiment = this;
     2474    }
     2475   
     2476    private void detach_Jobs(Job entity)
    24332477    {
    24342478      this.SendPropertyChanging();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql

    r5955 r6006  
    5555GO
    5656
     57--ALTER TABLE [dbo].[Job]  DROP  CONSTRAINT [HiveExperiment_Job]
     58--ALTER TABLE [dbo].[Job]  WITH CHECK ADD CONSTRAINT [HiveExperiment_Job] FOREIGN KEY([HiveExperimentId])
     59--REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId])
     60--ON UPDATE CASCADE
     61--ON DELETE CASCADE
     62--GO
     63
    5764ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL;
    5865ALTER TABLE dbo.Plugin WITH NOCHECK ADD CONSTRAINT [DF_Plugin_PluginId] DEFAULT (newid()) FOR PluginId;
     
    107114-- =============================================
    108115-- Author:    cneumuel
    109 -- Create date: 11.11.2010
    110 -- Description: Deletes the root-job of the experiment when experiment is deleted
     116-- Create date: 11.04.2011
     117-- Description: Deletes all associated jobs. This cannot be done with cascading delete,
     118--              because the job table defines a INSTEAD OF DELETE trigger itself, which
     119--              is not compatible with cascading deletes.
    111120-- =============================================
    112 CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] FOR DELETE AS
    113 SET NOCOUNT ON
    114 DELETE Job FROM deleted, Job WHERE Job.JobId = deleted.RootJobId
    115 GO
     121ALTER TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] INSTEAD OF DELETE AS
     122BEGIN
     123  DELETE Job FROM Job WHERE Job.HiveExperimentId = HiveExperimentId
     124END
    116125
    117126SET ANSI_NULLS ON
Note: See TracChangeset for help on using the changeset viewer.