Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.Slave.AzureClient/WorkerRole.cs @ 7005

Last change on this file since 7005 was 7005, checked in by spimming, 12 years ago

#1680:

  • enable Remote Desktop Connection to roles
  • adapt connection string for Azure Storage in cloud configuration
  • add diagnostics to worker role
File size: 1.2 KB
Line 
1using System;
2using System.Net;
3using System.Threading;
4using HeuristicLab.Clients.Hive.SlaveCore;
5using Microsoft.WindowsAzure.Diagnostics;
6using Microsoft.WindowsAzure.ServiceRuntime;
7
8namespace HeuristicLab.Clients.Hive.Slave.AzureClient {
9  public class WorkerRole : RoleEntryPoint {
10    private Core core;
11    private Thread coreThread;
12
13    public override void Run() {
14      core = new Core(false);
15      coreThread = new Thread(core.Start);
16      coreThread.Start();
17
18      while (true) {
19        Thread.Sleep(10000);
20        //Trace.WriteLine("Working", "Information");
21      }
22    }
23
24    public override bool OnStart() {
25      ServicePointManager.DefaultConnectionLimit = 12;
26      core = new Core();
27
28      DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
29      dmc.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
30      dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
31      DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmc);
32
33      return base.OnStart();
34    }
35
36    public override void OnStop() {
37      core.Shutdown();
38      base.OnStop();
39    }
40  }
41}
Note: See TracBrowser for help on using the repository browser.