Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/16/11 00:18:48 (13 years ago)
Author:
cneumuel
Message:

#1233

  • stability improvements for HiveEngine
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/ExperimentManagerClient.cs

    r6178 r6200  
    239239      }
    240240    }
    241 
     241   
    242242    /// <summary>
    243243    /// Uploads the local configuration file as plugin
     
    286286      }
    287287
    288       hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(service, this.onlinePlugins, this.alreadyUploadedPlugins, plugins, useLocalPlugins);
     288      TryAndRepeat(() => {
     289        hiveJob.Job.PluginsNeededIds = PluginUtil.GetPluginDependencies(service, this.onlinePlugins, this.alreadyUploadedPlugins, plugins, useLocalPlugins);
     290      }, -1, "Failed to upload plugins");
    289291      hiveJob.Job.PluginsNeededIds.Add(configPluginId);
    290292      hiveJob.Job.HiveExperimentId = hiveExperimentId;
     
    293295      progress.ProgressValue = (double)jobCount / totalJobCount;
    294296
    295       if (parentHiveJob != null) {
    296         hiveJob.Job.Id = service.AddChildJob(parentHiveJob.Job.Id, hiveJob.Job, jobData);
    297       } else {
    298         hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, groups.ToList());
    299       }
     297
     298      TryAndRepeat(() => {
     299        if (parentHiveJob != null) {
     300          hiveJob.Job.Id = service.AddChildJob(parentHiveJob.Job.Id, hiveJob.Job, jobData);
     301        } else {
     302          hiveJob.Job.Id = service.AddJob(hiveJob.Job, jobData, groups.ToList());
     303        }
     304      }, -1, "Failed to add job");
    300305
    301306      foreach (HiveJob child in hiveJob.ChildHiveJobs) {
     
    382387      }
    383388    }
     389
     390    /// <summary>
     391    /// Executes the action. If it throws an exception it is repeated until repetition-count is reached.
     392    /// If repetitions is -1, it is repeated infinitely.
     393    /// </summary>
     394    public static void TryAndRepeat(Action action, int repetitions, string errorMessage) {
     395      try { action(); }
     396      catch (Exception e) {
     397        repetitions--;
     398        if (repetitions == 0)
     399          throw new HiveException(errorMessage, e);
     400        TryAndRepeat(action, repetitions, errorMessage);
     401      }
     402    }
    384403  }
    385404}
Note: See TracChangeset for help on using the changeset viewer.