Changeset 1272
- Timestamp:
- 03/06/09 14:21:11 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs
r1170 r1272 59 59 public static string RESPONSE_CLIENT_PERMISSIONOWNER_DOESNT_EXIST = "Client.PermissionOwnerDoesntExist"; 60 60 61 public static string RESPONSE_COMMUNICATOR_H ARDBEAT_RECEIVED = "Communicator.HeardbeatReceived";61 public static string RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED = "Communicator.HeardbeatReceived"; 62 62 public static string RESPONSE_COMMUNICATOR_JOB_PULLED = "Communicator.JobPulled"; 63 63 public static string RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED = "Communicator.JobResultReceived"; -
trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs
r1170 r1272 54 54 ILifecycleManager lifecycleManager; 55 55 IInternalJobManager jobManager; 56 IScheduler scheduler; 56 57 57 58 /// <summary> … … 67 68 jobManager = ServiceLocator.GetJobManager() as 68 69 IInternalJobManager; 70 scheduler = ServiceLocator.GetScheduler(); 69 71 70 72 lifecycleManager.RegisterHeartbeat( … … 187 189 188 190 response.Success = true; 189 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HARDBEAT_RECEIVED; 190 List<Job> allOfflineJobs = new List<Job>(jobAdapter.GetJobsByState(State.offline)); 191 if (allOfflineJobs.Count > 0 && hbData.freeCores > 0) 191 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED; 192 if (hbData.freeCores > 0 && scheduler.ExistsJobForClient(hbData)) 192 193 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.FetchJob)); 193 194 else … … 225 226 public ResponseJob PullJob(Guid clientId) { 226 227 ResponseJob response = new ResponseJob(); 227 228 /// Critical section /// 229 jobLock.WaitOne(); 230 231 LinkedList<Job> allOfflineJobs = new LinkedList<Job>(jobAdapter.GetJobsByState(State.offline)); 232 if (allOfflineJobs != null && allOfflineJobs.Count > 0) { 233 Job job2Calculate = allOfflineJobs.First.Value; 234 job2Calculate.State = State.calculating; 235 job2Calculate.Client = clientAdapter.GetById(clientId); 236 job2Calculate.Client.State = State.calculating; 237 238 job2Calculate.DateCalculated = DateTime.Now; 228 229 Job job2Calculate = scheduler.GetNextJobForClient(clientId); 230 if (job2Calculate != null) { 239 231 response.Job = job2Calculate; 240 jobAdapter.Update(job2Calculate);241 232 response.Success = true; 242 233 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED; 243 234 } else { 244 response.Success = true; 235 response.Success = false; 236 response.Job = null; 245 237 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT; 246 238 } 247 248 jobLock.ReleaseMutex();249 /// End Critical section ///250 251 239 return response; 252 240 } -
trunk/sources/HeuristicLab.Hive.Server.Core/HeuristicLab.Hive.Server.Core.csproj
r1141 r1272 83 83 <Compile Include="InternalInterfaces\DataAccess\IUserGroupAdapter.cs" /> 84 84 <Compile Include="InternalInterfaces\IInternalJobManager.cs" /> 85 <Compile Include="InternalInterfaces\IScheduler.cs" /> 85 86 <Compile Include="JobManager.cs" /> 86 87 <Compile Include="LifecycleManager.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.Core/ServiceLocator.cs
r1099 r1272 25 25 using HeuristicLab.Hive.Contracts.Interfaces; 26 26 using HeuristicLab.Hive.Server.Core; 27 using HeuristicLab.Hive.Server.Core.InternalInterfaces; 27 28 28 29 /// <summary> … … 61 62 private static IJobResultsAdapter jobResultsAdapter = null; 62 63 64 private static IScheduler scheduler = null; 65 63 66 64 67 /// <summary> … … 239 242 return jobResultsAdapter; 240 243 } 244 245 /// <summary> 246 /// Gets the scheduler 247 /// </summary> 248 /// <returns></returns> 249 [MethodImpl(MethodImplOptions.Synchronized)] 250 public static IScheduler GetScheduler() { 251 if (scheduler == null) { 252 scheduler = discoveryService.GetInstances<IScheduler>()[0]; 253 } 254 255 return scheduler; 256 } 241 257 } -
trunk/sources/HeuristicLab.Hive.Server.Scheduler/HeuristicLab.Hive.Server.Scheduler.csproj
r858 r1272 64 64 </ItemGroup> 65 65 <ItemGroup> 66 <Compile Include="DefaultScheduler.cs" /> 66 67 <Compile Include="HiveServerSchedulerPlugin.cs" /> 67 68 <Compile Include="Properties\AssemblyInfo.cs" /> … … 72 73 </ItemGroup> 73 74 <ItemGroup> 75 <ProjectReference Include="..\HeuristicLab.Hive.Contracts\HeuristicLab.Hive.Contracts.csproj"> 76 <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project> 77 <Name>HeuristicLab.Hive.Contracts</Name> 78 </ProjectReference> 79 <ProjectReference Include="..\HeuristicLab.Hive.Server.Core\HeuristicLab.Hive.Server.Core.csproj"> 80 <Project>{898B31CF-81DC-453B-AEB3-BDF83197A7EE}</Project> 81 <Name>HeuristicLab.Hive.Server.Core</Name> 82 </ProjectReference> 74 83 <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj"> 75 84 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
Note: See TracChangeset
for help on using the changeset viewer.