Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/12/11 18:04:25 (13 years ago)
Author:
ascheibe
Message:

#1233

  • fixed a bug in the Slave UI
  • finished renaming Webservice and Dao methods to be consistent with Job/Task naming
  • some cosmetic changes and project dependencies cleanups
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3
Files:
8 edited

Legend:

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

    r6725 r6743  
    4242    }
    4343
    44     public void DownloadJob(Task job, Action<Task, T> onFinishedAction) {
    45       Task<T> task = Task<TaskData>.Factory.StartNew((x) => DownloadJob(x), job.Id)
    46                                      .ContinueWith((x) => DeserializeJob(x.Result));
    47       task.ContinueWith((x) => OnJobFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
    48       task.ContinueWith((x) => OnJobFailed(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
     44    public void DownloadTask(Task job, Action<Task, T> onFinishedAction) {
     45      Task<T> task = Task<TaskData>.Factory.StartNew((x) => DownloadTask(x), job.Id)
     46                                     .ContinueWith((x) => DeserializeTask(x.Result));
     47      task.ContinueWith((x) => OnTaskFinished(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion);
     48      task.ContinueWith((x) => OnTaskFailed(job, x, onFinishedAction), TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted);
    4949    }
    5050
    51     private void OnJobFinished(Task job, Task<T> task, Action<Task, T> onFinishedAction) {
     51    private void OnTaskFinished(Task job, Task<T> task, Action<Task, T> onFinishedAction) {
    5252      onFinishedAction(job, task.Result);
    5353    }
    54     private void OnJobFailed(Task job, Task<T> task, Action<Task, T> onFinishedAction) {
     54    private void OnTaskFailed(Task job, Task<T> task, Action<Task, T> onFinishedAction) {
    5555      task.Exception.Flatten().Handle((e) => { return true; });
    5656      OnExceptionOccured(task.Exception.Flatten());
     
    5858    }
    5959
    60     protected TaskData DownloadJob(object jobId) {
     60    protected TaskData DownloadTask(object taskId) {
    6161      downloadSemaphore.WaitOne();
    6262      deserializeSemaphore.WaitOne();
     
    6464      try {
    6565        if (abort) return null;
    66         result = ServiceLocator.Instance.CallHiveService(s => s.GetJobData((Guid)jobId));
     66        result = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData((Guid)taskId));
    6767      }
    6868      finally {
     
    7272    }
    7373
    74     protected T DeserializeJob(TaskData jobData) {
     74    protected T DeserializeTask(TaskData taskData) {
    7575      try {
    76         if (abort || jobData == null) return null;
    77         Task job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobData.TaskId));
    78         if (job == null) return null;
    79         var deserializedJob = PersistenceUtil.Deserialize<T>(jobData.Data);
    80         jobData.Data = null; // reduce memory consumption.
     76        if (abort || taskData == null) return null;
     77        Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskData.TaskId));
     78        if (task == null) return null;
     79        var deserializedJob = PersistenceUtil.Deserialize<T>(taskData.Data);
     80        taskData.Data = null; // reduce memory consumption.
    8181        return deserializedJob;
    8282      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r6725 r6743  
    8686        var oldExperiments = jobs ?? new ItemCollection<RefreshableJob>();
    8787        jobs = new HiveItemCollection<RefreshableJob>();
    88         var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetHiveExperiments());
     88        var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
    8989
    9090        foreach (var he in experimentsLoaded) {
    91           var hiveExperiment = oldExperiments.SingleOrDefault(x => x.Id == he.Id);
    92           if (hiveExperiment == null) {
     91          var job = oldExperiments.SingleOrDefault(x => x.Id == he.Id);
     92          if (job == null) {
    9393            // new
    9494            jobs.Add(new RefreshableJob(he) { IsAllowedPrivileged = this.isAllowedPrivileged });
    9595          } else {
    9696            // update
    97             hiveExperiment.Job = he;
    98             hiveExperiment.IsAllowedPrivileged = this.isAllowedPrivileged;
    99             jobs.Add(hiveExperiment);
     97            job.Job = he;
     98            job.IsAllowedPrivileged = this.isAllowedPrivileged;
     99            jobs.Add(job);
    100100          }
    101101        }
     
    139139      if (item.Id == Guid.Empty) {
    140140        if (item is RefreshableJob) {
    141           HiveClient.Instance.UploadExperiment((RefreshableJob)item, cancellationToken);
     141          HiveClient.Instance.UploadJob((RefreshableJob)item, cancellationToken);
    142142        }
    143143        if (item is JobPermission) {
     
    151151      } else {
    152152        if (item is Job)
    153           ServiceLocator.Instance.CallHiveService(s => s.UpdateHiveExperiment((Job)item));
     153          ServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item));
    154154      }
    155155    }
     
    177177
    178178      if (item is Job)
    179         ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(item.Id));
     179        ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
    180180      if (item is RefreshableJob)
    181         ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(item.Id));
     181        ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
    182182      if (item is JobPermission) {
    183183        var hep = (JobPermission)item;
     
    206206    #endregion
    207207
    208     public static void StartExperiment(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) {
     208    public static void StartJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) {
    209209      HiveClient.StoreAsync(
    210210        new Action<Exception>((Exception ex) => {
     
    215215    }
    216216
    217     public static void PauseExperiment(RefreshableJob refreshableHiveExperiment) {
     217    public static void PauseJob(RefreshableJob refreshableJob) {
    218218      ServiceLocator.Instance.CallHiveService(service => {
    219         foreach (HiveTask job in refreshableHiveExperiment.GetAllHiveJobs()) {
    220           if (job.Task.State != TaskState.Finished && job.Task.State != TaskState.Aborted && job.Task.State != TaskState.Failed)
    221             service.PauseJob(job.Task.Id);
     219        foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) {
     220          if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed)
     221            service.PauseTask(task.Task.Id);
    222222        }
    223223      });
    224       refreshableHiveExperiment.ExecutionState = ExecutionState.Paused;
    225     }
    226 
    227     public static void StopExperiment(RefreshableJob refreshableJob) {
     224      refreshableJob.ExecutionState = ExecutionState.Paused;
     225    }
     226
     227    public static void StopJob(RefreshableJob refreshableJob) {
    228228      ServiceLocator.Instance.CallHiveService(service => {
    229         foreach (HiveTask job in refreshableJob.GetAllHiveJobs()) {
    230           if (job.Task.State != TaskState.Finished && job.Task.State != TaskState.Aborted && job.Task.State != TaskState.Failed)
    231             service.StopJob(job.Task.Id);
     229        foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) {
     230          if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed)
     231            service.StopTask(task.Task.Id);
    232232        }
    233233      });
     
    235235    }
    236236
    237     #region Upload Experiment
     237    #region Upload Job
    238238    private Semaphore jobUploadSemaphore = new Semaphore(4, 4); // todo: take magic number into config
    239239    private static object jobCountLocker = new object();
    240240    private static object pluginLocker = new object();
    241     private void UploadExperiment(RefreshableJob refreshableJob, CancellationToken cancellationToken) {
     241    private void UploadJob(RefreshableJob refreshableJob, CancellationToken cancellationToken) {
    242242      try {
    243243        refreshableJob.Progress = new Progress("Connecting to server...");
     
    254254        }
    255255
    256         foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveJobs.OfType<OptimizerHiveTask>()) {
     256        foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveTasks.OfType<OptimizerHiveTask>()) {
    257257          hiveJob.SetIndexInParentOptimizerList(null);
    258258        }
     
    260260        // upload Task
    261261        refreshableJob.Progress.Status = "Uploading Task...";
    262         refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddHiveExperiment(refreshableJob.Job));
     262        refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));
    263263        bool isPrivileged = refreshableJob.Job.IsPrivileged;
    264         refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.GetHiveExperiment(refreshableJob.Job.Id)); // update owner and permissions
     264        refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
    265265        refreshableJob.Job.IsPrivileged = isPrivileged;
    266266        cancellationToken.ThrowIfCancellationRequested();
    267267
    268         int totalJobCount = refreshableJob.GetAllHiveJobs().Count();
     268        int totalJobCount = refreshableJob.GetAllHiveTasks().Count();
    269269        int[] jobCount = new int[1]; // use a reference type (int-array) instead of value type (int) in order to pass the value via a delegate to task-parallel-library
    270270        cancellationToken.ThrowIfCancellationRequested();
     
    284284
    285285        var tasks = new List<TS.Task>();
    286         foreach (HiveTask hiveJob in refreshableJob.HiveJobs) {
     286        foreach (HiveTask hiveJob in refreshableJob.HiveTasks) {
    287287          tasks.Add(TS.Task.Factory.StartNew((hj) => {
    288             UploadJobWithChildren(refreshableJob.Progress, (HiveTask)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, refreshableJob.Job.IsPrivileged, cancellationToken);
     288            UploadTaskWithChildren(refreshableJob.Progress, (HiveTask)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, refreshableJob.Job.IsPrivileged, cancellationToken);
    289289          }, hiveJob)
    290290          .ContinueWith((x) => refreshableJob.Log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted));
     
    334334    /// </summary>
    335335    /// <param name="parentHiveTask">shall be null if its the root task</param>
    336     private void UploadJobWithChildren(IProgress progress, HiveTask hiveJob, HiveTask parentHiveJob, IEnumerable<Guid> groups, int[] jobCount, int totalJobCount, Guid configPluginId, Guid hiveExperimentId, ILog log, bool isPrivileged, CancellationToken cancellationToken) {
     336    private void UploadTaskWithChildren(IProgress progress, HiveTask hiveTask, HiveTask parentHiveJob, IEnumerable<Guid> groups, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, bool isPrivileged, CancellationToken cancellationToken) {
    337337      jobUploadSemaphore.WaitOne();
    338338      bool semaphoreReleased = false;
     
    340340        cancellationToken.ThrowIfCancellationRequested();
    341341        lock (jobCountLocker) {
    342           jobCount[0]++;
     342          taskCount[0]++;
    343343        }
    344344        TaskData jobData;
    345345        List<IPluginDescription> plugins;
    346346
    347         if (hiveJob.ItemTask.ComputeInParallel && (hiveJob.ItemTask.Item is Optimization.Experiment || hiveJob.ItemTask.Item is Optimization.BatchRun)) {
    348           hiveJob.Task.IsParentTask = true;
    349           hiveJob.Task.FinishWhenChildJobsFinished = true;
    350           jobData = hiveJob.GetAsTaskData(true, out plugins);
     347        if (hiveTask.ItemTask.ComputeInParallel && (hiveTask.ItemTask.Item is Optimization.Experiment || hiveTask.ItemTask.Item is Optimization.BatchRun)) {
     348          hiveTask.Task.IsParentTask = true;
     349          hiveTask.Task.FinishWhenChildJobsFinished = true;
     350          jobData = hiveTask.GetAsTaskData(true, out plugins);
    351351        } else {
    352           hiveJob.Task.IsParentTask = false;
    353           hiveJob.Task.FinishWhenChildJobsFinished = false;
    354           jobData = hiveJob.GetAsTaskData(false, out plugins);
     352          hiveTask.Task.IsParentTask = false;
     353          hiveTask.Task.FinishWhenChildJobsFinished = false;
     354          jobData = hiveTask.GetAsTaskData(false, out plugins);
    355355        }
    356356        cancellationToken.ThrowIfCancellationRequested();
     
    359359          if (!cancellationToken.IsCancellationRequested) {
    360360            lock (pluginLocker) {
    361               ServiceLocator.Instance.CallHiveService((s) => hiveJob.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
     361              ServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
    362362            }
    363363          }
    364364        }, -1, "Failed to upload plugins");
    365365        cancellationToken.ThrowIfCancellationRequested();
    366         hiveJob.Task.PluginsNeededIds.Add(configPluginId);
    367         hiveJob.Task.JobId = hiveExperimentId;
    368         hiveJob.Task.IsPrivileged = isPrivileged;
    369 
    370         log.LogMessage(string.Format("Uploading task ({0} kb, {1} objects)", jobData.Data.Count() / 1024, hiveJob.ItemTask.GetObjectGraphObjects().Count()));
     366        hiveTask.Task.PluginsNeededIds.Add(configPluginId);
     367        hiveTask.Task.JobId = jobId;
     368        hiveTask.Task.IsPrivileged = isPrivileged;
     369
     370        log.LogMessage(string.Format("Uploading task ({0} kb, {1} objects)", jobData.Data.Count() / 1024, hiveTask.ItemTask.GetObjectGraphObjects().Count()));
    371371        TryAndRepeat(() => {
    372372          if (!cancellationToken.IsCancellationRequested) {
    373373            if (parentHiveJob != null) {
    374               hiveJob.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildJob(parentHiveJob.Task.Id, hiveJob.Task, jobData));
     374              hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveJob.Task.Id, hiveTask.Task, jobData));
    375375            } else {
    376               hiveJob.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(hiveJob.Task, jobData, groups.ToList()));
     376              hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, jobData, groups.ToList()));
    377377            }
    378378          }
     
    381381
    382382        lock (jobCountLocker) {
    383           progress.ProgressValue = (double)jobCount[0] / totalJobCount;
    384           progress.Status = string.Format("Uploaded task ({0} of {1})", jobCount[0], totalJobCount);
     383          progress.ProgressValue = (double)taskCount[0] / totalJobCount;
     384          progress.Status = string.Format("Uploaded task ({0} of {1})", taskCount[0], totalJobCount);
    385385        }
    386386
    387387        var tasks = new List<TS.Task>();
    388         foreach (HiveTask child in hiveJob.ChildHiveTasks) {
     388        foreach (HiveTask child in hiveTask.ChildHiveTasks) {
    389389          tasks.Add(TS.Task.Factory.StartNew((tuple) => {
    390390            var arguments = (Tuple<HiveTask, HiveTask>)tuple;
    391             UploadJobWithChildren(progress, arguments.Item1, arguments.Item2, groups, jobCount, totalJobCount, configPluginId, hiveExperimentId, log, isPrivileged, cancellationToken);
    392           }, new Tuple<HiveTask, HiveTask>(child, hiveJob))
     391            UploadTaskWithChildren(progress, arguments.Item1, arguments.Item2, groups, taskCount, totalJobCount, configPluginId, jobId, log, isPrivileged, cancellationToken);
     392          }, new Tuple<HiveTask, HiveTask>(child, hiveTask))
    393393          .ContinueWith((x) => log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted));
    394394        }
     
    408408
    409409    #region Download Experiment
    410     public static void LoadExperiment(RefreshableJob refreshableJob) {
     410    public static void LoadJob(RefreshableJob refreshableJob) {
    411411      var hiveExperiment = refreshableJob.Job;
    412412      refreshableJob.Progress = new Progress();
     
    415415        refreshableJob.IsProgressing = true;
    416416        int totalJobCount = 0;
    417         IEnumerable<LightweightTask> allJobs;
     417        IEnumerable<LightweightTask> allTasks;
    418418
    419419        refreshableJob.Progress.Status = "Connecting to Server...";
    420420        // fetch all Task objects to create the full tree of tree of HiveTask objects
    421421        refreshableJob.Progress.Status = "Downloading list of jobs...";
    422         allJobs = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightExperimentJobs(hiveExperiment.Id));
    423         totalJobCount = allJobs.Count();
    424 
    425         TaskDownloader downloader = new TaskDownloader(allJobs.Select(x => x.Id));
     422        allTasks = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id));
     423        totalJobCount = allTasks.Count();
     424
     425        TaskDownloader downloader = new TaskDownloader(allTasks.Select(x => x.Id));
    426426        downloader.StartAsync();
    427427
     
    435435          }
    436436        }
    437         IDictionary<Guid, HiveTask> allHiveJobs = downloader.Results;
    438 
    439         refreshableJob.HiveJobs = new ItemCollection<HiveTask>(allHiveJobs.Values.Where(x => !x.Task.ParentTaskId.HasValue));
     437        IDictionary<Guid, HiveTask> allHiveTasks = downloader.Results;
     438
     439        refreshableJob.HiveTasks = new ItemCollection<HiveTask>(allHiveTasks.Values.Where(x => !x.Task.ParentTaskId.HasValue));
    440440
    441441        if (refreshableJob.IsFinished()) {
     
    446446
    447447        // build child-task tree
    448         foreach (HiveTask hiveJob in refreshableJob.HiveJobs) {
    449           BuildHiveJobTree(hiveJob, allJobs, allHiveJobs);
     448        foreach (HiveTask hiveTask in refreshableJob.HiveTasks) {
     449          BuildHiveJobTree(hiveTask, allTasks, allHiveTasks);
    450450        }
    451451
     
    482482
    483483    public static ItemTask LoadItemJob(Guid jobId) {
    484       TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetJobData(jobId));
     484      TaskData jobData = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId));
    485485      try {
    486486        return PersistenceUtil.Deserialize<ItemTask>(jobData.Data);
     
    506506    }
    507507
    508     public static HiveItemCollection<JobPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
     508    public static HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId) {
    509509      return ServiceLocator.Instance.CallHiveService((service) => {
    510         IEnumerable<JobPermission> heps = service.GetHiveExperimentPermissions(hiveExperimentId);
    511         foreach (var hep in heps) {
     510        IEnumerable<JobPermission> jps = service.GetJobPermissions(jobId);
     511        foreach (var hep in jps) {
    512512          hep.GrantedUserName = service.GetUsernameByUserId(hep.GrantedUserId);
    513513        }
    514         return new HiveItemCollection<JobPermission>(heps);
     514        return new HiveItemCollection<JobPermission>(jps);
    515515      });
    516516    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveJobs/HiveTask.cs

    r6727 r6743  
    341341
    342342    /// <summary>
    343     /// Returns a list of HiveJobs including this and all its child-jobs recursively
     343    /// Returns a list of HiveTasks including this and all its child-jobs recursively
    344344    /// </summary>
    345345    public IEnumerable<HiveTask> GetAllHiveTasks() {
     
    453453        try {
    454454          foreach (var child in childHiveTasks) {
    455             ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.task.Id));
     455            ServiceLocator.Instance.CallHiveService(s => s.PauseTask(child.task.Id));
    456456          }
    457457        }
    458458        finally { childHiveTasksLock.ExitReadLock(); }
    459459      } else {
    460         ServiceLocator.Instance.CallHiveService(s => s.PauseJob(this.task.Id));
     460        ServiceLocator.Instance.CallHiveService(s => s.PauseTask(this.task.Id));
    461461      }
    462462    }
     
    467467        try {
    468468          foreach (var child in childHiveTasks) {
    469             ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.task.Id));
     469            ServiceLocator.Instance.CallHiveService(s => s.StopTask(child.task.Id));
    470470          }
    471471        }
    472472        finally { childHiveTasksLock.ExitReadLock(); }
    473473      } else {
    474         ServiceLocator.Instance.CallHiveService(s => s.StopJob(this.task.Id));
     474        ServiceLocator.Instance.CallHiveService(s => s.StopTask(this.task.Id));
    475475      }
    476476    }
     
    481481        taskData.TaskId = this.task.Id;
    482482        taskData.Data = PersistenceUtil.Serialize(this.itemTask);
    483         service.UpdateJobData(this.Task, taskData);
    484         service.RestartJob(this.task.Id);
    485         Task job = service.GetJob(this.task.Id);
    486         this.task.LastJobDataUpdate = job.LastJobDataUpdate;
     483        service.UpdateTaskData(this.Task, taskData);
     484        service.RestartTask(this.task.Id);
     485        Task task = service.GetTask(this.task.Id);
     486        this.task.LastTaskDataUpdate = task.LastTaskDataUpdate;
    487487      });
    488488    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/JobResultPoller.cs

    r6726 r6743  
    108108      return ServiceLocator.Instance.CallHiveService(service => {
    109109        var responses = new List<LightweightTask>();
    110         responses.AddRange(service.GetLightweightExperimentJobs(jobId));
     110        responses.AddRange(service.GetLightweightJobTasks(jobId));
    111111        OnJobResultsReceived(responses);
    112112        return responses;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/RefreshableJob.cs

    r6725 r6743  
    5555    }
    5656
    57     private ItemCollection<HiveTask> hiveJobs;
    58     public ItemCollection<HiveTask> HiveJobs {
    59       get { return hiveJobs; }
     57    private ItemCollection<HiveTask> hiveTasks;
     58    public ItemCollection<HiveTask> HiveTasks {
     59      get { return hiveTasks; }
    6060      set {
    61         if (hiveJobs != value) {
    62           if (hiveJobs != null) DeregisterHiveJobsEvents();
    63           hiveJobs = value;
    64           if (hiveJobs != null) RegisterHiveJobsEvents();
     61        if (hiveTasks != value) {
     62          if (hiveTasks != null) DeregisterHiveJobsEvents();
     63          hiveTasks = value;
     64          if (hiveTasks != null) RegisterHiveJobsEvents();
    6565          OnHiveJobsChanged();
    6666        }
     
    100100          }
    101101          if (RefreshAutomatically) {
    102             if (this.HiveJobs != null && this.HiveJobs.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) {
     102            if (this.HiveTasks != null && this.HiveTasks.Count > 0 && (jobResultPoller == null || !jobResultPoller.IsPolling)) {
    103103              StartResultPolling();
    104104            }
     
    130130          isControllable = value;
    131131          OnIsControllableChanged();
    132           if (this.hiveJobs != null) {
    133             foreach (var hiveJob in this.hiveJobs) {
     132          if (this.hiveTasks != null) {
     133            foreach (var hiveJob in this.hiveTasks) {
    134134              hiveJob.IsControllable = value;
    135135            }
     
    186186
    187187    public StateLogListList StateLogList {
    188       get { return new StateLogListList(this.GetAllHiveJobs().Select(x => x.StateLog)); }
     188      get { return new StateLogListList(this.GetAllHiveTasks().Select(x => x.StateLog)); }
    189189    }
    190190
     
    196196      this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2);
    197197      this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
    198       this.HiveJobs = new ItemCollection<HiveTask>();
     198      this.HiveTasks = new ItemCollection<HiveTask>();
    199199    }
    200200    public RefreshableJob(Job hiveExperiment) {
     
    204204      this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2);
    205205      this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
    206       this.HiveJobs = new ItemCollection<HiveTask>();
     206      this.HiveTasks = new ItemCollection<HiveTask>();
    207207    }
    208208    protected RefreshableJob(RefreshableJob original, Cloner cloner) {
     
    214214      this.jobDownloader = new ConcurrentTaskDownloader<ItemTask>(2, 2);
    215215      this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
    216       this.HiveJobs = cloner.Clone(original.HiveJobs);
     216      this.HiveTasks = cloner.Clone(original.HiveTasks);
    217217      this.ExecutionTime = original.ExecutionTime;
    218218      this.ExecutionState = original.ExecutionState;
     
    263263    }
    264264    private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightTask>> e) {
    265       foreach (LightweightTask lightweightJob in e.Value) {
    266         HiveTask hiveJob = GetHiveJobById(lightweightJob.Id);
    267         if (hiveJob != null) {
     265      foreach (LightweightTask lightweightTask in e.Value) {
     266        HiveTask hiveTask = GetHiveJobById(lightweightTask.Id);
     267        if (hiveTask != null) {
    268268          // lastJobDataUpdate equals DateTime.MinValue right after it was uploaded. When the first results are polled, this value is updated
    269           if (hiveJob.Task.State == TaskState.Offline && lightweightJob.State != TaskState.Finished && lightweightJob.State != TaskState.Failed && lightweightJob.State != TaskState.Aborted) {
    270             hiveJob.Task.LastJobDataUpdate = lightweightJob.LastJobDataUpdate;
     269          if (hiveTask.Task.State == TaskState.Offline && lightweightTask.State != TaskState.Finished && lightweightTask.State != TaskState.Failed && lightweightTask.State != TaskState.Aborted) {
     270            hiveTask.Task.LastTaskDataUpdate = lightweightTask.LastTaskDataUpdate;
    271271          }
    272272
    273           hiveJob.UpdateFromLightweightJob(lightweightJob);
    274 
    275           if (!hiveJob.IsFinishedTaskDownloaded && !hiveJob.IsDownloading && hiveJob.Task.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {
    276             log.LogMessage(string.Format("Downloading task {0}", lightweightJob.Id));
    277             hiveJob.IsDownloading = true;
    278             jobDownloader.DownloadJob(hiveJob.Task, (localJob, itemJob) => {
     273          hiveTask.UpdateFromLightweightJob(lightweightTask);
     274
     275          if (!hiveTask.IsFinishedTaskDownloaded && !hiveTask.IsDownloading && hiveTask.Task.LastTaskDataUpdate < lightweightTask.LastTaskDataUpdate) {
     276            log.LogMessage(string.Format("Downloading task {0}", lightweightTask.Id));
     277            hiveTask.IsDownloading = true;
     278            jobDownloader.DownloadTask(hiveTask.Task, (localJob, itemJob) => {
    279279              log.LogMessage(string.Format("Finished downloading task {0}", localJob.Id));
    280               HiveTask localHiveJob = GetHiveJobById(localJob.Id);
     280              HiveTask localHiveTask = GetHiveJobById(localJob.Id);
    281281
    282282              if (itemJob == null) {
    283                 localHiveJob.IsDownloading = false;
     283                localHiveTask.IsDownloading = false;
    284284              }
    285285
     
    290290
    291291                if (localJob.State == TaskState.Paused) {
    292                   localHiveJob.ItemTask = itemJob;
     292                  localHiveTask.ItemTask = itemJob;
    293293                } else {
    294294                  if (localJob.ParentTaskId.HasValue) {
    295                     HiveTask parentHiveJob = GetHiveJobById(localJob.ParentTaskId.Value);
    296                     parentHiveJob.IntegrateChild(itemJob, localJob.Id);
     295                    HiveTask parentHiveTask = GetHiveJobById(localJob.ParentTaskId.Value);
     296                    parentHiveTask.IntegrateChild(itemJob, localJob.Id);
    297297                  } else {
    298                     localHiveJob.ItemTask = itemJob;
     298                    localHiveTask.ItemTask = itemJob;
    299299                  }
    300300                }
    301                 localHiveJob.IsDownloading = false;
    302                 localHiveJob.Task.LastJobDataUpdate = localJob.LastJobDataUpdate;
     301                localHiveTask.IsDownloading = false;
     302                localHiveTask.Task.LastTaskDataUpdate = localJob.LastTaskDataUpdate;
    303303              }
    304304            });
     
    317317
    318318    public HiveTask GetHiveJobById(Guid jobId) {
    319       foreach (HiveTask job in this.HiveJobs) {
     319      foreach (HiveTask job in this.HiveTasks) {
    320320        var hj = job.GetHiveTaskByTaskId(jobId);
    321321        if (hj != null)
     
    325325    }
    326326    private void UpdateStatistics() {
    327       var jobs = this.GetAllHiveJobs();
     327      var jobs = this.GetAllHiveTasks();
    328328      job.JobCount = jobs.Count();
    329329      job.CalculatingCount = jobs.Count(j => j.Task.State == TaskState.Calculating);
     
    333333
    334334    public bool AllJobsFinished() {
    335       return this.GetAllHiveJobs().All(j => (j.Task.State == TaskState.Finished
     335      return this.GetAllHiveTasks().All(j => (j.Task.State == TaskState.Finished
    336336                                                   || j.Task.State == TaskState.Aborted
    337337                                                   || j.Task.State == TaskState.Failed)
     
    346346    }
    347347    public void UpdateTotalExecutionTime() {
    348       this.ExecutionTime = TimeSpan.FromMilliseconds(this.GetAllHiveJobs().Sum(x => x.Task.ExecutionTime.TotalMilliseconds));
     348      this.ExecutionTime = TimeSpan.FromMilliseconds(this.GetAllHiveTasks().Sum(x => x.Task.ExecutionTime.TotalMilliseconds));
    349349    }
    350350    #endregion
     
    468468    #endregion
    469469
    470     #region HiveJobs Events
     470    #region HiveTasks Events
    471471    private void RegisterHiveJobsEvents() {
    472       this.hiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);
    473       this.hiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);
    474       this.hiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);
     472      this.hiveTasks.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);
     473      this.hiveTasks.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);
     474      this.hiveTasks.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);
    475475    }
    476476
    477477    private void DeregisterHiveJobsEvents() {
    478       this.hiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);
    479       this.hiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);
    480       this.hiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);
     478      this.hiveTasks.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsAdded);
     479      this.hiveTasks.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_ItemsRemoved);
     480      this.hiveTasks.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(hiveJobs_CollectionReset);
    481481    }
    482482
     
    514514        DeregisterResultPollingEvents();
    515515      }
    516       if (this.HiveJobs != null && this.HiveJobs.Count > 0 && this.GetAllHiveJobs().All(x => x.Task.Id != Guid.Empty)) {
     516      if (this.HiveTasks != null && this.HiveTasks.Count > 0 && this.GetAllHiveTasks().All(x => x.Task.Id != Guid.Empty)) {
    517517        if (this.RefreshAutomatically)
    518518          StartResultPolling();
     
    581581
    582582    public bool IsFinished() {
    583       return HiveJobs != null
    584         && HiveJobs.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue);
    585     }
    586 
    587     public IEnumerable<HiveTask> GetAllHiveJobs() {
    588       if (hiveJobs == null) return Enumerable.Empty<HiveTask>();
    589 
    590       var jobs = new List<HiveTask>();
    591       foreach (HiveTask job in HiveJobs) {
    592         jobs.AddRange(job.GetAllHiveTasks());
    593       }
    594       return jobs;
     583      return HiveTasks != null
     584        && HiveTasks.All(x => x.Task.DateFinished.HasValue && x.Task.DateCreated.HasValue);
     585    }
     586
     587    public IEnumerable<HiveTask> GetAllHiveTasks() {
     588      if (hiveTasks == null) return Enumerable.Empty<HiveTask>();
     589
     590      var tasks = new List<HiveTask>();
     591      foreach (HiveTask task in HiveTasks) {
     592        tasks.AddRange(task.GetAllHiveTasks());
     593      }
     594      return tasks;
    595595    }
    596596
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs

    r6725 r6743  
    5959
    6060    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
    61 
    62 
    6361  }
    6462
     
    7775
    7876    [System.Runtime.Serialization.OptionalFieldAttribute()]
    79     private System.DateTime LastJobDataUpdateField;
     77    private System.DateTime LastTaskDataUpdateField;
    8078
    8179    [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    115113
    116114    [System.Runtime.Serialization.DataMemberAttribute()]
    117     public System.DateTime LastJobDataUpdate {
    118       get {
    119         return this.LastJobDataUpdateField;
    120       }
    121       set {
    122         if ((this.LastJobDataUpdateField.Equals(value) != true)) {
    123           this.LastJobDataUpdateField = value;
    124           this.RaisePropertyChanged("LastJobDataUpdate");
     115    public System.DateTime LastTaskDataUpdate {
     116      get {
     117        return this.LastTaskDataUpdateField;
     118      }
     119      set {
     120        if ((this.LastTaskDataUpdateField.Equals(value) != true)) {
     121          this.LastTaskDataUpdateField = value;
     122          this.RaisePropertyChanged("LastTaskDataUpdate");
    125123        }
    126124      }
     
    15771575    System.Guid GetResourceId(string resourceName);
    15781576
    1579     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobsByResourceId", ReplyAction = "http://tempuri.org/IHiveService/GetJobsByResourceIdResponse")]
    1580     System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobsByResourceId(System.Guid resourceId);
     1577    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTasksByResourceId", ReplyAction = "http://tempuri.org/IHiveService/GetTasksByResourceIdResponse")]
     1578    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasksByResourceId(System.Guid resourceId);
    15811579
    15821580    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/TriggerEventManager", ReplyAction = "http://tempuri.org/IHiveService/TriggerEventManagerResponse")]
     
    16011599    System.Guid GetUserIdByUsername(string username);
    16021600
     1601    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddTask", ReplyAction = "http://tempuri.org/IHiveService/AddTaskResponse")]
     1602    System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds);
     1603
     1604    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddChildTask", ReplyAction = "http://tempuri.org/IHiveService/AddChildTaskResponse")]
     1605    System.Guid AddChildTask(System.Guid parentTaskId, HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData);
     1606
     1607    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTask", ReplyAction = "http://tempuri.org/IHiveService/GetTaskResponse")]
     1608    HeuristicLab.Clients.Hive.Task GetTask(System.Guid taskId);
     1609
     1610    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTasks", ReplyAction = "http://tempuri.org/IHiveService/GetTasksResponse")]
     1611    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasks();
     1612
     1613    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightTasksResponse")]
     1614    System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightTasks(System.Collections.Generic.List<System.Guid> taskIds);
     1615
     1616    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightChildTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightChildTasksResponse")]
     1617    System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildTasks(System.Nullable<System.Guid> parentTaskId, bool recursive, bool includeParent);
     1618
     1619    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightJobTasks", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightJobTasksResponse")]
     1620    System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobTasks(System.Guid jobId);
     1621
     1622    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetTaskData", ReplyAction = "http://tempuri.org/IHiveService/GetTaskDataResponse")]
     1623    HeuristicLab.Clients.Hive.TaskData GetTaskData(System.Guid taskId);
     1624
     1625    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTask", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskResponse")]
     1626    void UpdateTask(HeuristicLab.Clients.Hive.Task taskDto);
     1627
     1628    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTaskData", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskDataResponse")]
     1629    void UpdateTaskData(HeuristicLab.Clients.Hive.Task taskDto, HeuristicLab.Clients.Hive.TaskData taskDataDto);
     1630
     1631    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteTask", ReplyAction = "http://tempuri.org/IHiveService/DeleteTaskResponse")]
     1632    void DeleteTask(System.Guid taskId);
     1633
     1634    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteChildTasks", ReplyAction = "http://tempuri.org/IHiveService/DeleteChildTasksResponse")]
     1635    void DeleteChildTasks(System.Guid parentTaskId);
     1636
     1637    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateTaskState", ReplyAction = "http://tempuri.org/IHiveService/UpdateTaskStateResponse")]
     1638    HeuristicLab.Clients.Hive.Task UpdateTaskState(System.Guid taskId, HeuristicLab.Clients.Hive.TaskState taskState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception);
     1639
     1640    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/StopTask", ReplyAction = "http://tempuri.org/IHiveService/StopTaskResponse")]
     1641    void StopTask(System.Guid taskId);
     1642
     1643    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/PauseTask", ReplyAction = "http://tempuri.org/IHiveService/PauseTaskResponse")]
     1644    void PauseTask(System.Guid taskId);
     1645
     1646    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RestartTask", ReplyAction = "http://tempuri.org/IHiveService/RestartTaskResponse")]
     1647    void RestartTask(System.Guid taskId);
     1648
     1649    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJob", ReplyAction = "http://tempuri.org/IHiveService/GetJobResponse")]
     1650    HeuristicLab.Clients.Hive.Job GetJob(System.Guid id);
     1651
     1652    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobs", ReplyAction = "http://tempuri.org/IHiveService/GetJobsResponse")]
     1653    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobs();
     1654
     1655    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetAllJobs", ReplyAction = "http://tempuri.org/IHiveService/GetAllJobsResponse")]
     1656    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllJobs();
     1657
    16031658    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddJob", ReplyAction = "http://tempuri.org/IHiveService/AddJobResponse")]
    1604     System.Guid AddJob(HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData, System.Collections.Generic.List<System.Guid> resourceIds);
    1605 
    1606     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddChildJob", ReplyAction = "http://tempuri.org/IHiveService/AddChildJobResponse")]
    1607     System.Guid AddChildJob(System.Guid parentJobId, HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData);
    1608 
    1609     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJob", ReplyAction = "http://tempuri.org/IHiveService/GetJobResponse")]
    1610     HeuristicLab.Clients.Hive.Task GetJob(System.Guid jobId);
    1611 
    1612     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobs", ReplyAction = "http://tempuri.org/IHiveService/GetJobsResponse")]
    1613     System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobs();
    1614 
    1615     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightJobsResponse")]
    1616     System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobs(System.Collections.Generic.List<System.Guid> jobIds);
    1617 
    1618     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightChildJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightChildJobsResponse")]
    1619     System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildJobs(System.Nullable<System.Guid> parentJobId, bool recursive, bool includeParent);
    1620 
    1621     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetLightweightExperimentJobs", ReplyAction = "http://tempuri.org/IHiveService/GetLightweightExperimentJobsResponse")]
    1622     System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightExperimentJobs(System.Guid experimentId);
    1623 
    1624     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobData", ReplyAction = "http://tempuri.org/IHiveService/GetJobDataResponse")]
    1625     HeuristicLab.Clients.Hive.TaskData GetJobData(System.Guid jobId);
     1659    System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto);
    16261660
    16271661    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJob", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobResponse")]
    1628     void UpdateJob(HeuristicLab.Clients.Hive.Task jobDto);
    1629 
    1630     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJobData", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobDataResponse")]
    1631     void UpdateJobData(HeuristicLab.Clients.Hive.Task jobDto, HeuristicLab.Clients.Hive.TaskData jobDataDto);
     1662    void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto);
    16321663
    16331664    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteJob", ReplyAction = "http://tempuri.org/IHiveService/DeleteJobResponse")]
    1634     void DeleteJob(System.Guid jobId);
    1635 
    1636     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteChildJobs", ReplyAction = "http://tempuri.org/IHiveService/DeleteChildJobsResponse")]
    1637     void DeleteChildJobs(System.Guid parentJobId);
    1638 
    1639     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateJobState", ReplyAction = "http://tempuri.org/IHiveService/UpdateJobStateResponse")]
    1640     HeuristicLab.Clients.Hive.Task UpdateJobState(System.Guid jobId, HeuristicLab.Clients.Hive.TaskState jobState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception);
    1641 
    1642     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/StopJob", ReplyAction = "http://tempuri.org/IHiveService/StopJobResponse")]
    1643     void StopJob(System.Guid jobId);
    1644 
    1645     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/PauseJob", ReplyAction = "http://tempuri.org/IHiveService/PauseJobResponse")]
    1646     void PauseJob(System.Guid jobId);
    1647 
    1648     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RestartJob", ReplyAction = "http://tempuri.org/IHiveService/RestartJobResponse")]
    1649     void RestartJob(System.Guid jobId);
    1650 
    1651     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentResponse")]
    1652     HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id);
    1653 
    1654     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentsResponse")]
    1655     System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments();
    1656 
    1657     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetAllHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetAllHiveExperimentsResponse")]
    1658     System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments();
    1659 
    1660     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/AddHiveExperimentResponse")]
    1661     System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto);
    1662 
    1663     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/UpdateHiveExperimentResponse")]
    1664     void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto);
    1665 
    1666     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/DeleteHiveExperimentResponse")]
    1667     void DeleteHiveExperiment(System.Guid hiveExperimentId);
     1665    void DeleteJob(System.Guid JobId);
    16681666
    16691667    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GrantPermission", ReplyAction = "http://tempuri.org/IHiveService/GrantPermissionResponse")]
    1670     void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission);
     1668    void GrantPermission(System.Guid jobId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission);
    16711669
    16721670    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/RevokePermission", ReplyAction = "http://tempuri.org/IHiveService/RevokePermissionResponse")]
    16731671    void RevokePermission(System.Guid hiveExperimentId, System.Guid grantedUserId);
    16741672
    1675     [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperimentPermissions", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentPermissionsResponse")]
    1676     System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId);
     1673    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetJobPermissions", ReplyAction = "http://tempuri.org/IHiveService/GetJobPermissionsResponse")]
     1674    System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetJobPermissions(System.Guid jobId);
    16771675
    16781676    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/IsAllowedPrivileged", ReplyAction = "http://tempuri.org/IHiveService/IsAllowedPrivilegedResponse")]
     
    17801778    }
    17811779
    1782     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobsByResourceId(System.Guid resourceId) {
    1783       return base.Channel.GetJobsByResourceId(resourceId);
     1780    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasksByResourceId(System.Guid resourceId) {
     1781      return base.Channel.GetTasksByResourceId(resourceId);
    17841782    }
    17851783
     
    18121810    }
    18131811
    1814     public System.Guid AddJob(HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData, System.Collections.Generic.List<System.Guid> resourceIds) {
    1815       return base.Channel.AddJob(job, jobData, resourceIds);
    1816     }
    1817 
    1818     public System.Guid AddChildJob(System.Guid parentJobId, HeuristicLab.Clients.Hive.Task job, HeuristicLab.Clients.Hive.TaskData jobData) {
    1819       return base.Channel.AddChildJob(parentJobId, job, jobData);
    1820     }
    1821 
    1822     public HeuristicLab.Clients.Hive.Task GetJob(System.Guid jobId) {
    1823       return base.Channel.GetJob(jobId);
    1824     }
    1825 
    1826     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetJobs() {
     1812    public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds) {
     1813      return base.Channel.AddTask(task, taskData, resourceIds);
     1814    }
     1815
     1816    public System.Guid AddChildTask(System.Guid parentTaskId, HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData) {
     1817      return base.Channel.AddChildTask(parentTaskId, task, taskData);
     1818    }
     1819
     1820    public HeuristicLab.Clients.Hive.Task GetTask(System.Guid taskId) {
     1821      return base.Channel.GetTask(taskId);
     1822    }
     1823
     1824    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Task> GetTasks() {
     1825      return base.Channel.GetTasks();
     1826    }
     1827
     1828    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightTasks(System.Collections.Generic.List<System.Guid> taskIds) {
     1829      return base.Channel.GetLightweightTasks(taskIds);
     1830    }
     1831
     1832    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildTasks(System.Nullable<System.Guid> parentTaskId, bool recursive, bool includeParent) {
     1833      return base.Channel.GetLightweightChildTasks(parentTaskId, recursive, includeParent);
     1834    }
     1835
     1836    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobTasks(System.Guid jobId) {
     1837      return base.Channel.GetLightweightJobTasks(jobId);
     1838    }
     1839
     1840    public HeuristicLab.Clients.Hive.TaskData GetTaskData(System.Guid taskId) {
     1841      return base.Channel.GetTaskData(taskId);
     1842    }
     1843
     1844    public void UpdateTask(HeuristicLab.Clients.Hive.Task taskDto) {
     1845      base.Channel.UpdateTask(taskDto);
     1846    }
     1847
     1848    public void UpdateTaskData(HeuristicLab.Clients.Hive.Task taskDto, HeuristicLab.Clients.Hive.TaskData taskDataDto) {
     1849      base.Channel.UpdateTaskData(taskDto, taskDataDto);
     1850    }
     1851
     1852    public void DeleteTask(System.Guid taskId) {
     1853      base.Channel.DeleteTask(taskId);
     1854    }
     1855
     1856    public void DeleteChildTasks(System.Guid parentTaskId) {
     1857      base.Channel.DeleteChildTasks(parentTaskId);
     1858    }
     1859
     1860    public HeuristicLab.Clients.Hive.Task UpdateTaskState(System.Guid taskId, HeuristicLab.Clients.Hive.TaskState taskState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception) {
     1861      return base.Channel.UpdateTaskState(taskId, taskState, slaveId, userId, exception);
     1862    }
     1863
     1864    public void StopTask(System.Guid taskId) {
     1865      base.Channel.StopTask(taskId);
     1866    }
     1867
     1868    public void PauseTask(System.Guid taskId) {
     1869      base.Channel.PauseTask(taskId);
     1870    }
     1871
     1872    public void RestartTask(System.Guid taskId) {
     1873      base.Channel.RestartTask(taskId);
     1874    }
     1875
     1876    public HeuristicLab.Clients.Hive.Job GetJob(System.Guid id) {
     1877      return base.Channel.GetJob(id);
     1878    }
     1879
     1880    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobs() {
    18271881      return base.Channel.GetJobs();
    18281882    }
    18291883
    1830     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightJobs(System.Collections.Generic.List<System.Guid> jobIds) {
    1831       return base.Channel.GetLightweightJobs(jobIds);
    1832     }
    1833 
    1834     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightChildJobs(System.Nullable<System.Guid> parentJobId, bool recursive, bool includeParent) {
    1835       return base.Channel.GetLightweightChildJobs(parentJobId, recursive, includeParent);
    1836     }
    1837 
    1838     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.LightweightTask> GetLightweightExperimentJobs(System.Guid experimentId) {
    1839       return base.Channel.GetLightweightExperimentJobs(experimentId);
    1840     }
    1841 
    1842     public HeuristicLab.Clients.Hive.TaskData GetJobData(System.Guid jobId) {
    1843       return base.Channel.GetJobData(jobId);
    1844     }
    1845 
    1846     public void UpdateJob(HeuristicLab.Clients.Hive.Task jobDto) {
     1884    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllJobs() {
     1885      return base.Channel.GetAllJobs();
     1886    }
     1887
     1888    public System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto) {
     1889      return base.Channel.AddJob(jobDto);
     1890    }
     1891
     1892    public void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto) {
    18471893      base.Channel.UpdateJob(jobDto);
    18481894    }
    18491895
    1850     public void UpdateJobData(HeuristicLab.Clients.Hive.Task jobDto, HeuristicLab.Clients.Hive.TaskData jobDataDto) {
    1851       base.Channel.UpdateJobData(jobDto, jobDataDto);
    1852     }
    1853 
    1854     public void DeleteJob(System.Guid jobId) {
    1855       base.Channel.DeleteJob(jobId);
    1856     }
    1857 
    1858     public void DeleteChildJobs(System.Guid parentJobId) {
    1859       base.Channel.DeleteChildJobs(parentJobId);
    1860     }
    1861 
    1862     public HeuristicLab.Clients.Hive.Task UpdateJobState(System.Guid jobId, HeuristicLab.Clients.Hive.TaskState jobState, System.Nullable<System.Guid> slaveId, System.Nullable<System.Guid> userId, string exception) {
    1863       return base.Channel.UpdateJobState(jobId, jobState, slaveId, userId, exception);
    1864     }
    1865 
    1866     public void StopJob(System.Guid jobId) {
    1867       base.Channel.StopJob(jobId);
    1868     }
    1869 
    1870     public void PauseJob(System.Guid jobId) {
    1871       base.Channel.PauseJob(jobId);
    1872     }
    1873 
    1874     public void RestartJob(System.Guid jobId) {
    1875       base.Channel.RestartJob(jobId);
    1876     }
    1877 
    1878     public HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id) {
    1879       return base.Channel.GetHiveExperiment(id);
    1880     }
    1881 
    1882     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments() {
    1883       return base.Channel.GetHiveExperiments();
    1884     }
    1885 
    1886     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments() {
    1887       return base.Channel.GetAllHiveExperiments();
    1888     }
    1889 
    1890     public System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) {
    1891       return base.Channel.AddHiveExperiment(hiveExperimentDto);
    1892     }
    1893 
    1894     public void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) {
    1895       base.Channel.UpdateHiveExperiment(hiveExperimentDto);
    1896     }
    1897 
    1898     public void DeleteHiveExperiment(System.Guid hiveExperimentId) {
    1899       base.Channel.DeleteHiveExperiment(hiveExperimentId);
    1900     }
    1901 
    1902     public void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission) {
    1903       base.Channel.GrantPermission(hiveExperimentId, grantedUserId, permission);
     1896    public void DeleteJob(System.Guid JobId) {
     1897      base.Channel.DeleteJob(JobId);
     1898    }
     1899
     1900    public void GrantPermission(System.Guid jobId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission) {
     1901      base.Channel.GrantPermission(jobId, grantedUserId, permission);
    19041902    }
    19051903
     
    19081906    }
    19091907
    1910     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId) {
    1911       return base.Channel.GetHiveExperimentPermissions(hiveExperimentId);
     1908    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetJobPermissions(System.Guid jobId) {
     1909      return base.Channel.GetJobPermissions(jobId);
    19121910    }
    19131911
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/LightweightTask.cs

    r6721 r6743  
    4242      this.State = job.State;
    4343      this.Command = job.Command;
    44       this.LastJobDataUpdate = job.LastJobDataUpdate;
     44      this.LastTaskDataUpdate = job.LastTaskDataUpdate;
    4545    }
    4646
     
    5252      this.State = original.State;
    5353      this.Command = original.Command;
    54       this.LastJobDataUpdate = original.LastJobDataUpdate;
     54      this.LastTaskDataUpdate = original.LastTaskDataUpdate;
    5555    }
    5656    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/TaskDownloader.cs

    r6725 r6743  
    7272   
    7373    public void StartAsync() {
    74       foreach (Guid jobId in taskIds) {
    75         Task job = ServiceLocator.Instance.CallHiveService(s => s.GetJob(jobId));
     74      foreach (Guid taskId in taskIds) {
     75        Task task = ServiceLocator.Instance.CallHiveService(s => s.GetTask(taskId));
    7676
    77         taskDownloader.DownloadJob(job,
     77        taskDownloader.DownloadTask(task,
    7878          (localJob, itemJob) => {
    7979            if (localJob != null && itemJob != null) {
    80               HiveTask hiveJob;
     80              HiveTask hiveTask;
    8181              if (itemJob is OptimizerTask) {
    82                 hiveJob = new OptimizerHiveTask((OptimizerTask)itemJob);
     82                hiveTask = new OptimizerHiveTask((OptimizerTask)itemJob);
    8383              } else {
    84                 hiveJob = new HiveTask(itemJob, true);
     84                hiveTask = new HiveTask(itemJob, true);
    8585              }
    86               hiveJob.Task = localJob;
    87               this.results.Add(localJob.Id, hiveJob);
     86              hiveTask.Task = localJob;
     87              this.results.Add(localJob.Id, hiveTask);
    8888            }
    8989          });
Note: See TracChangeset for help on using the changeset viewer.