Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/08/11 13:41:25 (13 years ago)
Author:
ascheibe
Message:

#1233 Review comments: renamed Job to Task

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r6490 r6721  
    3131using HeuristicLab.Core;
    3232using HeuristicLab.PluginInfrastructure;
     33using TS = System.Threading.Tasks;
    3334
    3435namespace HeuristicLab.Clients.Hive {
     
    217218      ServiceLocator.Instance.CallHiveService(service => {
    218219        foreach (HiveJob job in refreshableHiveExperiment.GetAllHiveJobs()) {
    219           if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)
     220          if (job.Job.State != TaskState.Finished && job.Job.State != TaskState.Aborted && job.Job.State != TaskState.Failed)
    220221            service.PauseJob(job.Job.Id);
    221222        }
     
    227228      ServiceLocator.Instance.CallHiveService(service => {
    228229        foreach (HiveJob job in refreshableHiveExperiment.GetAllHiveJobs()) {
    229           if (job.Job.State != JobState.Finished && job.Job.State != JobState.Aborted && job.Job.State != JobState.Failed)
     230          if (job.Job.State != TaskState.Finished && job.Job.State != TaskState.Aborted && job.Job.State != TaskState.Failed)
    230231            service.StopJob(job.Job.Id);
    231232        }
     
    282283        refreshableHiveExperiment.Progress.Status = "Uploading jobs...";
    283284
    284         var tasks = new List<Task>();
     285        var tasks = new List<TS.Task>();
    285286        foreach (HiveJob hiveJob in refreshableHiveExperiment.HiveJobs) {
    286           tasks.Add(Task.Factory.StartNew((hj) => {
     287          tasks.Add(TS.Task.Factory.StartNew((hj) => {
    287288            UploadJobWithChildren(refreshableHiveExperiment.Progress, (HiveJob)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log, refreshableHiveExperiment.HiveExperiment.IsPrivileged, cancellationToken);
    288289          }, hiveJob)
     
    290291        }
    291292        try {
    292           Task.WaitAll(tasks.ToArray());
     293          TS.Task.WaitAll(tasks.ToArray());
    293294        }
    294295        catch (AggregateException ae) {
     
    341342          jobCount[0]++;
    342343        }
    343         JobData jobData;
     344        TaskData jobData;
    344345        List<IPluginDescription> plugins;
    345346
     
    384385        }
    385386
    386         var tasks = new List<Task>();
     387        var tasks = new List<TS.Task>();
    387388        foreach (HiveJob child in hiveJob.ChildHiveJobs) {
    388           tasks.Add(Task.Factory.StartNew((tuple) => {
     389          tasks.Add(TS.Task.Factory.StartNew((tuple) => {
    389390            var arguments = (Tuple<HiveJob, HiveJob>)tuple;
    390391            UploadJobWithChildren(progress, arguments.Item1, arguments.Item2, groups, jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged, cancellationToken);
     
    394395        jobUploadSemaphore.Release(); semaphoreReleased = true; // the semaphore has to be release before waitall!
    395396        try {
    396           Task.WaitAll(tasks.ToArray());
     397          TS.Task.WaitAll(tasks.ToArray());
    397398        }
    398399        catch (AggregateException ae) {
     
    414415        refreshableHiveExperiment.IsProgressing = true;
    415416        int totalJobCount = 0;
    416         IEnumerable<LightweightJob> allJobs;
     417        IEnumerable<LightweightTask> allJobs;
    417418
    418419        refreshableHiveExperiment.Progress.Status = "Connecting to Server...";
    419         // fetch all Job objects to create the full tree of tree of HiveJob objects
     420        // fetch all Task objects to create the full tree of tree of HiveJob objects
    420421        refreshableHiveExperiment.Progress.Status = "Downloading list of jobs...";
    421422        allJobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightExperimentJobs(hiveExperiment.Id));
     
    436437        IDictionary<Guid, HiveJob> allHiveJobs = downloader.Results;
    437438
    438         refreshableHiveExperiment.HiveJobs = new ItemCollection<HiveJob>(allHiveJobs.Values.Where(x => !x.Job.ParentJobId.HasValue));
     439        refreshableHiveExperiment.HiveJobs = new ItemCollection<HiveJob>(allHiveJobs.Values.Where(x => !x.Job.ParentTaskId.HasValue));
    439440
    440441        if (refreshableHiveExperiment.IsFinished()) {
     
    456457    }
    457458
    458     private static void BuildHiveJobTree(HiveJob parentHiveJob, IEnumerable<LightweightJob> allJobs, IDictionary<Guid, HiveJob> allHiveJobs) {
    459       IEnumerable<LightweightJob> childJobs = from job in allJobs
    460                                               where job.ParentJobId.HasValue && job.ParentJobId.Value == parentHiveJob.Job.Id
    461                                               orderby job.DateCreated ascending
    462                                               select job;
    463       foreach (LightweightJob job in childJobs) {
     459    private static void BuildHiveJobTree(HiveJob parentHiveJob, IEnumerable<LightweightTask> allJobs, IDictionary<Guid, HiveJob> allHiveJobs) {
     460      IEnumerable<LightweightTask> childJobs = from job in allJobs
     461                                               where job.ParentTaskId.HasValue && job.ParentTaskId.Value == parentHiveJob.Job.Id
     462                                               orderby job.DateCreated ascending
     463                                               select job;
     464      foreach (LightweightTask job in childJobs) {
    464465        HiveJob childHiveJob = allHiveJobs[job.Id];
    465466        parentHiveJob.AddChildHiveJob(childHiveJob);
     
    481482
    482483    public static ItemJob LoadItemJob(Guid jobId) {
    483       JobData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId));
     484      TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId));
    484485      try {
    485486        return PersistenceUtil.Deserialize<ItemJob>(jobData.Data);
Note: See TracChangeset for help on using the changeset viewer.