Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15644


Ignore:
Timestamp:
01/23/18 16:04:24 (7 years ago)
Author:
jzenisek
Message:

#2839 removed AssignedTaskResource entity

Location:
branches/HiveProjectManagement
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs

    r15630 r15644  
    2727namespace HeuristicLab.Services.Hive.DataAccess.Daos {
    2828  public class TaskDao : GenericDao<Guid, Task> {
    29     private Table<AssignedTaskResource> AssignedTaskResourceTable {
    30       get { return DataContext.GetTable<AssignedTaskResource>(); }
    31     }
    32 
    3329    public TaskDao(DataContext dataContext) : base(dataContext) { }
    3430
     
    5955        slave.FreeCores,
    6056        slave.FreeMemory).ToList();
    61     }
    62 
    63     /// <summary>
    64     /// returns all parent tasks which are waiting for their child tasks to finish
    65     /// </summary>
    66     /// <param name="resourceIds">list of resourceids which for which the task should be valid</param>
    67     /// <param name="count">maximum number of task to return</param>
    68     /// <param name="finished">if true, all parent task which have FinishWhenChildJobsFinished=true are returned, otherwise only FinishWhenChildJobsFinished=false are returned</param>
    69     /// <returns></returns>
    70     public IEnumerable<Task> GetParentTasks_Old(IEnumerable<Guid> resourceIds, int count, bool finished) {
    71       var query = from ar in AssignedTaskResourceTable
    72                   where resourceIds.Contains(ar.ResourceId)
    73                      && ar.Task.State == TaskState.Waiting
    74                      && ar.Task.IsParentTask
    75                      && (finished ? ar.Task.FinishWhenChildJobsFinished : !ar.Task.FinishWhenChildJobsFinished)
    76                      && (from child in Table
    77                          where child.ParentTaskId == ar.Task.TaskId
    78                          select child.State == TaskState.Finished
    79                              || child.State == TaskState.Aborted
    80                              || child.State == TaskState.Failed).All(x => x)
    81                      && (from child in Table // avoid returning WaitForChildTasks task where no child-task exist (yet)
    82                          where child.ParentTaskId == ar.Task.TaskId
    83                          select child).Any()
    84                   orderby ar.Task.Priority descending
    85                   select ar.Task;
    86       return count == 0 ? query.ToArray() : query.Take(count).ToArray();
    8757    }
    8858
     
    153123      AND ajr.ResourceId = rbranch.ResourceId
    154124    ";
    155     private const string GetWaitingTasksQueryStringOld = @"
    156       WITH pr AS (
    157         SELECT ResourceId, ParentResourceId
    158         FROM [Resource]
    159         WHERE ResourceId = {0}
    160         UNION ALL
    161         SELECT r.ResourceId, r.ParentResourceId
    162         FROM [Resource] r JOIN pr ON r.ResourceId = pr.ParentResourceId
    163       )
    164       SELECT DISTINCT t.TaskId, t.JobId, t.Priority
    165       FROM pr JOIN AssignedTaskResource ar ON ar.ResourceId = pr.ResourceId
    166           JOIN Task t ON t.TaskId = ar.TaskId
    167       WHERE NOT (t.IsParentTask = 1 AND t.FinishWhenChildJobsFinished = 1)
    168           AND t.TaskState = {1}
    169           AND t.CoresNeeded <= {2}
    170           AND t.MemoryNeeded <= {3}
    171     ";
    172125
    173126    private const string UpdateExecutionTimeQuery = @"
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj

    r15630 r15644  
    106106    <Compile Include="Daos\AssignedJobResourceDao.cs" />
    107107    <Compile Include="Daos\AssignedProjectResourceDao.cs" />
    108     <Compile Include="Daos\AssignedTaskResourceDao.cs" />
    109108    <Compile Include="Daos\DowntimeDao.cs" />
    110109    <Compile Include="Daos\GenericDao.cs" />
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml

    r15630 r15644  
    4141      <Association Name="Resource_Downtime" Member="Downtimes" Storage="_UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="Downtime" />
    4242      <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" />
    43       <Association Name="Resource_AssignedTaskResource" Member="AssignedTaskResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedTaskResource" />
    4443      <Association Name="Resource_AssignedJobResource" Member="AssignedJobResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedJobResource" />
    4544      <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
     
    8079      <Association Name="Task_TaskData" Member="JobData" ThisKey="TaskId" OtherKey="TaskId" Type="TaskData" Cardinality="One" />
    8180      <Association Name="Task_StateLog" Member="StateLogs" ThisKey="TaskId" OtherKey="TaskId" Type="StateLog" />
    82       <Association Name="Task_AssignedTaskResource" Member="AssignedTaskResources" ThisKey="TaskId" OtherKey="TaskId" Type="AssignedTaskResource" />
    8381      <Association Name="Task_Task" Member="ParentJob" Storage="_Job1" ThisKey="ParentTaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" />
    8482      <Association Name="Job_Task" Member="Job" Storage="_HiveExperiment" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
     
    276274    </Type>
    277275  </Table>
    278   <Table Name="dbo.AssignedTaskResource" Member="AssignedTaskResources">
    279     <Type Name="AssignedTaskResource">
    280       <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    281       <Column Name="TaskId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    282       <Association Name="Task_AssignedTaskResource" Member="Task" ThisKey="TaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" />
    283       <Association Name="Resource_AssignedTaskResource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
    284     </Type>
    285   </Table>
    286276  <Table Name="dbo.AssignedJobResource" Member="AssignedJobResources">
    287277    <Type Name="AssignedJobResource">
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout

    r15630 r15644  
    155155      </nodes>
    156156    </associationConnector>
    157     <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     157    <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    158158      <AssociationMoniker Name="/HiveDataContext/Task/Task_StateLog" />
    159159      <nodes>
     
    162162      </nodes>
    163163    </associationConnector>
    164     <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     164    <associationConnector edgePoints="[(6.125 : 3.37100341796875); (6.5 : 3.37100341796875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    165165      <AssociationMoniker Name="/HiveDataContext/Job/Job_Task" />
    166166      <nodes>
     
    169169      </nodes>
    170170    </associationConnector>
    171     <associationConnector edgePoints="[(4.125 : 4.20274983723958); (3.75 : 4.20274983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     171    <associationConnector edgePoints="[(4.125 : 4.20274983723958); (3.75 : 4.20274983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    172172      <AssociationMoniker Name="/HiveDataContext/Job/Job_JobPermission" />
    173173      <nodes>
     
    279279      </nodes>
    280280    </associationConnector>
    281     <associationConnector edgePoints="[(11.25 : 9.42390055338542); (10.375 : 9.42390055338542); (10.375 : 8); (4 : 8); (4 : 5.15549967447917); (4.80957165625 : 5.15549967447917); (4.80957165625 : 4.78049967447917)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     281    <associationConnector edgePoints="[(11.25 : 9.42390055338542); (10.375 : 9.42390055338542); (10.375 : 8); (4 : 8); (4 : 5.15549967447917); (4.80957165625 : 5.15549967447917); (4.80957165625 : 4.78049967447917)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    282282      <AssociationMoniker Name="/HiveDataContext/Project/Project_Job" />
    283283      <nodes>
    284284        <classShapeMoniker Id="30778876-b5f6-4a97-9ec7-792011973d75" />
    285285        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
    286       </nodes>
    287     </associationConnector>
    288     <classShape Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" absoluteBounds="11.25, 4.5, 2, 1.1939925130208327">
    289       <DataClassMoniker Name="/HiveDataContext/AssignedTaskResource" />
    290       <nestedChildShapes>
    291         <elementListCompartment Id="e9acd881-ab35-401c-b4f8-03dafc98422e" absoluteBounds="11.265, 4.96, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    292       </nestedChildShapes>
    293     </classShape>
    294     <associationConnector edgePoints="[(8.031252 : 4.1170068359375); (8.031252 : 4.4375); (11.15625 : 4.4375); (11.15625 : 5.09699625651042); (11.25 : 5.09699625651042)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    295       <AssociationMoniker Name="/HiveDataContext/Task/Task_AssignedTaskResource" />
    296       <nodes>
    297         <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
    298         <classShapeMoniker Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" />
    299       </nodes>
    300     </associationConnector>
    301     <associationConnector edgePoints="[(12.25 : 2.9631982421875); (12.25 : 4.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    302       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedTaskResource" />
    303       <nodes>
    304         <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
    305         <classShapeMoniker Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" />
    306286      </nodes>
    307287    </associationConnector>
     
    326306      </nestedChildShapes>
    327307    </classShape>
    328     <associationConnector edgePoints="[(11.718748 : 2.9631982421875); (11.718748 : 4.375); (11.0625 : 4.375); (11.0625 : 4.79849862825521); (10.875 : 4.79849862825521)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     308    <associationConnector edgePoints="[(12.25 : 2.9631982421875); (12.25 : 5.09699625651042); (10.875 : 5.09699625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    329309      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedJobResource" />
    330310      <nodes>
     
    333313      </nodes>
    334314    </associationConnector>
    335     <associationConnector edgePoints="[(5.498537828125 : 4.78049967447917); (5.498537828125 : 5.14024983723958); (7.41666666666667 : 5.14024983723958 : JumpStart); (7.58333333333333 : 5.14024983723958 : JumpEnd); (8.875 : 5.14024983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     315    <associationConnector edgePoints="[(5.498537828125 : 4.78049967447917); (5.498537828125 : 5.14024983723958); (7.41666666666667 : 5.14024983723958 : JumpStart); (7.58333333333333 : 5.14024983723958 : JumpEnd); (8.875 : 5.14024983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    336316      <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedJobResource" />
    337317      <nodes>
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r15643 r15644  
    9494    partial void UpdateProjectPermission(ProjectPermission instance);
    9595    partial void DeleteProjectPermission(ProjectPermission instance);
    96     partial void InsertAssignedTaskResource(AssignedTaskResource instance);
    97     partial void UpdateAssignedTaskResource(AssignedTaskResource instance);
    98     partial void DeleteAssignedTaskResource(AssignedTaskResource instance);
    9996    partial void InsertAssignedJobResource(AssignedJobResource instance);
    10097    partial void UpdateAssignedJobResource(AssignedJobResource instance);
     
    291288      {
    292289        return this.GetTable<ProjectPermission>();
    293       }
    294     }
    295    
    296     public System.Data.Linq.Table<AssignedTaskResource> AssignedTaskResources
    297     {
    298       get
    299       {
    300         return this.GetTable<AssignedTaskResource>();
    301290      }
    302291    }
     
    390379    }
    391380   
    392     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     381    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
    393382    public Resource Resource
    394383    {
     
    424413    }
    425414   
    426     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     415    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
    427416    public Project Project
    428417    {
     
    938927    private EntitySet<StateLog> _StateLogs;
    939928   
    940     private EntitySet<AssignedTaskResource> _AssignedTaskResources;
    941    
    942929    private EntitySet<AssignedJobResource> _AssignedJobResources;
    943930   
     
    968955      this._UptimeCalendars = new EntitySet<Downtime>(new Action<Downtime>(this.attach_UptimeCalendars), new Action<Downtime>(this.detach_UptimeCalendars));
    969956      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
    970       this._AssignedTaskResources = new EntitySet<AssignedTaskResource>(new Action<AssignedTaskResource>(this.attach_AssignedTaskResources), new Action<AssignedTaskResource>(this.detach_AssignedTaskResources));
    971957      this._AssignedJobResources = new EntitySet<AssignedJobResource>(new Action<AssignedJobResource>(this.attach_AssignedJobResources), new Action<AssignedJobResource>(this.detach_AssignedJobResources));
    972958      this._ParentResource = default(EntityRef<Resource>);
     
    10981084    }
    10991085   
    1100     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")]
     1086    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
    11011087    public EntitySet<AssignedProjectResource> AssignedProjectResources
    11021088    {
     
    11501136    }
    11511137   
    1152     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedTaskResource", Storage="_AssignedTaskResources", ThisKey="ResourceId", OtherKey="ResourceId")]
    1153     public EntitySet<AssignedTaskResource> AssignedTaskResources
    1154     {
    1155       get
    1156       {
    1157         return this._AssignedTaskResources;
    1158       }
    1159       set
    1160       {
    1161         this._AssignedTaskResources.Assign(value);
    1162       }
    1163     }
    1164    
    1165     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")]
     1138    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId")]
    11661139    public EntitySet<AssignedJobResource> AssignedJobResources
    11671140    {
     
    12731246   
    12741247    private void detach_StateLogs(StateLog entity)
    1275     {
    1276       this.SendPropertyChanging();
    1277       entity.Resource = null;
    1278     }
    1279    
    1280     private void attach_AssignedTaskResources(AssignedTaskResource entity)
    1281     {
    1282       this.SendPropertyChanging();
    1283       entity.Resource = this;
    1284     }
    1285    
    1286     private void detach_AssignedTaskResources(AssignedTaskResource entity)
    12871248    {
    12881249      this.SendPropertyChanging();
     
    16831644    private EntitySet<StateLog> _StateLogs;
    16841645   
    1685     private EntitySet<AssignedTaskResource> _AssignedTaskResources;
    1686    
    16871646    private EntityRef<Task> _Job1;
    16881647   
     
    17251684      this._JobData = default(EntityRef<TaskData>);
    17261685      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
    1727       this._AssignedTaskResources = new EntitySet<AssignedTaskResource>(new Action<AssignedTaskResource>(this.attach_AssignedTaskResources), new Action<AssignedTaskResource>(this.detach_AssignedTaskResources));
    17281686      this._Job1 = default(EntityRef<Task>);
    17291687      this._HiveExperiment = default(EntityRef<Job>);
     
    20472005    }
    20482006   
    2049     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedTaskResource", Storage="_AssignedTaskResources", ThisKey="TaskId", OtherKey="TaskId")]
    2050     public EntitySet<AssignedTaskResource> AssignedTaskResources
    2051     {
    2052       get
    2053       {
    2054         return this._AssignedTaskResources;
    2055       }
    2056       set
    2057       {
    2058         this._AssignedTaskResources.Assign(value);
    2059       }
    2060     }
    2061    
    20622007    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_Task", Storage="_Job1", ThisKey="ParentTaskId", OtherKey="TaskId", IsForeignKey=true)]
    20632008    public Task ParentJob
     
    21792124   
    21802125    private void detach_StateLogs(StateLog entity)
    2181     {
    2182       this.SendPropertyChanging();
    2183       entity.Task = null;
    2184     }
    2185    
    2186     private void attach_AssignedTaskResources(AssignedTaskResource entity)
    2187     {
    2188       this.SendPropertyChanging();
    2189       entity.Task = this;
    2190     }
    2191    
    2192     private void detach_AssignedTaskResources(AssignedTaskResource entity)
    21932126    {
    21942127      this.SendPropertyChanging();
     
    26692602    }
    26702603   
    2671     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
     2604    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId")]
    26722605    public EntitySet<Task> Tasks
    26732606    {
     
    26822615    }
    26832616   
    2684     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
     2617    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId")]
    26852618    public EntitySet<JobPermission> JobPermissions
    26862619    {
     
    26952628    }
    26962629   
    2697     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
     2630    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId")]
    26982631    public EntitySet<AssignedJobResource> AssignedJobResources
    26992632    {
     
    35333466    }
    35343467   
    3535     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     3468    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
    35363469    public Job Job
    35373470    {
     
    58335766    }
    58345767   
    5835     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")]
     5768    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]
    58365769    public EntitySet<AssignedProjectResource> AssignedProjectResources
    58375770    {
     
    58725805    }
    58735806   
    5874     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")]
     5807    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId")]
    58755808    public EntitySet<ProjectPermission> ProjectPermissions
    58765809    {
     
    60846017    }
    60856018   
    6086     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     6019    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
    60876020    public Project Project
    60886021    {
     
    61146047          }
    61156048          this.SendPropertyChanged("Project");
    6116         }
    6117       }
    6118     }
    6119    
    6120     public event PropertyChangingEventHandler PropertyChanging;
    6121    
    6122     public event PropertyChangedEventHandler PropertyChanged;
    6123    
    6124     protected virtual void SendPropertyChanging()
    6125     {
    6126       if ((this.PropertyChanging != null))
    6127       {
    6128         this.PropertyChanging(this, emptyChangingEventArgs);
    6129       }
    6130     }
    6131    
    6132     protected virtual void SendPropertyChanged(String propertyName)
    6133     {
    6134       if ((this.PropertyChanged != null))
    6135       {
    6136         this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    6137       }
    6138     }
    6139   }
    6140  
    6141   [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedTaskResource")]
    6142   public partial class AssignedTaskResource : INotifyPropertyChanging, INotifyPropertyChanged
    6143   {
    6144    
    6145     private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    6146    
    6147     private System.Guid _ResourceId;
    6148    
    6149     private System.Guid _TaskId;
    6150    
    6151     private EntityRef<Task> _Task;
    6152    
    6153     private EntityRef<Resource> _Resource;
    6154    
    6155     #region Extensibility Method Definitions
    6156     partial void OnLoaded();
    6157     partial void OnValidate(System.Data.Linq.ChangeAction action);
    6158     partial void OnCreated();
    6159     partial void OnResourceIdChanging(System.Guid value);
    6160     partial void OnResourceIdChanged();
    6161     partial void OnTaskIdChanging(System.Guid value);
    6162     partial void OnTaskIdChanged();
    6163     #endregion
    6164    
    6165     public AssignedTaskResource()
    6166     {
    6167       this._Task = default(EntityRef<Task>);
    6168       this._Resource = default(EntityRef<Resource>);
    6169       OnCreated();
    6170     }
    6171    
    6172     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    6173     public System.Guid ResourceId
    6174     {
    6175       get
    6176       {
    6177         return this._ResourceId;
    6178       }
    6179       set
    6180       {
    6181         if ((this._ResourceId != value))
    6182         {
    6183           if (this._Resource.HasLoadedOrAssignedValue)
    6184           {
    6185             throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    6186           }
    6187           this.OnResourceIdChanging(value);
    6188           this.SendPropertyChanging();
    6189           this._ResourceId = value;
    6190           this.SendPropertyChanged("ResourceId");
    6191           this.OnResourceIdChanged();
    6192         }
    6193       }
    6194     }
    6195    
    6196     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TaskId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    6197     public System.Guid TaskId
    6198     {
    6199       get
    6200       {
    6201         return this._TaskId;
    6202       }
    6203       set
    6204       {
    6205         if ((this._TaskId != value))
    6206         {
    6207           if (this._Task.HasLoadedOrAssignedValue)
    6208           {
    6209             throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    6210           }
    6211           this.OnTaskIdChanging(value);
    6212           this.SendPropertyChanging();
    6213           this._TaskId = value;
    6214           this.SendPropertyChanged("TaskId");
    6215           this.OnTaskIdChanged();
    6216         }
    6217       }
    6218     }
    6219    
    6220     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedTaskResource", Storage="_Task", ThisKey="TaskId", OtherKey="TaskId", IsForeignKey=true)]
    6221     public Task Task
    6222     {
    6223       get
    6224       {
    6225         return this._Task.Entity;
    6226       }
    6227       set
    6228       {
    6229         Task previousValue = this._Task.Entity;
    6230         if (((previousValue != value)
    6231               || (this._Task.HasLoadedOrAssignedValue == false)))
    6232         {
    6233           this.SendPropertyChanging();
    6234           if ((previousValue != null))
    6235           {
    6236             this._Task.Entity = null;
    6237             previousValue.AssignedTaskResources.Remove(this);
    6238           }
    6239           this._Task.Entity = value;
    6240           if ((value != null))
    6241           {
    6242             value.AssignedTaskResources.Add(this);
    6243             this._TaskId = value.TaskId;
    6244           }
    6245           else
    6246           {
    6247             this._TaskId = default(System.Guid);
    6248           }
    6249           this.SendPropertyChanged("Task");
    6250         }
    6251       }
    6252     }
    6253    
    6254     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedTaskResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
    6255     public Resource Resource
    6256     {
    6257       get
    6258       {
    6259         return this._Resource.Entity;
    6260       }
    6261       set
    6262       {
    6263         Resource previousValue = this._Resource.Entity;
    6264         if (((previousValue != value)
    6265               || (this._Resource.HasLoadedOrAssignedValue == false)))
    6266         {
    6267           this.SendPropertyChanging();
    6268           if ((previousValue != null))
    6269           {
    6270             this._Resource.Entity = null;
    6271             previousValue.AssignedTaskResources.Remove(this);
    6272           }
    6273           this._Resource.Entity = value;
    6274           if ((value != null))
    6275           {
    6276             value.AssignedTaskResources.Add(this);
    6277             this._ResourceId = value.ResourceId;
    6278           }
    6279           else
    6280           {
    6281             this._ResourceId = default(System.Guid);
    6282           }
    6283           this.SendPropertyChanged("Resource");
    62846049        }
    62856050      }
     
    63866151    }
    63876152   
    6388     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     6153    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
    63896154    public Resource Resource
    63906155    {
     
    64206185    }
    64216186   
    6422     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
     6187    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
    64236188    public Job Job
    64246189    {
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Interfaces/IPersistenceManager.cs

    r15552 r15644  
    3131
    3232    #region Hive daos
    33     AssignedTaskResourceDao AssignedTaskResourceDao { get; }
    3433    AssignedJobResourceDao AssignedJobResourceDao { get; }
    3534    AssignedProjectResourceDao AssignedProjectResourceDao { get; }
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs

    r15552 r15644  
    3737
    3838    #region Hive daos
    39 
    40     private AssignedTaskResourceDao assignedTaskResourceDao;
    41     public AssignedTaskResourceDao AssignedTaskResourceDao {
    42       get { return assignedTaskResourceDao ?? (assignedTaskResourceDao = new AssignedTaskResourceDao(dataContext)); }
    43     }
    4439
    4540    private AssignedJobResourceDao assignedJobResourceDao;
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r15643 r15644  
    6969
    7070    #region Task Methods
    71    
    72     public Guid AddTask(DT.Task task, DT.TaskData taskData, IEnumerable<Guid> resourceIds) {
    73       RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    74       var pm = PersistenceManager;
    75       using (new PerformanceLogger("AddTask")) {
    76         var taskDao = pm.TaskDao;
    77         var stateLogDao = pm.StateLogDao;
    78 
    79         var newTask = task.ToEntity();
    80         newTask.JobData = taskData.ToEntity();
    81         newTask.JobData.LastUpdate = DateTime.Now;
    82         newTask.AssignedTaskResources.AddRange(resourceIds.Select(
    83           x => new DA.AssignedTaskResource {
    84             ResourceId = x
    85           }));
    86         newTask.State = DA.TaskState.Waiting;
    87         return pm.UseTransaction(() => {
    88           taskDao.Save(newTask);
    89           pm.SubmitChanges();
    90           stateLogDao.Save(new DA.StateLog {
    91             State = DA.TaskState.Waiting,
    92             DateTime = DateTime.Now,
    93             TaskId = newTask.TaskId,
    94             UserId = UserManager.CurrentUserId,
    95             SlaveId = null,
    96             Exception = null
    97           });
    98           pm.SubmitChanges();
    99           return newTask.TaskId;
    100         }, false, true);
    101       }
    102     }
    10371
    10472    public Guid AddTask(DT.Task task, DT.TaskData taskData) {
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r15641 r15644  
    212212      return actions;
    213213    }
    214 
    215     /// <summary>
    216     /// Update the progress of each task
    217     /// Checks if all the task sent by heartbeat are supposed to be calculated by this slave
    218     /// </summary>
    219     private IEnumerable<MessageContainer> UpdateTasks_Old(IPersistenceManager pm, Heartbeat heartbeat, bool isAllowedToCalculate) {
    220       var taskDao = pm.TaskDao;
    221       var assignedResourceDao = pm.AssignedTaskResourceDao;
    222       var actions = new List<MessageContainer>();
    223       if (heartbeat.JobProgress == null || !heartbeat.JobProgress.Any())
    224         return actions;
    225 
    226       if (!isAllowedToCalculate && heartbeat.JobProgress.Count != 0) {
    227         actions.Add(new MessageContainer(MessageContainer.MessageType.PauseAll));
    228       } else {
    229         // select all tasks and statelogs with one query
    230         var taskIds = heartbeat.JobProgress.Select(x => x.Key).ToList();
    231         var taskInfos = pm.UseTransaction(() =>
    232           (from task in taskDao.GetAll()
    233            where taskIds.Contains(task.TaskId)
    234            let lastStateLog = task.StateLogs.OrderByDescending(x => x.DateTime).FirstOrDefault()
    235            select new {
    236              TaskId = task.TaskId,
    237              Command = task.Command,
    238              SlaveId = lastStateLog != null ? lastStateLog.SlaveId : default(Guid)
    239            }).ToList()
    240         );
    241 
    242         // process the jobProgresses
    243         foreach (var jobProgress in heartbeat.JobProgress) {
    244           var progress = jobProgress;
    245           var curTask = taskInfos.SingleOrDefault(x => x.TaskId == progress.Key);
    246           if (curTask == null) {
    247             actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, progress.Key));
    248             LogFactory.GetLogger(this.GetType().Namespace).Log("Task on slave " + heartbeat.SlaveId + " does not exist in DB: " + jobProgress.Key);
    249           } else {
    250             var slaveId = curTask.SlaveId;
    251             if (slaveId == Guid.Empty || slaveId != heartbeat.SlaveId) {
    252               // assigned slave does not match heartbeat
    253               actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
    254               LogFactory.GetLogger(this.GetType().Namespace).Log("The slave " + heartbeat.SlaveId + " is not supposed to calculate task: " + curTask.TaskId);
    255             } else if (!assignedResourceDao.TaskIsAllowedToBeCalculatedBySlave(curTask.TaskId, heartbeat.SlaveId)) {
    256               // assigned resources ids of task do not match with slaveId (and parent resourceGroupIds); this might happen when slave is moved to different group
    257               actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
    258             } else {
    259               // update task execution time
    260               pm.UseTransaction(() => {
    261                 taskDao.UpdateExecutionTime(curTask.TaskId, progress.Value.TotalMilliseconds);
    262               });
    263               switch (curTask.Command) {
    264                 case DA.Command.Stop:
    265                   actions.Add(new MessageContainer(MessageContainer.MessageType.StopTask, curTask.TaskId));
    266                   break;
    267                 case DA.Command.Pause:
    268                   actions.Add(new MessageContainer(MessageContainer.MessageType.PauseTask, curTask.TaskId));
    269                   break;
    270                 case DA.Command.Abort:
    271                   actions.Add(new MessageContainer(MessageContainer.MessageType.AbortTask, curTask.TaskId));
    272                   break;
    273               }
    274             }
    275           }
    276         }
    277       }
    278       return actions;
    279     }
    280214  }
    281215}
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs

    r15630 r15644  
    3131  public interface IHiveService {
    3232    #region Task Methods
    33     //[OperationContract]
    34     //Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds);
    3533
    3634    [OperationContract]
Note: See TracChangeset for help on using the changeset viewer.