Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9365


Ignore:
Timestamp:
04/17/13 10:49:49 (11 years ago)
Author:
fschoepp
Message:

#1888:

  • WorkerRole of Slave now logs all exceptions during startup to the blobstore (slavelog).
  • The PluginManager throws an exception during CheckWorkingDirectories() (Save method) which will be caught now, preventing crashes in Windows Azure.
  • "db.DeferredLocal = false" has been removed to prevent loading bugs.
  • HiveScenarioManager doesn't crash anymore, if he can't find an algorithm within a job during retrieval of the run results.
Location:
branches/OaaS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave.AzureClient/3.3/WorkerRole.cs

    r8251 r9365  
    2626using Microsoft.WindowsAzure.Diagnostics;
    2727using Microsoft.WindowsAzure.ServiceRuntime;
     28using Microsoft.WindowsAzure;
     29using Microsoft.WindowsAzure.StorageClient;
     30using System.Text;
    2831
    2932namespace HeuristicLab.Clients.Hive.Slave.AzureClient {
     33
     34
    3035  public class WorkerRole : RoleEntryPoint {
    3136    private Core core;
     
    3641
    3742    public override void Run() {
    38       core = new Core(false);
     43      try {
     44        LogError(new Exception("Starting Run()..."));
     45        core = new Core(false);
    3946
    40       string hiveServerAddress = RoleEnvironment.GetConfigurationSettingValue(HiveServerAddressSetting);
    41       string hiveServerCertificate = RoleEnvironment.GetConfigurationSettingValue(HiveServerCertificateSetting);
     47        string hiveServerAddress = RoleEnvironment.GetConfigurationSettingValue(HiveServerAddressSetting);
     48        string hiveServerCertificate = RoleEnvironment.GetConfigurationSettingValue(HiveServerCertificateSetting);
    4249
    43       // values are empty, settings from app.config are used
    44       if (!string.IsNullOrEmpty(hiveServerAddress) && !string.IsNullOrEmpty(hiveServerCertificate)) {
    45         core.SetNewHiveServer(hiveServerAddress, hiveServerCertificate);
     50        // values are empty, settings from app.config are used
     51        if (!string.IsNullOrEmpty(hiveServerAddress) && !string.IsNullOrEmpty(hiveServerCertificate)) {
     52          core.SetNewHiveServer(hiveServerAddress, hiveServerCertificate);
     53        }
     54
     55        coreThread = new Thread(core.Start);
     56        coreThread.Start();
     57
     58        LogError(new Exception("Run(): Core started successfullly"));
     59        while (true) {
     60          Thread.Sleep(10000);
     61        }
    4662      }
    47 
    48       coreThread = new Thread(core.Start);
    49       coreThread.Start();
    50 
    51       while (true) {
    52         Thread.Sleep(10000);
     63      catch (Exception e) {
     64        LogError(e);
     65    throw e;
    5366      }
    5467    }
    5568
    5669    public override bool OnStart() {
    57       ServicePointManager.DefaultConnectionLimit = 12;
    58       //core = new Core();
    5970      try {
    60         if (!String.IsNullOrEmpty(RoleEnvironment.GetConfigurationSettingValue(Constants.DiagnosticsConnectionString))) {
    61           DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
    62           dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
    63           dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
    64           DiagnosticMonitor.Start(Constants.DiagnosticsConnectionString, dmc);
     71        ServicePointManager.DefaultConnectionLimit = 12;
     72        //core = new Core();
     73        LogError(new Exception("Running OnStart()"));
     74        try {
     75          if (!String.IsNullOrEmpty(RoleEnvironment.GetConfigurationSettingValue(Constants.DiagnosticsConnectionString))) {
     76            DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
     77            dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromSeconds(5);
     78            dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
     79            DiagnosticMonitor.Start(Constants.DiagnosticsConnectionString, dmc);
     80          }
    6581        }
     82        catch (RoleEnvironmentException ex) {
     83          // diagnostics connection string not in configuration
     84          // -> diagnostics disabled
     85          // nothing more to do
     86          LogError(ex);
     87        }
     88
     89        RoleEnvironment.Changed += RoleEnvironmentChanged;
     90        LogError(new Exception("Finished OnStart() successfullly"));
    6691      }
    67       catch (RoleEnvironmentException ex) {
    68         // diagnostics connection string not in configuration
    69         // -> diagnostics disabled
    70         // nothing more to do
     92      catch (Exception ex) {
     93        LogError(ex);
     94    throw ex;
    7195      }
     96      return base.OnStart();
     97    }
    7298
    73       RoleEnvironment.Changed += RoleEnvironmentChanged;
    74 
    75       return base.OnStart();
     99    private void LogError(Exception e) {
     100      var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=optimizationstorage1;AccountKey=n7Leom8ZFWkof/VQ2a4aRSvwOlX+Gwr3uojQF9CFJw1osmGCV0WwaNC8s7nkZ+qteLduAgW2l75WFpbXrkvG4Q==");
     101      var blobClient = storageAccount.CreateCloudBlobClient();
     102      var container = blobClient.GetContainerReference("slavelog");
     103      container.CreateIfNotExist();
     104      var guid = Guid.NewGuid();
     105      var blob = container.GetBlobReference(guid.ToString());
     106      var builder = new StringBuilder();
     107      builder.Append("ToString: ").Append(e.ToString()).Append("\n");
     108      builder.Append("Message: ").Append(e.Message).Append("\n");
     109      blob.UploadText(builder.ToString());
    76110    }
    77111
  • branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Manager/PluginManager.cs

    r9363 r9365  
    6161      if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginCacheDir)) {
    6262        CoreProperties.Settings.Default.PluginCacheDir = Path.Combine(Path.GetTempPath(), CoreProperties.Settings.Default.PluginCacheDir);
    63         CoreProperties.Settings.Default.Save();
     63        try {
     64          CoreProperties.Settings.Default.Save();
     65        }
     66        catch (Exception ex) {
     67          log.LogException(ex);
     68        }
    6469      }
    6570
    6671      if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginTempBaseDir)) {
    6772        CoreProperties.Settings.Default.PluginTempBaseDir = Path.Combine(Path.GetTempPath(), CoreProperties.Settings.Default.PluginTempBaseDir);
    68         CoreProperties.Settings.Default.Save();
     73        try {
     74          CoreProperties.Settings.Default.Save();       
     75        }
     76        catch (Exception ex) {
     77          log.LogException(ex);
     78        }       
    6979      }
    7080    }
  • branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r9363 r9365  
    239239    public DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) {
    240240      return ExecuteWithContext<DT.Task>((db) => {
    241         db.DeferredLoadingEnabled = false;
    242241        var task = db.Tasks.SingleOrDefault(x => x.TaskId == taskId);
    243242        task.State = taskState;
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs

    r9362 r9365  
    294294            Model.Run taskRun = new Model.Run();
    295295            taskRun.Id = taskRun.Name = run.Name;
    296             taskRun.AlgorithmName = run.Algorithm.Name;
     296            taskRun.AlgorithmName = run.Algorithm != null ? run.Algorithm.Name : run.Name;
    297297            IList<Parameter> resultValues = new List<Model.Parameter>();
    298298            foreach (var key in run.Results.Keys) {
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj

    r9335 r9365  
    319319    <Content Include="Views\Home\Index.cshtml" />
    320320    <Content Include="Views\Optimization\AlgorithmParameters.cshtml" />
    321     <Content Include="Views\Optimization\Copy of JobDetails.cshtml" />
    322321    <Content Include="Views\Optimization\Index.cshtml">
    323322      <SubType>Code</SubType>
Note: See TracChangeset for help on using the changeset viewer.