Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/17/10 10:26:55 (14 years ago)
Author:
cneumuel
Message:
  • Refactored HL.Hive.Experiment. JobItems are not called HiveJobs and OptimizerJobs do not contain a hierarchy anymore.
  • Dynamic generation of jobs on a slave are not reflected on the client user interface.
  • Optimizer-Trees are now strictly synchronized with the HiveJob-Trees (also the ComputeInParallel property is taken into account when the Child HiveJobs are created)
  • Improved the way a class can report progress and lock the UI (IProgressReporter, IProgress, Progress, ProgressView)
  • Changes were made to the config-files, so that server and clients work with blade12.hpc.fh-hagenberg.at
  • Lots of small changes and bugfixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-Hive/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs

    r4368 r4423  
    5050      lifecycleManager = ServiceLocator.GetLifecycleManager();
    5151
    52       lifecycleManager.RegisterStartup(new EventHandler(lifecycleManager_OnStartup));
    53       lifecycleManager.RegisterShutdown(new EventHandler(lifecycleManager_OnShutdown));
     52      lifecycleManager.Started += new EventHandler(lifecycleManager_Started);
     53      lifecycleManager.Stopped += new EventHandler(lifecycleManager_Stopped);
    5454    }
    5555
     
    5959      List<JobDto> allJobs = new List<JobDto>(DaoLocator.JobDao.FindAll());
    6060      foreach (JobDto curJob in allJobs) {
    61         if (curJob.State != JobState.Calculating && curJob.State != JobState.Finished) {
     61        if (curJob.State != JobState.Calculating &&
     62            curJob.State != JobState.Finished &&
     63            curJob.State != JobState.Aborted &&
     64            curJob.State != JobState.Failed &&
     65            curJob.State != JobState.WaitForChildJobs) {
    6266          DaoLocator.JobDao.SetJobOffline(curJob);
    6367        }
     
    6569    }
    6670
    67     private void lifecycleManager_OnStartup(object sender, EventArgs e) {
     71    private void lifecycleManager_Started(object sender, EventArgs e) {
    6872      Logger.Info("Startup Event Fired, Checking DB for consistency");
    6973      CheckForDeadJobs();
     
    7175    }
    7276
    73     private void lifecycleManager_OnShutdown(object sender, EventArgs e) {
     77    private void lifecycleManager_Stopped(object sender, EventArgs e) {
    7478      Logger.Info("Startup Event Fired, Checking DB for consistency");
    7579      CheckForDeadJobs();
     
    155159
    156160      if (job != null && job.JobInfo != null) {
    157         if (job.JobInfo.State != JobState.Offline) {
    158           response.StatusMessage = ResponseStatus.AddNewJob_JobStateMustBeOffline;
     161        // only Offline and WaitForChildJobs are allowed
     162        if (job.JobInfo.State != JobState.Offline && job.JobInfo.State != JobState.WaitForChildJobs) {
     163          response.StatusMessage = ResponseStatus.AddNewJob_InvalidJobState;
    159164          return response;
    160165        }
     
    228233      response.Obj.JobInfo = job;
    229234
    230       response.Obj.SerializedJobData = DaoLocator.JobDao.GetBinaryJobFile(jobId);
     235      if (job != null) {
     236        response.Obj.SerializedJobData = DaoLocator.JobDao.GetBinaryJobFile(jobId);
     237      } else {
     238        response.StatusMessage = ResponseStatus.GetLastSerializedResult_JobDoesNotExist;
     239      }
    231240
    232241      return response;
     
    285294        //response.Success = true;
    286295        response.StatusMessage = ResponseStatus.AbortJob_AbortAlreadyRequested;
    287         return response; // no commit needed
    288       }
    289       if (job.State != JobState.Calculating && job.State != JobState.SnapshotRequested && job.State != JobState.SnapshotSent) {
    290         //response.Success = false;
    291         response.StatusMessage = ResponseStatus.AbortJob_JobIsNotBeeingCalculated;
    292296        return response; // no commit needed
    293297      }
     
    315319          DateFinished = job.DateFinished,
    316320          Exception = job.Exception,
    317           Percentage = job.Percentage
     321          ExecutionTime = job.ExecutionTime
    318322        });
    319323      }
     
    352356            DateFinished = job.DateFinished,
    353357            Exception = job.Exception,
    354             Percentage = job.Percentage,
    355             ParentJobId = job.ParentJob != null ? new Nullable<Guid>(job.ParentJob.Id) : null
     358            ExecutionTime = job.ExecutionTime,
     359            ParentJobId = job.ParentJobId
    356360          });
    357361        }
    358362      }
    359      
     363
    360364      response.Obj = jobResultList;
    361365      return response;
     
    365369      JobDto parentJob = DaoLocator.JobDao.FindById(parentJobId);
    366370
    367       serializedJob.JobInfo.ParentJob = parentJob;
     371      serializedJob.JobInfo.ParentJobId = parentJob.Id;
    368372      serializedJob.JobInfo.UserId = parentJob.UserId;
    369373      serializedJob.JobInfo.AssignedResourceIds = parentJob.AssignedResourceIds;
     
    376380
    377381      jobDto.State = serializedJob.JobInfo.State;
    378       jobDto.Percentage = serializedJob.JobInfo.Percentage;
    379      
     382      jobDto.ExecutionTime = serializedJob.JobInfo.ExecutionTime;
    380383
    381384      DaoLocator.JobDao.SetBinaryJobFile(serializedJob.JobInfo.Id, serializedJob.SerializedJobData);
     
    390393    }
    391394
     395
     396    public ResponseObject<HiveExperimentDtoList> GetHiveExperiments() {
     397      ResponseObject<HiveExperimentDtoList> response = new ResponseObject<HiveExperimentDtoList>();
     398      IEnumerable<HiveExperimentDto> hiveExperiments = DaoLocator.HiveExperimentDao.FindAllByUserId(ServiceLocator.GetAuthorizationManager().UserId);
     399      response.Obj = new HiveExperimentDtoList(hiveExperiments);
     400      response.StatusMessage = ResponseStatus.Ok;
     401      return response;
     402    }
     403
     404    public ResponseObject<HiveExperimentDto> UpdateHiveExperiment(HiveExperimentDto hiveExperimentDto) {
     405      ResponseObject<HiveExperimentDto> response = new ResponseObject<HiveExperimentDto>();
     406      if (hiveExperimentDto.Id == Guid.Empty) {
     407        response.Obj = DaoLocator.HiveExperimentDao.Insert(hiveExperimentDto);
     408      } else {
     409        DaoLocator.HiveExperimentDao.Update(hiveExperimentDto);
     410        response.Obj = hiveExperimentDto;
     411      }
     412      response.StatusMessage = ResponseStatus.Ok;
     413      return response;
     414    }
     415
     416    public Response DeleteHiveExperiment(Guid hiveExperimentId) {
     417      Response response = new Response();
     418      try {
     419        DaoLocator.HiveExperimentDao.Delete(hiveExperimentId);
     420      }
     421      catch (Exception) {
     422        response.StatusMessage = ResponseStatus.DeleteHiveExperiment_Failed;
     423      }
     424      return response;
     425    }
     426
     427    public Response DeleteChildJobs(Guid jobId) {
     428      Response response = new Response();
     429      try {
     430        IEnumerable<JobDto> childs = DaoLocator.JobDao.FindJobsByParentId(jobId, true);
     431        foreach (JobDto childJob in childs) {
     432          DaoLocator.JobDao.Delete(childJob.Id);
     433        }
     434      }
     435      catch (Exception) {
     436        response.StatusMessage = ResponseStatus.DeleteChildJobs_Failed;
     437      }
     438      return response;
     439    }
     440
    392441    #endregion
    393442
     
    420469
    421470
    422    
    423 
    424471  }
    425472}
Note: See TracChangeset for help on using the changeset viewer.