Changeset 1998
- Timestamp:
- 06/04/09 15:12:36 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/3.2/BusinessObjects/Client.cs
r1939 r1998 28 28 namespace HeuristicLab.Hive.Contracts.BusinessObjects { 29 29 30 public enum State { nullState, idle, calculating, offline, finished, abort, requestSnapshot, requestSnapshotSent };30 public enum State { nullState, idle, calculating, offline, finished, abort, requestSnapshot, requestSnapshotSent, pending }; 31 31 32 32 [DataContract] -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r1957 r1998 47 47 private static Dictionary<Guid, int> newAssignedJobs = 48 48 new Dictionary<Guid, int>(); 49 private static Dictionary<Guid, int> pendingJobs = 50 new Dictionary<Guid, int>(); 49 51 50 52 private static ReaderWriterLockSlim heartbeatLock = … … 55 57 private IInternalJobManager jobManager; 56 58 private IScheduler scheduler; 59 60 private static int PENDING_TIMEOUT = 100; 57 61 58 62 /// <summary> … … 139 143 } 140 144 } 145 CheckForPendingJobs(jobAdapter); 146 141 147 tx.Commit(); 142 148 } … … 149 155 if (session != null) 150 156 session.EndSession(); 157 } 158 } 159 160 private void CheckForPendingJobs(IJobAdapter jobAdapter) { 161 IList<Job> pendingJobsInDB = new List<Job>(jobAdapter.GetJobsByState(State.pending)); 162 163 foreach (Job currJob in pendingJobsInDB) { 164 lock (pendingJobs) { 165 if (pendingJobs.ContainsKey(currJob.Id)) { 166 if (pendingJobs[currJob.Id] <= 0) { 167 currJob.State = State.offline; 168 jobAdapter.Update(currJob); 169 } else { 170 pendingJobs[currJob.Id]--; 171 } 172 } 173 } 151 174 } 152 175 } … … 423 446 job.State = State.calculating; 424 447 } 425 if (job.State != State.calculating ) {448 if (job.State != State.calculating && job.State != State.pending) { 426 449 response.Success = false; 427 450 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_WRONG_JOB_STATE; … … 587 610 return response; 588 611 } 589 //job.State = State.finished; 590 //jobAdapter.Update(job); 612 job.State = State.pending; 613 lock (pendingJobs) { 614 pendingJobs.Add(job.Id, PENDING_TIMEOUT); 615 } 616 617 jobAdapter.Update(job); 591 618 592 619 response.Success = true;
Note: See TracChangeset
for help on using the changeset viewer.