Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/01/10 13:58:24 (14 years ago)
Author:
kgrading
Message:

Removed References to HiveLogging and updated the default logging mechanism (#991)

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  
    9090    /// <param name="e"></param>
    9191    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 })) {
    9595
    9696        List<ClientDto> allClients = new List<ClientDto>(DaoLocator.ClientDao.FindAll());
     
    101101
    102102            if (!lastHeartbeats.ContainsKey(client.Id)) {
    103               HiveLogger.Info(this.ToString() + ": Client " + client.Id +
     103              Logger.Info("Client " + client.Id +
    104104                              " wasn't offline but hasn't sent heartbeats - setting offline");
    105105              client.State = State.offline;
    106106              DaoLocator.ClientDao.Update(client);
    107               HiveLogger.Info(this.ToString() + ": Client " + client.Id +
     107              Logger.Info("Client " + client.Id +
    108108                              " wasn't offline but hasn't sent heartbeats - Resetting all his jobs");
    109109              foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) {
    110110                //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);                               
    113112              }
    114113            } else {
     
    119118              if (dif.TotalSeconds > ApplicationConstants.HEARTBEAT_MAX_DIF) {
    120119                // 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");
    122121                foreach (JobDto job in DaoLocator.JobDao.FindActiveJobsOfClient(client)) {
    123122                  jobManager.ResetJobsDependingOnResults(job);
     
    127126                  }
    128127                }
    129 
     128                Logger.Debug("setting client offline");
    130129                // client must be set offline
    131130                client.State = State.offline;
     
    134133                DaoLocator.ClientDao.Update(client);
    135134
     135                Logger.Debug("removing it from the heartbeats list");
    136136                heartbeatLock.EnterWriteLock();
    137137                lastHeartbeats.Remove(client.Id);
     
    264264    /// <returns></returns>
    265265    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);
    272267
    273268      ResponseHB response = new ResponseHB();
    274269      response.ActionRequest = new List<MessageContainer>();
    275270
    276       HiveLogger.Debug(this.ToString() + ": BEGIN Started Client Fetching");
     271      Logger.Debug("BEGIN Started Client Fetching");
    277272      ClientDto client = DaoLocator.ClientDao.FindById(hbData.ClientId);
    278       HiveLogger.Debug(this.ToString() + ": END Finished Client Fetching");
     273      Logger.Debug("END Finished Client Fetching");
    279274      // check if the client is logged in
    280275      if (client.State == State.offline || client.State == State.nullState) {
     
    283278        response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage));
    284279
    285         HiveLogger.Error(this.ToString() + " ProcessHeartBeat: Client state null or offline: " + client);
     280        Logger.Error("ProcessHeartBeat: Client state null or offline: " + client);
    286281
    287282        return response;
     
    292287
    293288      // save timestamp of this heartbeat
    294       HiveLogger.Debug(this.ToString() + ": BEGIN Locking for Heartbeats");
     289      Logger.Debug("BEGIN Locking for Heartbeats");
    295290      heartbeatLock.EnterWriteLock();
    296       HiveLogger.Debug(this.ToString() + ": END Locked for Heartbeats");
     291      Logger.Debug("END Locked for Heartbeats");
    297292      if (lastHeartbeats.ContainsKey(hbData.ClientId)) {
    298293        lastHeartbeats[hbData.ClientId] = DateTime.Now;
     
    302297      heartbeatLock.ExitWriteLock();
    303298
    304       HiveLogger.Debug(this.ToString() + ": BEGIN Processing Heartbeat Jobs");
     299      Logger.Debug("BEGIN Processing Heartbeat Jobs");
    305300      processJobProcess(hbData, response);
    306       HiveLogger.Debug(this.ToString() + ": END Processed Heartbeat Jobs");
     301      Logger.Debug("END Processed Heartbeat Jobs");
    307302
    308303      //check if new Cal must be loaded
     
    314309        //client.CalendarSyncStatus = CalendarState.Fetching;
    315310       
    316         HiveLogger.Info(this.ToString() + " fetch or forcefetch sent");       
     311        Logger.Info("fetch or forcefetch sent");       
    317312      }
    318313
    319314      // check if client has a free core for a new job
    320315      // 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");
    322317      if (hbData.FreeCores > 0 && scheduler.ExistsJobForClient(hbData)) {
    323318        response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.FetchJob));
     
    325320        response.ActionRequest.Add(new MessageContainer(MessageContainer.MessageType.NoMessage));
    326321      }
    327       HiveLogger.Debug(this.ToString() + ": END Looked for Client Jobs");
     322      Logger.Debug(" END Looked for Client Jobs");
    328323      response.Success = true;
    329324      response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HEARTBEAT_RECEIVED;
     
    332327
    333328      //tx.Commit();
    334       HiveLogger.Debug(this.ToString() + ": END Processed Heartbeat for Client " + hbData.ClientId);
     329      Logger.Debug(" END Processed Heartbeat for Client " + hbData.ClientId);
    335330      return response;
    336331    }
     
    344339    /// <param name="response"></param>
    345340    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);
    347342      List<JobDto> jobsOfClient = new List<JobDto>(DaoLocator.JobDao.FindActiveJobsOfClient(DaoLocator.ClientDao.FindById(hbData.ClientId)));
    348343      if (hbData.JobProgress != null && hbData.JobProgress.Count > 0) {       
     
    350345          response.Success = false;
    351346          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);
    353348          return;
    354349        }
     
    360355            response.Success = false;
    361356            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);
    363358          } else if (curJob.State == State.abort) {
    364359            // a request to abort the job has been set
     
    392387            if (newAssignedJobs.ContainsKey(currJob.Id)) {
    393388              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);
    395390              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);
    397392
    398393                currJob.State = State.offline;
     
    404399              }
    405400            } 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);
    407402              currJob.State = State.offline;
    408403              DaoLocator.JobDao.Update(currJob);
     
    413408
    414409            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);
    416411              newAssignedJobs.Remove(currJob.Id);
    417412            }
     
    427422    /// <param name="clientId"></param>
    428423    /// <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 method
    478     /// the server selects a job and sends it to the client
    479     /// </summary>
    480     /// <param name="clientId"></param>
    481     /// <returns></returns>
    482424    public ResponseJob SendJob(Guid clientId) {
    483425
     
    487429      if (job2Calculate != null) {
    488430        response.Job = job2Calculate;
     431        response.Job.PluginsNeeded = DaoLocator.PluginInfoDao.GetPluginDependenciesForJob(response.Job);
    489432        response.Success = true;
    490         HiveLogger.Info(this.ToString() + " SendSerializedJob: Job pulled: " + job2Calculate + " for user " + clientId);
     433        Logger.Info("Job pulled: " + job2Calculate + " for user " + clientId);
    491434        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED;
    492435        lock (newAssignedJobs) {
     
    494437            newAssignedJobs.Add(job2Calculate.Id, ApplicationConstants.JOB_TIME_TO_LIVE);
    495438        }
    496       } else {
     439      } else {                 
    497440        response.Success = false;
    498441        response.Job = null;
    499442        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);
    501444      }
    502445
     
    510453      bool finished) {
    511454
    512       HiveLogger.Info(this.ToString() + " ProcessJobResult: BEGIN Job received for Storage - main method:");
     455      Logger.Info("BEGIN Job received for Storage - main method:");
    513456
    514457
     
    547490        jobStream.Close();
    548491      }
    549       HiveLogger.Info(this.ToString() + " ProcessJobResult: END Job received for Storage:");
     492      Logger.Info("END Job received for Storage:");
    550493      return response;
    551494    }
     
    559502      bool finished) {
    560503
    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);
    562505
    563506      ResponseResultReceived response = new ResponseResultReceived();
     
    579522        response.JobId = jobId;
    580523
    581         HiveLogger.Error(this.ToString() + " ProcessJobResult: No job with Id " + jobId);
     524        Logger.Error("No job with Id " + jobId);
    582525
    583526        //tx.Rollback();
     
    588531        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_WAS_ABORTED;
    589532
    590         HiveLogger.Error(this.ToString() + " ProcessJobResult: Job was aborted! " + job.JobInfo);
     533        Logger.Error("Job was aborted! " + job.JobInfo);
    591534
    592535        //tx.Rollback();
     
    598541        response.JobId = jobId;
    599542
    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);
    601544
    602545        //tx.Rollback();
     
    608551        response.JobId = jobId;
    609552
    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);
    611554
    612555        //tx.Rollback();
     
    618561        response.JobId = jobId;
    619562
    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);
    621564
    622565        //tx.Rollback();
    623566        return response;
    624567      }
     568      //Todo: RequestsnapshotSent => calculating?
    625569      if (job.JobInfo.State == State.requestSnapshotSent) {
    626570        job.JobInfo.State = State.calculating;
     
    632576        response.JobId = jobId;
    633577
    634         HiveLogger.Error(this.ToString() + " ProcessJobResult: Wrong Job State, job is: " + job.JobInfo);
     578        Logger.Error("Wrong Job State, job is: " + job.JobInfo);
    635579
    636580        //tx.Rollback();
     
    641585      if (finished) {
    642586        job.JobInfo.State = State.finished;
     587        job.JobInfo.DateFinished = DateTime.Now;
    643588      }
    644589
     
    652597      response.finished = finished;
    653598
    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);
    655600      return response;
    656601
     
    691636    public Response Logout(Guid clientId) {
    692637
    693       HiveLogger.Info("Client logged out " + clientId);
     638      Logger.Info("Client logged out " + clientId);
    694639     
    695640      Response response = new Response();
     
    736681        response.Success = false;
    737682        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);
    739684        return response;
    740685      }
     
    742687        response.Success = true;
    743688        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_ALLREADY_FINISHED;
    744         HiveLogger.Error(this.ToString() + " IsJobStillNeeded: already finished! " + job);
     689        Logger.Error("already finished! " + job);
    745690        return response;
    746691      }
  • trunk/sources/HeuristicLab.Hive.Server.Core/3.2/HiveServerCorePlugin.cs

    r3012 r3578  
    3535  [PluginDependency("HeuristicLab.Hive.Server.LINQDataAccess-3.2")]
    3636  [PluginDependency("HeuristicLab.Security.Contracts-3.2")]
     37  [PluginDependency("HeuristicLab.Tracing", "3.2.0")]
    3738  public class HiveServerCorePlugin : PluginBase {
    3839  }
  • trunk/sources/HeuristicLab.Hive.Server.Core/3.2/JobManager.cs

    r3220 r3578  
    3535using System.Transactions;
    3636using HeuristicLab.Hive.Server.LINQDataAccess;
     37using IsolationLevel=System.Transactions.IsolationLevel;
    3738
    3839namespace HeuristicLab.Hive.Server.Core {
     
    5758
    5859    public void ResetJobsDependingOnResults(JobDto job) {
    59       HiveLogger.Info(this.ToString() + ": Setting job " + job.Id + " offline");
     60      Logger.Info("Setting job " + job.Id + " offline");
    6061      if (job != null) {
    6162        DaoLocator.JobDao.SetJobOffline(job);
     
    6566
    6667    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 })) {
    6970        List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll());
    7071        foreach (JobDto curJob in allJobs) {
     
    9192    /// <returns></returns>
    9293    public ResponseList<JobDto> GetAllJobs() {
    93        /*ISession session = factory.GetSessionForCurrentThread();
    94 
    95        try {
    96          IJobAdapter jobAdapter =
    97              session.GetDataAdapter<JobDto, IJobAdapter>();*/
    98 
    9994         ResponseList<JobDto> response = new ResponseList<JobDto>();
    10095
     
    10499
    105100         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    } 
    112108
    113109    /// <summary>
     
    126122    /// <returns></returns>
    127123    public ResponseObject<JobDto> GetJobById(Guid jobId) {
    128       /*ISession session = factory.GetSessionForCurrentThread();
    129 
    130       try {             
    131         IJobAdapter jobAdapter =
    132             session.GetDataAdapter<JobDto, IJobAdapter>();*/
    133 
    134124        ResponseObject<JobDto> response = new ResponseObject<JobDto>();
    135125
     
    145135        return response;
    146136      }
    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    }
    152152
    153153    public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) {
     
    167167    /// <returns></returns>
    168168    public ResponseObject<JobDto> AddNewJob(SerializedJob job) {
    169       /*ISession session = factory.GetSessionForCurrentThread();
    170 
    171       try {
    172         IJobAdapter jobAdapter =
    173             session.GetDataAdapter<JobDto, IJobAdapter>();*/
    174 
    175169        ResponseObject<JobDto> response = new ResponseObject<JobDto>();
    176170
     
    218212    /// <returns></returns>
    219213    public Response RemoveJob(Guid jobId) {
    220       /*ISession session = factory.GetSessionForCurrentThread();
    221 
    222       try {
    223         IJobAdapter jobAdapter =
    224             session.GetDataAdapter<JobDto, IJobAdapter>();*/
    225 
    226214        Response response = new Response();
    227215
     
    238226        return response;
    239227      }
    240       /*finally {
    241         if (session != null)
    242           session.EndSession();
    243       }
    244     }   */
    245228
    246229    public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) {
     
    258241    public ResponseObject<SerializedJob>
    259242      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();                          */
    272243
    273244        ResponseObject<SerializedJob> response =
     
    386357
    387358    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       }  */
    412359      return new ResponseList<JobResult>();
    413360    }
    414361
    415362    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       } */
    432363      return null;
    433364    }
    434365
    435366    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;    */
    471367      return null;
    472368    }
     
    481377
    482378    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; */
    513379      return null;
    514380    }
    515381
    516382    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;*/
    533383      return null;     
    534384    }
    535 
    536385    #endregion
    537386  }
  • trunk/sources/HeuristicLab.Hive.Server.Core/3.2/ServerConsoleFacade.cs

    r3220 r3578  
    9797    }
    9898
     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
    99104    public ResponseObject<JobDto> GetJobById(Guid jobId) {
    100105      secMan.Authorize("AccessJobs", sessionID, jobId);
    101106      return jobManager.GetJobById(jobId);
     107    }
     108
     109    public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) {
     110      secMan.Authorize("AccessJobs", sessionID, jobId);
     111      return jobManager.GetJobByIdWithDetails(jobId);
    102112    }
    103113
Note: See TracChangeset for help on using the changeset viewer.