Changeset 3578 for trunk/sources/HeuristicLab.Hive.Server.Core
- Timestamp:
- 05/01/10 13:58:24 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Server.Core/3.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ClientCommunicator.cs
r3222 r3578 90 90 /// <param name="e"></param> 91 91 void lifecycleManager_OnServerHeartbeat(object sender, EventArgs e) { 92 HiveLogger.Info(this.ToString() + ":Server Heartbeat ticked");93 94 using (TransactionScope scope = new TransactionScope( )) {92 Logger.Debug("Server Heartbeat ticked"); 93 94 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 95 95 96 96 List<ClientDto> allClients = new List<ClientDto>(DaoLocator.ClientDao.FindAll()); … … 101 101 102 102 if (!lastHeartbeats.ContainsKey(client.Id)) { 103 HiveLogger.Info(this.ToString() + ":Client " + client.Id +103 Logger.Info("Client " + client.Id + 104 104 " wasn't offline but hasn't sent heartbeats - setting offline"); 105 105 client.State = State.offline; 106 106 DaoLocator.ClientDao.Update(client); 107 HiveLogger.Info(this.ToString() + ":Client " + client.Id +107 Logger.Info("Client " + client.Id + 108 108 " wasn't offline but hasn't sent heartbeats - Resetting all his jobs"); 109 109 foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) { 110 110 //maybe implementa n additional Watchdog? Till then, just set them offline.. 111 DaoLocator.JobDao.SetJobOffline(job); 112 //jobManager.ResetJobsDependingOnResults(job); 111 DaoLocator.JobDao.SetJobOffline(job); 113 112 } 114 113 } else { … … 119 118 if (dif.TotalSeconds > ApplicationConstants.HEARTBEAT_MAX_DIF) { 120 119 // if client calculated jobs, the job must be reset 121 HiveLogger.Info(this.ToString() + ":Client timed out and is on RESET");120 Logger.Info("Client timed out and is on RESET"); 122 121 foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) { 123 122 jobManager.ResetJobsDependingOnResults(job); … … 127 126 } 128 127 } 129 128 Logger.Debug("setting client offline"); 130 129 // client must be set offline 131 130 client.State = State.offline; … … 134 133 DaoLocator.ClientDao.Update(client); 135 134 135 Logger.Debug("removing it from the heartbeats list"); 136 136 heartbeatLock.EnterWriteLock(); 137 137 lastHeartbeats.Remove(client.Id); … … 264 264 /// <returns></returns> 265 265 public ResponseHB ProcessHeartBeat(HeartBeatData hbData) { 266 HiveLogger.Debug(this.ToString() + ": BEGIN Processing Heartbeat for Client " + hbData.ClientId); 267 HiveLogger.Debug(this.ToString() + ": BEGIN Fetching Adapters"); 268 HiveLogger.Debug(this.ToString() + ": END Fetched Adapters"); 269 HiveLogger.Debug(this.ToString() + ": BEGIN Starting Transaction"); 270 271 HiveLogger.Debug(this.ToString() + ": END Started Transaction"); 266 Logger.Debug("BEGIN Processing Heartbeat for Client " + hbData.ClientId); 272 267 273 268 ResponseHB response = new ResponseHB(); 274 269 response.ActionRequest = new List<MessageContainer>(); 275 270 276 HiveLogger.Debug(this.ToString() + ":BEGIN Started Client Fetching");271 Logger.Debug("BEGIN Started Client Fetching"); 277 272 ClientDto client = DaoLocator.ClientDao.FindById(hbData.ClientId); 278 HiveLogger.Debug(this.ToString() + ":END Finished Client Fetching");273 Logger.Debug("END Finished Client Fetching"); 279 274 // check if the client is logged in 280 275 if (client.State == State.offline || client.State == State.nullState) { … … 283 278 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage)); 284 279 285 HiveLogger.Error(this.ToString() + "ProcessHeartBeat: Client state null or offline: " + client);280 Logger.Error("ProcessHeartBeat: Client state null or offline: " + client); 286 281 287 282 return response; … … 292 287 293 288 // save timestamp of this heartbeat 294 HiveLogger.Debug(this.ToString() + ":BEGIN Locking for Heartbeats");289 Logger.Debug("BEGIN Locking for Heartbeats"); 295 290 heartbeatLock.EnterWriteLock(); 296 HiveLogger.Debug(this.ToString() + ":END Locked for Heartbeats");291 Logger.Debug("END Locked for Heartbeats"); 297 292 if (lastHeartbeats.ContainsKey(hbData.ClientId)) { 298 293 lastHeartbeats[hbData.ClientId] = DateTime.Now; … … 302 297 heartbeatLock.ExitWriteLock(); 303 298 304 HiveLogger.Debug(this.ToString() + ":BEGIN Processing Heartbeat Jobs");299 Logger.Debug("BEGIN Processing Heartbeat Jobs"); 305 300 processJobProcess(hbData, response); 306 HiveLogger.Debug(this.ToString() + ":END Processed Heartbeat Jobs");301 Logger.Debug("END Processed Heartbeat Jobs"); 307 302 308 303 //check if new Cal must be loaded … … 314 309 //client.CalendarSyncStatus = CalendarState.Fetching; 315 310 316 HiveLogger.Info(this.ToString() + "fetch or forcefetch sent");311 Logger.Info("fetch or forcefetch sent"); 317 312 } 318 313 319 314 // check if client has a free core for a new job 320 315 // if true, ask scheduler for a new job for this client 321 HiveLogger.Debug(this.ToString() + ":BEGIN Looking for Client Jobs");316 Logger.Debug(" BEGIN Looking for Client Jobs"); 322 317 if (hbData.FreeCores > 0 && scheduler.ExistsJobForClient(hbData)) { 323 318 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.FetchJob)); … … 325 320 response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage)); 326 321 } 327 HiveLogger.Debug(this.ToString() + ":END Looked for Client Jobs");322 Logger.Debug(" END Looked for Client Jobs"); 328 323 response.Success = true; 329 324 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED; … … 332 327 333 328 //tx.Commit(); 334 HiveLogger.Debug(this.ToString() + ":END Processed Heartbeat for Client " + hbData.ClientId);329 Logger.Debug(" END Processed Heartbeat for Client " + hbData.ClientId); 335 330 return response; 336 331 } … … 344 339 /// <param name="response"></param> 345 340 private void processJobProcess(HeartBeatData hbData, ResponseHB response) { 346 HiveLogger.Info(this.ToString() + " processJobProcess:Started for Client " + hbData.ClientId);341 Logger.Debug("Started for Client " + hbData.ClientId); 347 342 List<JobDto> jobsOfClient = new List<JobDto>(DaoLocator.JobDao.FindActiveJobsOfClient(DaoLocator.ClientDao.FindById(hbData.ClientId))); 348 343 if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) { … … 350 345 response.Success = false; 351 346 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 352 HiveLogger.Error(this.ToString() + " processJobProcess:There is no job calculated by this user " + hbData.ClientId);347 Logger.Error("There is no job calculated by this user " + hbData.ClientId); 353 348 return; 354 349 } … … 360 355 response.Success = false; 361 356 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_IS_NOT_BEEING_CALCULATED; 362 HiveLogger.Error(this.ToString() + " processJobProcess:There is no job calculated by this user " + hbData.ClientId + " Job: " + curJob);357 Logger.Error("There is no job calculated by this user " + hbData.ClientId + " Job: " + curJob); 363 358 } else if (curJob.State == State.abort) { 364 359 // a request to abort the job has been set … … 392 387 if (newAssignedJobs.ContainsKey(currJob.Id)) { 393 388 newAssignedJobs[currJob.Id]--; 394 HiveLogger.Error(this.ToString() + " processJobProcess:Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client);389 Logger.Error("Job TTL Reduced by one for job: " + currJob + "and is now: " + newAssignedJobs[currJob.Id] + ". User that sucks: " + currJob.Client); 395 390 if (newAssignedJobs[currJob.Id] <= 0) { 396 HiveLogger.Error(this.ToString() + " processJobProcess:Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client);391 Logger.Error("Job TTL reached Zero, Job gets removed: " + currJob + " and set back to offline. User that sucks: " + currJob.Client); 397 392 398 393 currJob.State = State.offline; … … 404 399 } 405 400 } else { 406 HiveLogger.Error(this.ToString() + " processJobProcess:Job ID wasn't with the heartbeats: " + currJob);401 Logger.Error("Job ID wasn't with the heartbeats: " + currJob); 407 402 currJob.State = State.offline; 408 403 DaoLocator.JobDao.Update(currJob); … … 413 408 414 409 if (newAssignedJobs.ContainsKey(currJob.Id)) { 415 HiveLogger.Info(this.ToString() + " processJobProcess:Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob);410 Logger.Info("Job is sending a heart beat, removing it from the newAssignedJobList: " + currJob); 416 411 newAssignedJobs.Remove(currJob.Id); 417 412 } … … 427 422 /// <param name="clientId"></param> 428 423 /// <returns></returns> 429 /*public ResponseSerializedJob SendSerializedJob(Guid clientId) {430 ISession session = factory.GetSessionForCurrentThread();431 ITransaction tx = null;432 433 try {434 IJobAdapter jobAdapter =435 session.GetDataAdapter<JobDto, IJobAdapter>();436 437 tx = session.BeginTransaction();438 439 ResponseSerializedJob response = new ResponseSerializedJob();440 441 JobDto job2Calculate = scheduler.GetNextJobForClient(clientId);442 if (job2Calculate != null) {443 SerializedJob computableJob =444 jobAdapter.GetSerializedJob(job2Calculate.Id);445 446 response.Job = computableJob;447 response.Success = true;448 HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + computableJob.JobInfo + " for user " + clientId);449 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED;450 lock (newAssignedJobs) {451 if (!newAssignedJobs.ContainsKey(job2Calculate.Id))452 newAssignedJobs.Add(job2Calculate.Id, ApplicationConstants.JOB_TIME_TO_LIVE);453 }454 } else {455 HiveLogger.Info(this.ToString() + " SendSerializedJob: No more Jobs left for " + clientId);456 response.Success = false;457 response.Job = null;458 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT;459 }460 461 tx.Commit();462 463 return response;464 }465 catch (Exception ex) {466 if (tx != null)467 tx.Rollback();468 throw ex;469 }470 finally {471 if (session != null)472 session.EndSession();473 }474 } */475 476 /// <summary>477 /// if the client was told to pull a job he calls this method478 /// the server selects a job and sends it to the client479 /// </summary>480 /// <param name="clientId"></param>481 /// <returns></returns>482 424 public ResponseJob SendJob(Guid clientId) { 483 425 … … 487 429 if (job2Calculate != null) { 488 430 response.Job = job2Calculate; 431 response.Job.PluginsNeeded = DaoLocator.PluginInfoDao.GetPluginDependenciesForJob(response.Job); 489 432 response.Success = true; 490 HiveLogger.Info(this.ToString() + " SendSerializedJob:Job pulled: " + job2Calculate + " for user " + clientId);433 Logger.Info("Job pulled: " + job2Calculate + " for user " + clientId); 491 434 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED; 492 435 lock (newAssignedJobs) { … … 494 437 newAssignedJobs.Add(job2Calculate.Id, ApplicationConstants.JOB_TIME_TO_LIVE); 495 438 } 496 } else { 439 } else { 497 440 response.Success = false; 498 441 response.Job = null; 499 442 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_NO_JOBS_LEFT; 500 HiveLogger.Info(this.ToString() + " SendSerializedJob:No more Jobs left for " + clientId);443 Logger.Info("No more Jobs left for " + clientId); 501 444 } 502 445 … … 510 453 bool finished) { 511 454 512 HiveLogger.Info(this.ToString() + " ProcessJobResult:BEGIN Job received for Storage - main method:");455 Logger.Info("BEGIN Job received for Storage - main method:"); 513 456 514 457 … … 547 490 jobStream.Close(); 548 491 } 549 HiveLogger.Info(this.ToString() + " ProcessJobResult:END Job received for Storage:");492 Logger.Info("END Job received for Storage:"); 550 493 return response; 551 494 } … … 559 502 bool finished) { 560 503 561 HiveLogger.Info(this.ToString() + " ProcessJobResult:BEGIN Job received for Storage - SUB method: " + jobId);504 Logger.Info("BEGIN Job received for Storage - SUB method: " + jobId); 562 505 563 506 ResponseResultReceived response = new ResponseResultReceived(); … … 579 522 response.JobId = jobId; 580 523 581 HiveLogger.Error(this.ToString() + " ProcessJobResult:No job with Id " + jobId);524 Logger.Error("No job with Id " + jobId); 582 525 583 526 //tx.Rollback(); … … 588 531 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED; 589 532 590 HiveLogger.Error(this.ToString() + " ProcessJobResult:Job was aborted! " + job.JobInfo);533 Logger.Error("Job was aborted! " + job.JobInfo); 591 534 592 535 //tx.Rollback(); … … 598 541 response.JobId = jobId; 599 542 600 HiveLogger.Error(this.ToString() + " ProcessJobResult:Job is not being calculated (client = null)! " + job.JobInfo);543 Logger.Error("Job is not being calculated (client = null)! " + job.JobInfo); 601 544 602 545 //tx.Rollback(); … … 608 551 response.JobId = jobId; 609 552 610 HiveLogger.Error(this.ToString() + " ProcessJobResult:Wrong Client for this Job! " + job.JobInfo + ", Sending Client is: " + clientId);553 Logger.Error("Wrong Client for this Job! " + job.JobInfo + ", Sending Client is: " + clientId); 611 554 612 555 //tx.Rollback(); … … 618 561 response.JobId = jobId; 619 562 620 HiveLogger.Error(this.ToString() + " ProcessJobResult:Job already finished! " + job.JobInfo + ", Sending Client is: " + clientId);563 Logger.Error("Job already finished! " + job.JobInfo + ", Sending Client is: " + clientId); 621 564 622 565 //tx.Rollback(); 623 566 return response; 624 567 } 568 //Todo: RequestsnapshotSent => calculating? 625 569 if (job.JobInfo.State == State.requestSnapshotSent) { 626 570 job.JobInfo.State = State.calculating; … … 632 576 response.JobId = jobId; 633 577 634 HiveLogger.Error(this.ToString() + " ProcessJobResult:Wrong Job State, job is: " + job.JobInfo);578 Logger.Error("Wrong Job State, job is: " + job.JobInfo); 635 579 636 580 //tx.Rollback(); … … 641 585 if (finished) { 642 586 job.JobInfo.State = State.finished; 587 job.JobInfo.DateFinished = DateTime.Now; 643 588 } 644 589 … … 652 597 response.finished = finished; 653 598 654 HiveLogger.Info(this.ToString() + " ProcessJobResult:END Job received for Storage - SUB method: " + jobId);599 Logger.Info("END Job received for Storage - SUB method: " + jobId); 655 600 return response; 656 601 … … 691 636 public Response Logout(Guid clientId) { 692 637 693 HiveLogger.Info("Client logged out " + clientId);638 Logger.Info("Client logged out " + clientId); 694 639 695 640 Response response = new Response(); … … 736 681 response.Success = false; 737 682 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_DOESNT_EXIST; 738 HiveLogger.Error(this.ToString() + " IsJobStillNeeded:Job doesn't exist (anymore)! " + jobId);683 Logger.Error("Job doesn't exist (anymore)! " + jobId); 739 684 return response; 740 685 } … … 742 687 response.Success = true; 743 688 response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_ALLREADY_FINISHED; 744 HiveLogger.Error(this.ToString() + " IsJobStillNeeded:already finished! " + job);689 Logger.Error("already finished! " + job); 745 690 return response; 746 691 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/HiveServerCorePlugin.cs
r3012 r3578 35 35 [PluginDependency("HeuristicLab.Hive.Server.LINQDataAccess-3.2")] 36 36 [PluginDependency("HeuristicLab.Security.Contracts-3.2")] 37 [PluginDependency("HeuristicLab.Tracing", "3.2.0")] 37 38 public class HiveServerCorePlugin : PluginBase { 38 39 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs
r3220 r3578 35 35 using System.Transactions; 36 36 using HeuristicLab.Hive.Server.LINQDataAccess; 37 using IsolationLevel=System.Transactions.IsolationLevel; 37 38 38 39 namespace HeuristicLab.Hive.Server.Core { … … 57 58 58 59 public void ResetJobsDependingOnResults(JobDto job) { 59 HiveLogger.Info(this.ToString() + ":Setting job " + job.Id + " offline");60 Logger.Info("Setting job " + job.Id + " offline"); 60 61 if (job != null) { 61 62 DaoLocator.JobDao.SetJobOffline(job); … … 65 66 66 67 void checkForDeadJobs() { 67 HiveLogger.Info(this.ToString() + "Searching for dead Jobs");68 using (TransactionScope scope = new TransactionScope( )) {68 Logger.Info("Searching for dead Jobs"); 69 using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE })) { 69 70 List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll()); 70 71 foreach (JobDto curJob in allJobs) { … … 91 92 /// <returns></returns> 92 93 public ResponseList<JobDto> GetAllJobs() { 93 /*ISession session = factory.GetSessionForCurrentThread();94 95 try {96 IJobAdapter jobAdapter =97 session.GetDataAdapter<JobDto, IJobAdapter>();*/98 99 94 ResponseList<JobDto> response = new ResponseList<JobDto>(); 100 95 … … 104 99 105 100 return response; 106 /*} 107 finally { 108 if (session != null) 109 session.EndSession(); 110 } */ 111 } 101 } 102 103 public ResponseList<JobDto> GetAllJobsWithFilter(State jobState, int offset, int count) { 104 ResponseList<JobDto> response = new ResponseList<JobDto>(); 105 response.List = new List<JobDto>(DaoLocator.JobDao.FindWithLimitations(jobState, offset, count)); 106 return response; 107 } 112 108 113 109 /// <summary> … … 126 122 /// <returns></returns> 127 123 public ResponseObject<JobDto> GetJobById(Guid jobId) { 128 /*ISession session = factory.GetSessionForCurrentThread();129 130 try {131 IJobAdapter jobAdapter =132 session.GetDataAdapter<JobDto, IJobAdapter>();*/133 134 124 ResponseObject<JobDto> response = new ResponseObject<JobDto>(); 135 125 … … 145 135 return response; 146 136 } 147 /*finally { 148 if (session != null) 149 session.EndSession(); 150 } 151 } */ 137 138 public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) { 139 ResponseObject<JobDto> job = new ResponseObject<JobDto>(); 140 job.Obj = DaoLocator.JobDao.FindById(jobId); 141 if (job.Obj != null) { 142 job.Success = true; 143 job.StatusMessage = ApplicationConstants.RESPONSE_JOB_GET_JOB_BY_ID; 144 145 job.Obj.Client = DaoLocator.ClientDao.GetClientForJob(jobId); 146 } else { 147 job.Success = false; 148 job.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST; 149 } 150 return job; 151 } 152 152 153 153 public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) { … … 167 167 /// <returns></returns> 168 168 public ResponseObject<JobDto> AddNewJob(SerializedJob job) { 169 /*ISession session = factory.GetSessionForCurrentThread();170 171 try {172 IJobAdapter jobAdapter =173 session.GetDataAdapter<JobDto, IJobAdapter>();*/174 175 169 ResponseObject<JobDto> response = new ResponseObject<JobDto>(); 176 170 … … 218 212 /// <returns></returns> 219 213 public Response RemoveJob(Guid jobId) { 220 /*ISession session = factory.GetSessionForCurrentThread();221 222 try {223 IJobAdapter jobAdapter =224 session.GetDataAdapter<JobDto, IJobAdapter>();*/225 226 214 Response response = new Response(); 227 215 … … 238 226 return response; 239 227 } 240 /*finally {241 if (session != null)242 session.EndSession();243 }244 } */245 228 246 229 public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { … … 258 241 public ResponseObject<SerializedJob> 259 242 GetLastSerializedJobResultOf(Guid jobId, bool requested) { 260 /*ISession session = factory.GetSessionForCurrentThread();261 262 ITransaction tx = null;263 264 try {265 IJobAdapter jobAdapter =266 session.GetDataAdapter<JobDto, IJobAdapter>();267 268 IJobResultsAdapter jobResultsAdapter =269 session.GetDataAdapter<JobResult, IJobResultsAdapter>();270 271 tx = session.BeginTransaction(); */272 243 273 244 ResponseObject<SerializedJob> response = … … 386 357 387 358 public ResponseList<JobResult> GetAllJobResults(Guid jobId) { 388 /* ISession session = factory.GetSessionForCurrentThread();389 ResponseList<JobResult> response = new ResponseList<JobResult>();390 391 try {392 IJobResultsAdapter jobResultAdapter =393 session.GetDataAdapter<JobResult, IJobResultsAdapter>();394 IJobAdapter jobAdapter = session.GetDataAdapter<JobDto, IJobAdapter>();395 396 JobDto job = jobAdapter.GetById(jobId);397 if (job == null) {398 response.Success = false;399 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_DOESNT_EXIST;400 return response;401 }402 response.List = new List<JobResult>(jobResultAdapter.GetResultsOf(job.Id));403 response.Success = true;404 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_JOB_RESULT_SENT;405 406 return response;407 }408 finally {409 if(session != null)410 session.EndSession();411 } */412 359 return new ResponseList<JobResult>(); 413 360 } 414 361 415 362 public ResponseList<ProjectDto> GetAllProjects() { 416 /*ISession session = factory.GetSessionForCurrentThread();417 ResponseList<ProjectDto> response = new ResponseList<ProjectDto>();418 419 try {420 IProjectAdapter projectAdapter =421 session.GetDataAdapter<ProjectDto, IProjectAdapter>();422 423 List<ProjectDto> allProjects = new List<ProjectDto>(projectAdapter.GetAll());424 response.List = allProjects;425 response.Success = true;426 return response;427 }428 finally {429 if (session != null)430 session.EndSession();431 } */432 363 return null; 433 364 } 434 365 435 366 private Response createUpdateProject(ProjectDto project) { 436 /*ISession session = factory.GetSessionForCurrentThread();437 Response response = new Response();438 ITransaction tx = null;439 440 try {441 IProjectAdapter projectAdapter =442 session.GetDataAdapter<ProjectDto, IProjectAdapter>();443 444 if (project.Name == null || project.Name == "") {445 response.Success = false;446 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_PROJECT_NAME_EMPTY;447 return response;448 }449 tx = session.BeginTransaction();450 projectAdapter.Update(project);451 452 tx.Commit();453 response.Success = true;454 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_PROJECT_ADDED;455 } catch (ConstraintException ce) {456 if (tx != null)457 tx.Rollback();458 response.Success = false;459 response.StatusMessage = ce.Message;460 }461 catch (Exception ex) {462 if (tx != null)463 tx.Rollback();464 throw ex;465 }466 finally {467 if (session != null)468 session.EndSession();469 }470 return response; */471 367 return null; 472 368 } … … 481 377 482 378 public Response DeleteProject(Guid projectId) { 483 /*ISession session = factory.GetSessionForCurrentThread();484 Response response = new Response();485 ITransaction tx = null;486 487 try {488 IProjectAdapter projectAdapter =489 session.GetDataAdapter<ProjectDto, IProjectAdapter>();490 491 ProjectDto project = projectAdapter.GetById(projectId);492 if (project == null) {493 response.Success = false;494 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_PROJECT_DOESNT_EXIST;495 return response;496 }497 projectAdapter.Delete(project);498 tx.Commit();499 response.Success = true;500 response.StatusMessage = ApplicationConstants.RESPONSE_JOB_PROJECT_DELETED;501 }502 catch (Exception e) {503 if (tx != null)504 tx.Rollback();505 response.Success = false;506 response.StatusMessage = e.Message;507 }508 finally {509 if (session != null)510 session.EndSession();511 }512 return response; */513 379 return null; 514 380 } 515 381 516 382 public ResponseList<JobDto> GetJobsByProject(Guid projectId) { 517 /*ISession session = factory.GetSessionForCurrentThread();518 ResponseList<JobDto> response = new ResponseList<JobDto>();519 520 try {521 IJobAdapter jobAdapter =522 session.GetDataAdapter<JobDto, IJobAdapter>();523 List<JobDto> jobsByProject = new List<JobDto>(jobAdapter.GetJobsByProject(projectId));524 response.List = jobsByProject;525 response.Success = true;526 }527 finally {528 if (session != null)529 session.EndSession();530 }531 532 return response;*/533 383 return null; 534 384 } 535 536 385 #endregion 537 386 } -
trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ServerConsoleFacade.cs
r3220 r3578 97 97 } 98 98 99 public ResponseList<JobDto> GetAllJobsWithFilter(State jobState, int offset, int count) { 100 secMan.Authorize("AccessJobs", sessionID, Guid.Empty); 101 return jobManager.GetAllJobsWithFilter(jobState, offset, count); 102 } 103 99 104 public ResponseObject<JobDto> GetJobById(Guid jobId) { 100 105 secMan.Authorize("AccessJobs", sessionID, jobId); 101 106 return jobManager.GetJobById(jobId); 107 } 108 109 public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) { 110 secMan.Authorize("AccessJobs", sessionID, jobId); 111 return jobManager.GetJobByIdWithDetails(jobId); 102 112 } 103 113
Note: See TracChangeset
for help on using the changeset viewer.