- Timestamp:
- 05/29/13 08:16:09 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Clients.Hive.Slave.AzureClient/3.3/WorkerRole.cs
r9508 r9549 29 29 using Microsoft.WindowsAzure.StorageClient; 30 30 using System.Text; 31 using System.Diagnostics; 31 32 32 33 namespace HeuristicLab.Clients.Hive.Slave.AzureClient { … … 42 43 public override void Run() { 43 44 try { 44 LogError(new Exception("Starting Run()..."));45 Trace.WriteLine("Starting Run()..."); 45 46 core = new HeuristicLab.Clients.Hive.SlaveCore.Core(false); 46 47 … … 60 61 }); 61 62 62 LogError(new Exception("Run(): Core started successfullly"));63 Trace.WriteLine("Run(): Core started successfullly"); 63 64 while (true) { 64 65 Thread.Sleep(10000); … … 66 67 } 67 68 catch (Exception e) { 68 LogError(e);69 throw e;69 Trace.WriteLine(e.ToString()); 70 throw e; 70 71 } 71 72 } … … 75 76 ServicePointManager.DefaultConnectionLimit = 12; 76 77 //core = new Core(); 77 LogError(new Exception("Running OnStart()"));78 Trace.WriteLine("Running OnStart()"); 78 79 try { 79 80 if (!String.IsNullOrEmpty(RoleEnvironment.GetConfigurationSettingValue(Constants.DiagnosticsConnectionString))) { … … 88 89 // -> diagnostics disabled 89 90 // nothing more to do 90 LogError(ex);91 Trace.WriteLine(ex.ToString()); 91 92 } 92 93 93 94 RoleEnvironment.Changed += RoleEnvironmentChanged; 94 LogError(new Exception("Finished OnStart() successfullly"));95 Trace.WriteLine("Finished OnStart() successfullly"); 95 96 } 96 97 catch (Exception ex) { 97 LogError(ex);98 throw ex;98 Trace.WriteLine(ex.ToString()); 99 throw ex; 99 100 } 100 101 return base.OnStart(); 101 }102 103 private void LogError(Exception e) {104 var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(Constants.DiagnosticsConnectionString));105 var blobClient = storageAccount.CreateCloudBlobClient();106 var container = blobClient.GetContainerReference("slavelog");107 container.CreateIfNotExist();108 var guid = Guid.NewGuid();109 var blob = container.GetBlobReference(guid.ToString());110 var builder = new StringBuilder();111 builder.Append("ToString: ").Append(e.ToString()).Append("\n");112 builder.Append("Message: ").Append(e.Message).Append("\n");113 blob.UploadText(builder.ToString());114 102 } 115 103
Note: See TracChangeset
for help on using the changeset viewer.