- Timestamp:
- 06/05/11 22:35:40 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
r6267 r6357 103 103 where child.ParentJobId == ar.Job.JobId 104 104 select child).Count() > 0 105 orderby ar.Job.Priority descending105 orderby ar.Job.Priority, db.Random() descending 106 106 select Convert.ToDto(ar.Job); 107 107 return count == 0 ? query.ToArray() : query.Take(count).ToArray(); … … 121 121 && ar.Job.CoresNeeded <= slave.FreeCores 122 122 && ar.Job.MemoryNeeded <= slave.FreeMemory 123 orderby ar.Job.Priority descending123 orderby ar.Job.Priority, db.Random() descending // take random job to avoid the race condition that occurs when this method is called concurrently (the same job would be returned) 124 124 select Convert.ToDto(ar.Job); 125 125 var waitingJobs = (count == 0 ? query : query.Take(count)).ToArray(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.cs
r6229 r6357 1 using System; 2 using System.Data.Linq.Mapping; 1 3 namespace HeuristicLab.Services.Hive.DataAccess { 2 4 partial class SlaveStatistics { … … 4 6 5 7 partial class HiveDataContext { 8 // source: http://stackoverflow.com/questions/648196/random-row-from-linq-to-sql 9 [Function(Name = "NEWID", IsComposable = true)] 10 public Guid Random() { 11 // to prove not used by our C# code... 12 throw new NotImplementedException(); 13 } 6 14 } 7 15 }
Note: See TracChangeset
for help on using the changeset viewer.