Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/31/11 10:35:57 (14 years ago)
Author:
cneumuel
Message:

#1260

  • fixed wiring of textboxes in HiveExperimentManager
  • robustified results polling in HiveExperimentManager
  • robustified HiveEngine
Location:
branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3/HiveEngine.cs

    r5394 r5399  
    5151      }
    5252    }
    53    
     53
    5454    #region constructors and cloning
    5555    public HiveEngine() {
     
    310310    private void DeleteJobs(IDictionary<Guid, int> jobIndices) {
    311311      if (jobIndices.Count > 0) {
    312         using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
    313           foreach (Guid jobId in jobIndices.Keys) {
    314             service.Obj.DeleteJob(jobId);
    315           }
    316           LogMessage(string.Format("Deleted {0} jobs on hive.", jobIndices.Count));
    317           jobIndices.Clear();
    318         }
     312        TryAndRepeat(() => {
     313          LogMessage(string.Format("Deleting {0} jobs on hive.", jobIndices.Count));
     314          using (Disposable<IClientFacade> service = ServiceLocator.Instance.ClientFacadePool.GetService()) {
     315            foreach (Guid jobId in jobIndices.Keys) {
     316              service.Obj.DeleteJob(jobId);
     317            }
     318            jobIndices.Clear();
     319          }
     320        }, 5, string.Format("Could not delete {0} jobs", jobIndices.Count));
    319321      }
    320322    }
     
    364366            catch (Exception e) {
    365367              LogException(e);
     368              LogMessage("Repeating upload");
    366369            }
    367370          }
     
    393396          catch (Exception e) {
    394397            LogException(e);
     398            LogMessage("Repeating download");
    395399          }
    396400        }
     
    423427      }
    424428    }
     429
     430    /// <summary>
     431    /// Executes the action. If it throws an exception it is repeated until repetition-count is reached.
     432    /// If repetitions is -1, it is repeated infinitely.
     433    /// </summary>
     434    private static void TryAndRepeat(Action action, int repetitions, string errorMessage) {
     435      while (repetitions > 0) {
     436        try { action(); }
     437        catch (Exception e) {
     438          repetitions--;
     439          if (repetitions == 0) {
     440            throw new HiveEngineException(errorMessage, e);
     441          }
     442        }
     443      }
     444    }
     445
     446    private static void TryAndRepeat(Action action) {
     447      TryAndRepeat(action, -1, string.Empty);
     448    }
    425449  }
    426450
  • branches/HeuristicLab.Hive-3.3/sources/HeuristicLab.Hive/HeuristicLab.HiveEngine/3.3/HiveEngineException.cs

    r5228 r5399  
    77  public class HiveEngineException : Exception {
    88    public HiveEngineException(string message) : base(message) { }
     9
     10    public HiveEngineException(string message, Exception innerException) : base (message, innerException) { }
    911  }
    1012}
Note: See TracChangeset for help on using the changeset viewer.