- Timestamp:
- 01/23/18 15:42:13 (7 years ago)
- Location:
- branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/JobDao.cs
r15630 r15643 45 45 } 46 46 47 public IEnumerable<Job> GetJobsReadyForDeletion() { 48 return GetJobsReadyForDeletionQuery(DataContext); 49 } 50 47 51 48 52 #region Compiled queries … … 62 66 where job.State == jobState 63 67 select job.JobId).ToList()); 68 private static readonly Func<DataContext, IEnumerable<Job>> GetJobsReadyForDeletionQuery = 69 CompiledQuery.Compile((DataContext db) => 70 (from job in db.GetTable<Job>() 71 where job.State == JobState.StatisticsPending 72 && (from task in db.GetTable<Task>() 73 where task.JobId == job.JobId 74 select task.State == TaskState.Finished 75 || task.State == TaskState.Aborted 76 || task.State == TaskState.Failed).All(x => x) 77 select job).ToList()); 64 78 #endregion 65 79 … … 69 83 WHERE JobState = {0} 70 84 "; 85 private const string GetStatisticsPendingJobs = @" 86 SELECT DISTINCT j.* 87 FROM [Job] j 88 WHERE j.JobState = 'StatisticsPending' 89 AND 'Calculating' NOT IN ( 90 SELECT t.TaskState 91 FROM [Task] t 92 WHERE t.JobId = j.JobId) 93 "; 71 94 #endregion 72 95 } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r15630 r15643 390 390 } 391 391 392 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE" )]392 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 393 393 public Resource Resource 394 394 { … … 424 424 } 425 425 426 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE" )]426 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 427 427 public Project Project 428 428 { … … 1098 1098 } 1099 1099 1100 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId" )]1100 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")] 1101 1101 public EntitySet<AssignedProjectResource> AssignedProjectResources 1102 1102 { … … 1163 1163 } 1164 1164 1165 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId" )]1165 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")] 1166 1166 public EntitySet<AssignedJobResource> AssignedJobResources 1167 1167 { … … 2669 2669 } 2670 2670 2671 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId" )]2671 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")] 2672 2672 public EntitySet<Task> Tasks 2673 2673 { … … 2682 2682 } 2683 2683 2684 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId" )]2684 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")] 2685 2685 public EntitySet<JobPermission> JobPermissions 2686 2686 { … … 2695 2695 } 2696 2696 2697 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId" )]2697 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")] 2698 2698 public EntitySet<AssignedJobResource> AssignedJobResources 2699 2699 { … … 3533 3533 } 3534 3534 3535 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true )]3535 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 3536 3536 public Job Job 3537 3537 { … … 5833 5833 } 5834 5834 5835 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId" )]5835 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")] 5836 5836 public EntitySet<AssignedProjectResource> AssignedProjectResources 5837 5837 { … … 5872 5872 } 5873 5873 5874 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId" )]5874 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")] 5875 5875 public EntitySet<ProjectPermission> ProjectPermissions 5876 5876 { … … 6084 6084 } 6085 6085 6086 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true )]6086 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 6087 6087 public Project Project 6088 6088 { … … 6386 6386 } 6387 6387 6388 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true )]6388 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 6389 6389 public Resource Resource 6390 6390 { … … 6420 6420 } 6421 6421 6422 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true )]6422 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)] 6423 6423 public Job Job 6424 6424 {
Note: See TracChangeset
for help on using the changeset viewer.