Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Hive.WebRole/WebRole.cs @ 15936

Last change on this file since 15936 was 9215, checked in by fschoepp, 12 years ago

#1888:

  • Janitor is now working as expected in Windows Azure
  • Added basic support for experiments (draggable experiments)
  • Added methods to save/read experiments from TableStorage
  • The job status can now be retrieved by using the GetTasks/GetTaskData methods
  • Added a class to convert JSON-objects to Algorithm instances
  • Web page: Added experiment button to navigation
File size: 3.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Threading;
24using Microsoft.WindowsAzure.Diagnostics;
25using Microsoft.WindowsAzure.ServiceRuntime;
26using System.Diagnostics;
27
28namespace HeuristicLab.Services.Hive.WebRole {
29  public class WebRole : RoleEntryPoint {
30    private HiveJanitor janitor;
31    private Thread janitorThread;
32
33    public override bool OnStart() {
34      Trace.WriteLine("Starting Janitor Service...");
35      try {
36        DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
37        /*diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
38        diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());*/
39        diagnosticConfig.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
40        diagnosticConfig.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
41        diagnosticConfig.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
42        diagnosticConfig.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
43        DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfig);
44      }
45      catch (Exception e) {
46        Trace.WriteLine("Error during diagnostic configuration: " + e.Message);
47      }
48
49      // To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config 
50     
51      Trace.WriteLine("Loading diagnostic configuration...");
52     
53      // For information on handling configuration changes
54      // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
55
56      // Start Janitorn Service:
57      Trace.WriteLine("Starting HiveJanitor...");
58      try {
59        janitor = new HiveJanitor();
60        janitorThread = new Thread(janitor.Run);
61        janitorThread.IsBackground = true; //dont keep app alive
62        janitorThread.Start();
63      }
64      catch (Exception e) {
65        Trace.WriteLine("Error during janitor startup: " + e.Message);
66      }
67      Trace.WriteLine("Startup completed...");
68      return base.OnStart();
69    }
70
71    public override void OnStop() {
72      janitor.StopJanitor();
73      janitorThread.Join();
74      base.OnStop();
75    }
76  }
77}
Note: See TracBrowser for help on using the repository browser.