- Timestamp:
- 01/27/10 11:11:52 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r2608 r2688 111 111 clientAdapter.Update(client); 112 112 HiveLogger.Info(this.ToString() + ": Client " + client.Id + " wasn't offline but hasn't sent heartbeats - Resetting all his jobs"); 113 foreach (Job job in jobAdapter.GetActiveJobsOf(client)) { 113 foreach (Job job in jobAdapter.GetActiveJobsOf(client)) { 114 114 jobManager.ResetJobsDependingOnResults(job); 115 115 } … … 241 241 /// <returns></returns> 242 242 public ResponseHB ProcessHeartBeat(HeartBeatData hbData) { 243 243 244 244 ISession session = factory.GetSessionForCurrentThread(); 245 245 ITransaction tx = null; … … 252 252 session.GetDataAdapter<ClientInfo, IClientAdapter>(); 253 253 254 IJobAdapter jobAdapter = 254 IJobAdapter jobAdapter = 255 255 session.GetDataAdapter<Job, IJobAdapter>(); 256 256 HiveLogger.Info(this.ToString() + ": END Fetched Adapters"); … … 268 268 if (client.State == State.offline || client.State == State.nullState) { 269 269 response.Success = false; 270 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_USER_NOT_LOGGED_IN; 270 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_USER_NOT_LOGGED_IN; 271 271 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage)); 272 272 … … 305 305 processJobProcess(hbData, jobAdapter, clientAdapter, response); 306 306 HiveLogger.Info(this.ToString() + ": END Processed Heartbeat Jobs"); 307 307 308 308 clientAdapter.Update(client); 309 309 … … 331 331 /// <param name="response"></param> 332 332 private void processJobProcess(HeartBeatData hbData, IJobAdapter jobAdapter, IClientAdapter clientAdapter, ResponseHB response) { 333 HiveLogger.Info(this.ToString() + " processJobProcess: Started for Client " + hbData.ClientId); 334 333 HiveLogger.Info(this.ToString() + " processJobProcess: Started for Client " + hbData.ClientId); 334 335 335 if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) { 336 336 List<Job> jobsOfClient = new List<Job>(jobAdapter.GetActiveJobsOf(clientAdapter.GetById(hbData.ClientId))); … … 338 338 response.Success = false; 339 339 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 340 HiveLogger.Error(this.ToString() + " processJobProcess: There is no job calculated by this user " + hbData.ClientId); 340 HiveLogger.Error(this.ToString() + " processJobProcess: There is no job calculated by this user " + hbData.ClientId); 341 341 return; 342 342 } … … 347 347 response.Success = false; 348 348 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 349 HiveLogger.Error(this.ToString() + " processJobProcess: There is no job calculated by this user " + hbData.ClientId + " Job: " + curJob); 349 HiveLogger.Error(this.ToString() + " processJobProcess: There is no job calculated by this user " + hbData.ClientId + " Job: " + curJob); 350 350 } else if (curJob.State == State.abort) { 351 351 // a request to abort the job has been set … … 376 376 if (newAssignedJobs.ContainsKey(currJob.Id)) { 377 377 newAssignedJobs[currJob.Id]--; 378 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client); 378 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client); 379 379 if (newAssignedJobs[currJob.Id] <= 0) { 380 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 380 HiveLogger.Error(this.ToString() + " processJobProcess: Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 381 381 382 382 currJob.State = State.offline; … … 388 388 } 389 389 } else { 390 HiveLogger.Error(this.ToString() + " processJobProcess: Job ID wasn't with the heartbeats: " + currJob); 390 HiveLogger.Error(this.ToString() + " processJobProcess: Job ID wasn't with the heartbeats: " + currJob); 391 391 currJob.State = State.offline; 392 392 jobAdapter.Update(currJob); … … 397 397 398 398 if (newAssignedJobs.ContainsKey(currJob.Id)) { 399 HiveLogger.Info(this.ToString() + " processJobProcess: Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob); 399 HiveLogger.Info(this.ToString() + " processJobProcess: Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob); 400 400 newAssignedJobs.Remove(currJob.Id); 401 401 } … … 431 431 response.Job = computableJob; 432 432 response.Success = true; 433 HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + computableJob.JobInfo + " for user " + clientId); 433 HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + computableJob.JobInfo + " for user " + clientId); 434 434 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED; 435 435 lock (newAssignedJobs) { … … 438 438 } 439 439 } else { 440 HiveLogger.Info(this.ToString() + " SendSerializedJob: No more Jobs left for " + clientId); 440 HiveLogger.Info(this.ToString() + " SendSerializedJob: No more Jobs left for " + clientId); 441 441 response.Success = false; 442 442 response.Job = null; … … 481 481 response.Job = job2Calculate; 482 482 response.Success = true; 483 HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + job2Calculate + " for user " + clientId); 483 HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + job2Calculate + " for user " + clientId); 484 484 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED; 485 485 lock (newAssignedJobs) { … … 491 491 response.Job = null; 492 492 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT; 493 HiveLogger.Info(this.ToString() + " SendSerializedJob: No more Jobs left for " + clientId); 493 HiveLogger.Info(this.ToString() + " SendSerializedJob: No more Jobs left for " + clientId); 494 494 } 495 495 … … 514 514 515 515 HiveLogger.Info(this.ToString() + " ProcessJobResult: BEGIN Job received for Storage - main method:"); 516 516 517 517 ISession session = factory.GetSessionForCurrentThread(); 518 518 ITransaction tx = null; … … 594 594 Exception exception, 595 595 bool finished) { 596 596 597 597 HiveLogger.Info(this.ToString() + " ProcessJobResult: BEGIN Job received for Storage - SUB method: " + jobId); 598 598 599 599 ISession session = factory.GetSessionForCurrentThread(); 600 600 601 601 ITransaction tx = null; 602 602 … … 608 608 IJobResultsAdapter jobResultAdapter = 609 609 session.GetDataAdapter<JobResult, IJobResultsAdapter>(); 610 610 611 611 //should fetch the existing transaction 612 612 tx = session.BeginTransaction(); … … 628 628 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOB_WITH_THIS_ID; 629 629 response.JobId = jobId; 630 631 HiveLogger.Error(this.ToString() + " ProcessJobResult: No job with Id " + jobId); 632 630 631 HiveLogger.Error(this.ToString() + " ProcessJobResult: No job with Id " + jobId); 632 633 633 tx.Rollback(); 634 634 return response; … … 637 637 response.Success = false; 638 638 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED; 639 640 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job was aborted! " + job.JobInfo); 641 639 640 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job was aborted! " + job.JobInfo); 641 642 642 tx.Rollback(); 643 643 return response; … … 648 648 response.JobId = jobId; 649 649 650 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job is not being calculated (client = null)! " + job.JobInfo); 650 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job is not being calculated (client = null)! " + job.JobInfo); 651 651 652 652 tx.Rollback(); … … 658 658 response.JobId = jobId; 659 659 660 HiveLogger.Error(this.ToString() + " ProcessJobResult: Wrong Client for this Job! " + job.JobInfo + ", Sending Client is: " + clientId); 660 HiveLogger.Error(this.ToString() + " ProcessJobResult: Wrong Client for this Job! " + job.JobInfo + ", Sending Client is: " + clientId); 661 661 662 662 tx.Rollback(); … … 668 668 response.JobId = jobId; 669 669 670 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job already finished! " + job.JobInfo + ", Sending Client is: " + clientId); 670 HiveLogger.Error(this.ToString() + " ProcessJobResult: Job already finished! " + job.JobInfo + ", Sending Client is: " + clientId); 671 671 672 672 tx.Rollback(); … … 682 682 response.JobId = jobId; 683 683 684 HiveLogger.Error(this.ToString() + " ProcessJobResult: Wrong Job State, job is: " + job.JobInfo); 684 HiveLogger.Error(this.ToString() + " ProcessJobResult: Wrong Job State, job is: " + job.JobInfo); 685 685 686 686 tx.Rollback(); … … 720 720 response.finished = finished; 721 721 response.JobResultId = jobResult.Id; 722 722 723 723 //Removed for Testing 724 724 //tx.Commit(); 725 HiveLogger.Info(this.ToString() + " ProcessJobResult: END Job received for Storage - SUB method: " + jobId); 725 HiveLogger.Info(this.ToString() + " ProcessJobResult: END Job received for Storage - SUB method: " + jobId); 726 726 return response; 727 727 } … … 772 772 773 773 HiveLogger.Info("Client logged out " + clientId); 774 774 775 775 ISession session = factory.GetSessionForCurrentThread(); 776 776 ITransaction tx = null; … … 892 892 }; 893 893 894 foreach ( String assemblyPath in currPlugin.Files) {895 currCachedPlugin.PluginFiles.Add(File.ReadAllBytes( assemblyPath));894 foreach (string fileName in from file in currPlugin.Files select file.Name) { 895 currCachedPlugin.PluginFiles.Add(File.ReadAllBytes(fileName)); 896 896 } 897 897 response.Plugins.Add(currCachedPlugin);
Note: See TracChangeset
for help on using the changeset viewer.