Changeset 9365 for branches/OaaS
- Timestamp:
- 04/17/13 10:49:49 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Clients.Hive.Slave.AzureClient/3.3/WorkerRole.cs
r8251 r9365 26 26 using Microsoft.WindowsAzure.Diagnostics; 27 27 using Microsoft.WindowsAzure.ServiceRuntime; 28 using Microsoft.WindowsAzure; 29 using Microsoft.WindowsAzure.StorageClient; 30 using System.Text; 28 31 29 32 namespace HeuristicLab.Clients.Hive.Slave.AzureClient { 33 34 30 35 public class WorkerRole : RoleEntryPoint { 31 36 private Core core; … … 36 41 37 42 public override void Run() { 38 core = new Core(false); 43 try { 44 LogError(new Exception("Starting Run()...")); 45 core = new Core(false); 39 46 40 string hiveServerAddress = RoleEnvironment.GetConfigurationSettingValue(HiveServerAddressSetting);41 string hiveServerCertificate = RoleEnvironment.GetConfigurationSettingValue(HiveServerCertificateSetting);47 string hiveServerAddress = RoleEnvironment.GetConfigurationSettingValue(HiveServerAddressSetting); 48 string hiveServerCertificate = RoleEnvironment.GetConfigurationSettingValue(HiveServerCertificateSetting); 42 49 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 } 46 62 } 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; 53 66 } 54 67 } 55 68 56 69 public override bool OnStart() { 57 ServicePointManager.DefaultConnectionLimit = 12;58 //core = new Core();59 70 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 } 65 81 } 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")); 66 91 } 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; 71 95 } 96 return base.OnStart(); 97 } 72 98 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()); 76 110 } 77 111 -
branches/OaaS/HeuristicLab.Clients.Hive.Slave/3.3/Manager/PluginManager.cs
r9363 r9365 61 61 if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginCacheDir)) { 62 62 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 } 64 69 } 65 70 66 71 if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginTempBaseDir)) { 67 72 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 } 69 79 } 70 80 } -
branches/OaaS/HeuristicLab.Services.Hive/3.3/HiveDao.cs
r9363 r9365 239 239 public DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) { 240 240 return ExecuteWithContext<DT.Task>((db) => { 241 db.DeferredLoadingEnabled = false;242 241 var task = db.Tasks.SingleOrDefault(x => x.TaskId == taskId); 243 242 task.State = taskState; -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs
r9362 r9365 294 294 Model.Run taskRun = new Model.Run(); 295 295 taskRun.Id = taskRun.Name = run.Name; 296 taskRun.AlgorithmName = run.Algorithm .Name;296 taskRun.AlgorithmName = run.Algorithm != null ? run.Algorithm.Name : run.Name; 297 297 IList<Parameter> resultValues = new List<Model.Parameter>(); 298 298 foreach (var key in run.Results.Keys) { -
branches/OaaS/HeuristicLab.Services.Optimization.Web/HeuristicLab.Services.Optimization.Web.csproj
r9335 r9365 319 319 <Content Include="Views\Home\Index.cshtml" /> 320 320 <Content Include="Views\Optimization\AlgorithmParameters.cshtml" /> 321 <Content Include="Views\Optimization\Copy of JobDetails.cshtml" />322 321 <Content Include="Views\Optimization\Index.cshtml"> 323 322 <SubType>Code</SubType>
Note: See TracChangeset
for help on using the changeset viewer.