Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/22/13 15:29:15 (12 years ago)
Author:
fschoepp
Message:

#1888:
HL:

  • Web projects requires different users to interact with hive. The singleton HiveServiceLocator.Instance doesn't allow different users at the same time, resulting in serialization during access of HiveClient methods.

The following changes have been introduced in favor of a parallel use of the HL libs:

  • HiveClient, TaskDownloader and ConcurrentTaskDownloader may now use a different IHiveServiceLocator than HiveServiceLocator.Instance (all methods have appropriate overloads now).
  • The default instance is still HiveServiceLocator.Instance.

Automated Scaling of Instances:

  • Added Scaler project to solution which represents a WorkerRole that scales the slave instances based on the global cpu utilization of all slaves.
  • Scaler is based on WASABi, rules can be adjusted in rulesstore.xml. Basic rule is: if < 45% global cpu utilization => remove an instance; if > 65% cpu => add an instance. Minimum boundary is 1 and maximum boundary is 8 slave instances.
  • Adjusted Slave project to automatically register itself to a SlaveGroup during WebRole startup (can be adjusted in service configuration).

Web-Frontend:

  • Added basic error messages to the dialogs when an ajax call fails.
  • Removed Styling.js from scripts.
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Controller
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Azure/DAL.cs

    r9395 r9508  
    225225    }
    226226
    227     //private Experiment Convert(ExperimentEntity entity, string entityJson) {
    228     //  // TODO: Read the whole experiment, not just the names!
    229     //  var exp = new Experiment() { Name = entity.RowKey.Split('_')[1] };
    230     //  foreach (var scenarioName in entity.Algorithms.Split(','))
    231     //    exp.Algorithm.Add(new Algorithm() { Name = scenarioName });
    232     //  return exp;
    233     //}
    234 
    235227    public IEnumerable<Model.Experiment> GetExperiments(string user, bool namesOnly=false) {
    236228      TableServiceContext serviceContext = TableClient.GetDataServiceContext();
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HLMapper.cs

    r9166 r9508  
    3737    public static DoubleMatrix ConvertToDoubleMatrix(Parameter parameter) {
    3838      var matrix = parameter.Value as DecimalMatrix;
    39       // TODO: Check for empty matrices
     39     
     40      if (matrix.Value.Length == 0 || matrix.Value[0].Length == 0) {
     41        return new DoubleMatrix(new double[0, 0]);
     42      }
     43
    4044      double[,] data = new double[matrix.Value.Length, matrix.Value[0].Length];
    4145      for (int i=0; i < matrix.Value.Length; i++) {
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs

    r9395 r9508  
    8181
    8282    public bool DispatchExperiment(User user, Model.Experiment exp, JobExecutionDetails details) {
    83       // TODO: Determine how to build a tree of IAlgorithm
    8483      // For now the experiment will be flatened for execution
    8584      HeuristicLab.Optimization.Experiment hiveExperiment = new HeuristicLab.Optimization.Experiment(exp.Name);
     
    9493        var entry = stack.Pop();
    9594        // handle current entry
    96 
    97         // TODO: Store scenario name in entry.Child.Mapper when saving
    9895        foreach (var child in entry.Children) {
    9996          // This is a template experiment;
     
    215212      }     
    216213      job.HiveTasks.Add(new OptimizerHiveTask(exp));
    217       var service = ConfigureHive(user);
    218      
    219       // TODO: Fix HiveClient class to be not dependent on singleton HiveServiceLocator!!!
    220       HiveServiceLocator.Instance.Username = user.Username;
    221       HiveServiceLocator.Instance.Password = user.Password;
    222       HiveServiceLocator.Instance.EndpointConfigurationName = Configuration.HiveEndpointName;
    223       HiveClient.Store(job, new CancellationToken());
     214           
     215      var locator = ConfigureHive(user);
     216      HiveClient.Store(job, new CancellationToken(), locator);
    224217     
    225218      job.StopResultPolling();
     
    277270        taskIds.Add(task.Id);
    278271      }
    279 
    280       // TODO: Fix problems with the HiveServiceLocater singleton!!!
    281       HiveServiceLocator.Instance.Username = user.Username;
    282       HiveServiceLocator.Instance.Password = user.Password;
    283       HiveServiceLocator.Instance.EndpointConfigurationName = Configuration.HiveEndpointName;
    284       TaskDownloader downloader = new TaskDownloader(taskIds);
     272 
     273      TaskDownloader downloader = new TaskDownloader(taskIds, ConfigureHive(user));
    285274      downloader.StartAsync();
    286275      while (!downloader.IsFinished) {       
     
    291280        }
    292281      }
    293       //var experiment = dal.JobDao.FindByJobId(user.Username, id);
    294282
    295283      IDictionary<Guid, HiveTask> hiveTasks = downloader.Results;
     
    330318      return runs;
    331319    }
    332 
    333     //TODO: We might need images / +++
    334320   
    335321    private Parameter MapHiveDataType(string name, IItem item) {
     
    341327      var result = new Parameter();
    342328      result.Type = ParameterType.String;
    343       //TODO: How shall we handle dll specific datatypes?     
    344       //if (item is PathTSPTour) {
    345       //  var tour = item as PathTSPTour;           
    346       //}
    347       //else
    348329      if (item is IStringConvertibleValue) {
    349330        var value = (item as IStringConvertibleValue).GetValue();
     
    440421        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = item.ItemName != null ? item.ItemName + " (Cannot be displayed properly as string)" : "Cannot be displayed properly as string" };
    441422      }
    442       // TODO: Add workaround for TSP
    443423      return result;
    444424    }
     
    541521
    542522    public Model.Task GetTaskData(User u, string jobId, string taskId) {
    543       ConfigureHive(u);
    544       HiveServiceLocator.Instance.Username = u.Username;
    545       HiveServiceLocator.Instance.Password = u.Password;
    546       HiveServiceLocator.Instance.EndpointConfigurationName = Configuration.HiveEndpointName;
    547       TaskDownloader downloader = new TaskDownloader(new List<Guid>(){Guid.Parse(taskId)});
     523      TaskDownloader downloader = new TaskDownloader(new List<Guid>(){Guid.Parse(taskId)}, ConfigureHive(u));
    548524      downloader.StartAsync();
    549525      while (!downloader.IsFinished) {
     
    583559      // push all elements to dictionary
    584560      foreach (var task in jobTasks) {
    585         // TODO: Crawl children + parent and create hierarchy!
    586561        var children = serviceLocator.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightChildTasks(Guid.Parse(jobId), true, true));
    587562        foreach (var child in children) {
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj

    r9350 r9508  
    177177    <Compile Include="Interfaces\IScenarioManager.cs" />
    178178    <Compile Include="Interfaces\Model\ControllerModel.cs" />
     179    <Compile Include="Logging\TableStorageTraceListener.cs" />
    179180    <Compile Include="Mockup\MockupDAL.cs" />
    180181    <Compile Include="Mockup\MockupScenarioManager.cs" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs

    r9395 r9508  
    88
    99namespace HeuristicLab.Services.Optimization.ControllerService {
     10  /// <summary>
     11  /// The ControllerService represents the entry point of
     12  /// the OaaS backend. It contains all possible operations
     13  /// of OaaS.
     14  /// </summary>
    1015  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
    1116  public interface IControllerService {
     17    /// <summary>
     18    /// Retrieves all available scenarios, including all
     19    /// their information.
     20    /// </summary>
     21    /// <returns>All scenarios</returns>
    1222    [OperationContract]
    1323    IEnumerable<OptimizationScenario> GetOptimizationScenarios();
    1424
     25    /// <summary>
     26    /// Returns the names of all scenarios. This doesn't load
     27    /// parameters or other scenario specific data.
     28    /// </summary>
     29    /// <returns>
     30    /// The names of the scenarios,
     31    /// e. g. ["Benchmark Algorithm", "Genetic Algorithm - TSP"]
     32    /// </returns>
    1533    [OperationContract]
    1634    IEnumerable<string> GetOptimizationScenarioNames();
    1735
     36    /// <summary>
     37    /// Retrieves a scenario by a given name including all of
     38    /// it's data.
     39    /// </summary>
     40    /// <param name="name">
     41    /// The scenario to lookup, e. g. "Benchmark Algorithm"
     42    /// </param>
     43    /// <returns></returns>
    1844    [OperationContract]
    1945    OptimizationScenario GetOptimizationScenarioByName(string name);
    2046
     47    /// <summary>
     48    /// Schedules a scenario for certain user.   
     49    /// </summary>
     50    /// <param name="user">The user which wants to execute a scenario.</param>
     51    /// <param name="scenario">The scenario to execute.</param>
     52    /// <param name="details">The title of the job, the number of repititions of the scenario and the group of the job.</param>
     53    /// <returns>true, if the scenario has been successfully scheduled.</returns>
    2154    [OperationContract]
    2255    bool ScheduleOptimizationScenario(User user, OptimizationScenario scenario, JobExecutionDetails details);
    2356
     57    /// <summary>
     58    /// Schedules an experiment for a certain user.
     59    /// </summary>
     60    /// <param name="user">The user which wants to execute a scenario.</param>
     61    /// <param name="experiment">The name of the experiment to schedule.</param>
     62    /// <param name="details">The title of the job, the number of repititions of the experiment and the group of the job.</param>
     63    /// <returns></returns>
    2464    [OperationContract]
    2565    bool ScheduleExperiment(User user, string experiment, JobExecutionDetails details);
    2666
     67    /// <summary>
     68    /// Returns all available jobs of a user.
     69    /// </summary>
     70    /// <param name="user">The user to query the jobs for.</param>
     71    /// <returns>All jobs for a certain user.</returns>
    2772    [OperationContract]
    2873    IEnumerable<Job> GetJobs(User user);
    2974
     75    /// <summary>
     76    /// Retrievs a job by it's id.
     77    /// </summary>
     78    /// <param name="user">The owner of the job.</param>
     79    /// <param name="id">The id of the job.</param>
     80    /// <returns>The job with the given user and id.</returns>
    3081    [OperationContract]
    3182    Job GetJob(User user, string id);
    3283
     84    /// <summary>
     85    /// Deletes a job of a user.
     86    /// </summary>
     87    /// <param name="user">The owner of the job.</param>
     88    /// <param name="id">The job to delete.</param>
     89    /// <returns>true, if the job has been deleted.</returns>
    3390    [OperationContract]
    3491    bool DeleteJob(User user, string id);
    3592
     93    /// <summary>
     94    /// Returns the results of a job including the input parameters and result parameters.
     95    /// </summary>
     96    /// <param name="user">The owner of the job.</param>
     97    /// <param name="id">The id of the job.</param>
     98    /// <returns>The result and input parameters of the job.</returns>
    3699    [OperationContract]
    37100    IList<Model.Run> GetJobResults(User user, string id);
    38101
     102    /// <summary>   
     103    /// Adds a new scenario to the system. This has to include a valid scenario xml representing all necessary inputs
     104    /// for the new scenario and a scenario mapper which is capable of converting the OaaS-scenario-model into the
     105    /// hive specific version.
     106    /// Note: This method might be only usable by an underlying hive data access layer.
     107    /// </summary>
     108    /// <param name="user">The owner of the scenario (must have administrator privileges).</param>
     109    /// <param name="scenarioXml">The new scenario to upload.</param>
     110    /// <param name="scenarioMapper">The converter between OaaS-model and hive model.</param>
     111    /// <returns>true, if the scenario has been successfully saved.</returns>
    39112    [OperationContract]
    40113    bool AddHiveScenario(User user, string scenarioXml, string scenarioMapper);
    41 
     114   
     115    /// <summary>
     116    /// Deletes a stored scenario including its xml and mapper.
     117    /// </summary>
     118    /// <param name="user">An administrator of the system.</param>
     119    /// <param name="scenarioName">The name of the scenario.</param>
     120    /// <returns>true, if the scenario has been deleted.</returns>
    42121    [OperationContract]
    43122    bool DeleteHiveScenario(User user, string scenarioName);
    44123
     124    /// <summary>
     125    /// Stores an experiment which is a tree of experiments and scenarios.
     126    /// This method will schedule the experiment, if it contains job details.
     127    /// </summary>
     128    /// <param name="user">The owner of the experiment.</param>
     129    /// <param name="experiment">The experiment including all of it's details.</param>
     130    /// <returns>If scheduled it will return the job id. In every other case null will be returned.</returns>
    45131    [OperationContract]
    46132    string SaveExperiment(User user, Experiment experiment);
    47133
     134    /// <summary>
     135    /// Returns the names of the experiments for a certain user.
     136    /// </summary>
     137    /// <param name="user">The owner of the experiments.</param>
     138    /// <returns>A list of experiment names.</returns>
    48139    [OperationContract]
    49140    IEnumerable<string> GetExperimentNames(User user);
    50141
     142    /// <summary>
     143    /// Returns all experiments. If "namesOnly" is false, the experiments include all of their details.   
     144    /// </summary>
     145    /// <param name="user">The owner of the experiments.</param>
     146    /// <param name="namesOnly">If true, returns only a list of experiments where only the Name parameter is set.</param>
     147    /// <returns></returns>
    51148    [OperationContract]
    52149    IEnumerable<Experiment> GetExperiments(User user, bool namesOnly = false);
    53150
     151    /// <summary>
     152    /// TODO
     153    /// </summary>
     154    /// <param name="user"></param>
     155    /// <param name="experiment"></param>
     156    /// <returns></returns>
    54157    [OperationContract]
    55158    bool DeleteExperiment(User user, string experiment);
Note: See TracChangeset for help on using the changeset viewer.