Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Clients.Hive.Slave.AzureClient/3.3/HiveHelper.cs @ 15731

Last change on this file since 15731 was 9508, checked in by fschoepp, 12 years ago

#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.
File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.Clients.Hive.SlaveCore;
6using Microsoft.WindowsAzure.ServiceRuntime;
7
8namespace HeuristicLab.Clients.Hive.Slave.AzureClient {
9  static class HiveHelper {
10    private static HiveServiceLocator ConfigureHive() {
11      var serviceLocator = new HiveServiceLocator();
12      serviceLocator.RemoteAddress = RoleEnvironment.GetConfigurationSettingValue("HiveServerAddress");
13      serviceLocator.IdentityCertificate = RoleEnvironment.GetConfigurationSettingValue("HiveServerCertifcateEncodedValue");     
14      serviceLocator.Username = RoleEnvironment.GetConfigurationSettingValue("HiveServerUsername");
15      serviceLocator.Password = RoleEnvironment.GetConfigurationSettingValue("HiveServerPassword");
16      return serviceLocator;
17    }
18
19    public static void RegisterSlaveToGroup(string groupName) {
20      var locator = ConfigureHive();
21      var me = locator.CallHiveService(service => {
22        return service.GetSlave(ConfigManager.Instance.GetClientInfo().Id);
23      });
24
25      var group = locator.CallHiveService(service => {
26        return (from s in service.GetSlaveGroups() where s.Name == groupName select s).FirstOrDefault();
27      });
28      if (me.ParentResourceId == null || me.ParentResourceId != me.Id) {
29        me.ParentResourceId = group.Id;
30
31        locator.CallHiveService((s) => s.UpdateSlaveGroup((SlaveGroup)group));
32        locator.CallHiveService((s) => s.UpdateSlave(me));
33      }
34    }
35  }
36}
Note: See TracBrowser for help on using the repository browser.