Ignore:
Timestamp:
01/18/18 15:08:25 (3 years ago)
Author:
jzenisek
Message:

#2839

  • updated Heartbeat processing (regarding: checking against AssignedJobResources and handling of the updated Job deletion routine)
  • updated Job deletion routine(still in progress at GenerateStatistics)
File:
1 edited

Legend:

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

    r14185 r15630  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Data.Linq;
    2425using System.Linq;
     
    3132      return GetByIdQuery(DataContext, id);
    3233    }
     34   
     35    public void DeleteByState(JobState state) {
     36      DataContext.ExecuteCommand(DeleteByStateQueryString, Enum.GetName(typeof(JobState), state));
     37    }
     38
     39    public IEnumerable<Job> GetByState(JobState state) {
     40      return GetByStateQuery(DataContext, state);
     41    }
     42
     43    public IEnumerable<Guid> GetJobIdsByState(JobState state) {
     44      return GetJobIdsByStateQuery(DataContext, state);
     45    }
     46
    3347
    3448    #region Compiled queries
     
    3852         where job.JobId == jobId
    3953         select job).SingleOrDefault());
     54    private static readonly Func<DataContext, JobState, IEnumerable<Job>> GetByStateQuery =
     55      CompiledQuery.Compile((DataContext db, JobState jobState) =>
     56        (from job in db.GetTable<Job>()
     57         where job.State == jobState
     58         select job).ToList());
     59    private static readonly Func<DataContext, JobState, IEnumerable<Guid>> GetJobIdsByStateQuery =
     60      CompiledQuery.Compile((DataContext db, JobState jobState) =>
     61        (from job in db.GetTable<Job>()
     62         where job.State == jobState
     63         select job.JobId).ToList());
     64    #endregion
     65
     66    #region String queries
     67    private const string DeleteByStateQueryString = @"
     68      DELETE FROM [Job]
     69      WHERE JobState = {0}
     70    ";
    4071    #endregion
    4172  }
Note: See TracChangeset for help on using the changeset viewer.