Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/06/11 12:49:34 (12 years ago)
Author:
ascheibe
Message:

#1672

  • fixed name of slave windows service

reviewing comments:

  • reduced MaxParallelDownloads to 2 to not completely overload cpus
  • renamed ServiceLocator to HiveServiceLocator
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r7125 r7132  
    8282
    8383      try {
    84         this.IsAllowedPrivileged = ServiceLocator.Instance.CallHiveService((s) => s.IsAllowedPrivileged());
     84        this.IsAllowedPrivileged = HiveServiceLocator.Instance.CallHiveService((s) => s.IsAllowedPrivileged());
    8585
    8686        var oldJobs = jobs ?? new ItemCollection<RefreshableJob>();
    8787        jobs = new HiveItemCollection<RefreshableJob>();
    88         var jobsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
     88        var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
    8989
    9090        foreach (var j in jobsLoaded) {
     
    142142        if (item is JobPermission) {
    143143          var hep = (JobPermission)item;
    144           hep.GrantedUserId = ServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));
     144          hep.GrantedUserId = HiveServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));
    145145          if (hep.GrantedUserId == Guid.Empty) {
    146146            throw new ArgumentException(string.Format("The user {0} was not found.", hep.GrantedUserName));
    147147          }
    148           ServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
     148          HiveServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
    149149        }
    150150      } else {
    151151        if (item is Job)
    152           ServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item));
     152          HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item));
    153153      }
    154154    }
     
    176176
    177177      if (item is Job)
    178         ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
     178        HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
    179179      if (item is RefreshableJob)
    180         ServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
     180        HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
    181181      if (item is JobPermission) {
    182182        var hep = (JobPermission)item;
    183         ServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));
     183        HiveServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));
    184184      }
    185185      item.Id = Guid.Empty;
     
    215215
    216216    public static void PauseJob(RefreshableJob refreshableJob) {
    217       ServiceLocator.Instance.CallHiveService(service => {
     217      HiveServiceLocator.Instance.CallHiveService(service => {
    218218        foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) {
    219219          if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed)
     
    225225
    226226    public static void StopJob(RefreshableJob refreshableJob) {
    227       ServiceLocator.Instance.CallHiveService(service => {
     227      HiveServiceLocator.Instance.CallHiveService(service => {
    228228        foreach (HiveTask task in refreshableJob.GetAllHiveTasks()) {
    229229          if (task.Task.State != TaskState.Finished && task.Task.State != TaskState.Aborted && task.Task.State != TaskState.Failed)
     
    246246        var resourceIds = new List<Guid>();
    247247        foreach (var resourceName in resourceNames) {
    248           Guid resourceId = ServiceLocator.Instance.CallHiveService((s) => s.GetResourceId(resourceName));
     248          Guid resourceId = HiveServiceLocator.Instance.CallHiveService((s) => s.GetResourceId(resourceName));
    249249          if (resourceId == Guid.Empty) {
    250250            throw new ResourceNotFoundException(string.Format("Could not find the resource '{0}'", resourceName));
     
    259259        // upload Job
    260260        refreshableJob.Progress.Status = "Uploading Job...";
    261         refreshableJob.Job.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));
     261        refreshableJob.Job.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));
    262262        bool isPrivileged = refreshableJob.Job.IsPrivileged;
    263         refreshableJob.Job = ServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
     263        refreshableJob.Job = HiveServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
    264264        refreshableJob.Job.IsPrivileged = isPrivileged;
    265265        cancellationToken.ThrowIfCancellationRequested();
     
    271271        // upload plugins
    272272        refreshableJob.Progress.Status = "Uploading plugins...";
    273         this.OnlinePlugins = ServiceLocator.Instance.CallHiveService((s) => s.GetPlugins());
     273        this.OnlinePlugins = HiveServiceLocator.Instance.CallHiveService((s) => s.GetPlugins());
    274274        this.AlreadyUploadedPlugins = new List<Plugin>();
    275         Plugin configFilePlugin = ServiceLocator.Instance.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins));
     275        Plugin configFilePlugin = HiveServiceLocator.Instance.CallHiveService((s) => UploadConfigurationFile(s, onlinePlugins));
    276276        this.alreadyUploadedPlugins.Add(configFilePlugin);
    277277        cancellationToken.ThrowIfCancellationRequested();
     
    357357          if (!cancellationToken.IsCancellationRequested) {
    358358            lock (pluginLocker) {
    359               ServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
     359              HiveServiceLocator.Instance.CallHiveService((s) => hiveTask.Task.PluginsNeededIds = PluginUtil.GetPluginDependencies(s, this.onlinePlugins, this.alreadyUploadedPlugins, plugins));
    360360            }
    361361          }
     
    370370          if (!cancellationToken.IsCancellationRequested) {
    371371            if (parentHiveTask != null) {
    372               hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));
     372              hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));
    373373            } else {
    374               hiveTask.Task.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
     374              hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
    375375            }
    376376          }
     
    417417        // fetch all task objects to create the full tree of tree of HiveTask objects
    418418        refreshableJob.Progress.Status = "Downloading list of tasks...";
    419         allTasks = ServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id));
     419        allTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasks(hiveExperiment.Id));
    420420        totalJobCount = allTasks.Count();
    421421
     
    480480
    481481    public static ItemTask LoadItemJob(Guid jobId) {
    482       TaskData taskData = ServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId));
     482      TaskData taskData = HiveServiceLocator.Instance.CallHiveService(s => s.GetTaskData(jobId));
    483483      try {
    484484        return PersistenceUtil.Deserialize<ItemTask>(taskData.Data);
     
    505505
    506506    public static HiveItemCollection<JobPermission> GetJobPermissions(Guid jobId) {
    507       return ServiceLocator.Instance.CallHiveService((service) => {
     507      return HiveServiceLocator.Instance.CallHiveService((service) => {
    508508        IEnumerable<JobPermission> jps = service.GetJobPermissions(jobId);
    509509        foreach (var hep in jps) {
Note: See TracChangeset for help on using the changeset viewer.