- Timestamp:
- 08/12/08 15:38:27 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Grid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Grid/Database.cs
r502 r504 274 274 } 275 275 276 internal long GetJobCount(JobState status) { 277 rwLock.EnterReadLock(); 278 try { 279 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 280 cnn.Open(); 281 DbCommand c = cnn.CreateCommand(); 282 c.CommandText = "Select Count(id) from Job where Status=@Status"; 283 DbParameter stateParameter = c.CreateParameter(); 284 stateParameter.ParameterName = "@Status"; 285 stateParameter.Value = status.ToString(); 286 c.Parameters.Add(stateParameter); 287 return (long)c.ExecuteScalar(); 288 } 289 } finally { 290 rwLock.ExitReadLock(); 291 } 292 } 293 276 294 /// <summary> 277 295 /// Does nothing right now (= running jobs that disappear are never restarted). -
trunk/sources/HeuristicLab.Grid/EngineStore.cs
r502 r504 64 64 database = new Database(connectionString); 65 65 } 66 67 // init counters 68 waitingJobs = (int)database.GetJobCount(JobState.Waiting); 69 runningJobs = (int)database.GetJobCount(JobState.Busy); 70 results = (int)database.GetJobCount(JobState.Finished); 66 71 } 67 72 … … 74 79 guid = nextWaitingJob.Guid; 75 80 engine = nextWaitingJob.RawData; 81 runningJobs++; 82 waitingJobs--; 76 83 return true; 77 84 } … … 82 89 // add the new result 83 90 database.SetJobResult(guid, result); 91 results++; 84 92 } 85 93 86 94 internal void AddEngine(Guid guid, byte[] engine) { 87 database.InsertJob(guid, HeuristicLab.Grid.JobState.Waiting, engine); 95 database.InsertJob(guid, JobState.Waiting, engine); 96 waitingJobs++; 88 97 } 89 98 90 99 internal byte[] GetResult(Guid guid) { 91 if( JobState(guid) == HeuristicLab.Grid.JobState.Finished) {100 if(GetJobState(guid) == JobState.Finished) { 92 101 JobEntry entry = database.GetJob(guid); 93 102 return entry.RawData; … … 100 109 } 101 110 102 internal JobState JobState(Guid guid) {111 internal JobState GetJobState(Guid guid) { 103 112 return database.GetJobState(guid); 104 113 } -
trunk/sources/HeuristicLab.Grid/GridServer.cs
r501 r504 36 36 37 37 public JobState JobState(Guid guid) { 38 return engineStore. JobState(guid);38 return engineStore.GetJobState(guid); 39 39 } 40 40
Note: See TracChangeset
for help on using the changeset viewer.