Changeset 4119 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core
- Timestamp:
- 07/28/10 17:48:10 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Core.cs
r4107 r4119 45 45 using HeuristicLab.Hive.Client.Core.JobStorage; 46 46 using HeuristicLab.Tracing; 47 using HeuristicLab.Core; 47 48 48 49 namespace HeuristicLab.Hive.Client.Core { … … 98 99 if (cc.IPAdress != String.Empty && cc.Port != 0) 99 100 wcfService.SetIPAndPort(cc.IPAdress, cc.Port); 100 101 if (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline())102 wcfService.Connect();103 101 104 102 //Initialize the heartbeat … … 249 247 if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) { 250 248 Logger.Info("Sending the finished job with id: " + jId); 251 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, 252 jId, 253 sJob, 254 1, 255 null, 256 true); 249 wcfService.StoreFinishedJobResultAsync(ConfigManager.Instance.GetClientInfo().Id, jId, sJob, 1.0, null, true); 257 250 } else { 258 251 Logger.Info("Storing the finished job with id: " + jId + " to hdd"); … … 465 458 466 459 foreach (KeyValuePair<Guid, Executor> execKVP in engines) { 467 if ( !execKVP.Value.Running&& execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) {460 if (execKVP.Value.ExecutionState != ExecutionState.Started && execKVP.Value.CurrentMessage == MessageContainer.MessageType.NoMessage) { 468 461 Logger.Info("Checking for JobId: " + execKVP.Value.JobId); 469 462 Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob)); … … 513 506 } 514 507 515 508 516 509 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Heartbeat.cs
r4060 r4119 43 43 private bool offline; 44 44 45 public double Interval { get; set; } 45 public double Interval { get; set; } 46 46 private Timer heartbeatTimer = null; 47 47 48 private static object locker = new object(); 49 48 50 public Heartbeat() { 49 51 Interval = 100; … … 51 53 52 54 public Heartbeat(double interval) { 53 Interval = interval; 55 Interval = interval; 54 56 } 55 57 … … 74 76 /// <param name="sender"></param> 75 77 /// <param name="e"></param> 76 void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) { 77 ClientDto info = ConfigManager.Instance.GetClientInfo(); 78 void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) { 79 lock (locker) { 80 // check if cwfService is disconnected for any reason (should happen at first heartbeat) 81 // [chn] TODO: Client should always send heartbeats. when calendar disallows he should tell the server he does not want to compute anything 82 if (wcfService.ConnState == NetworkEnum.WcfConnState.Disconnected && 83 (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline())) { 84 wcfService.Connect(); 85 } 78 86 79 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 80 int mb = (int)(counter.NextValue() / 1024 / 1024); 87 ClientDto info = ConfigManager.Instance.GetClientInfo(); 81 88 82 HeartBeatData heartBeatData = new HeartBeatData { 83 ClientId = info.Id, 84 FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(), 85 FreeMemory = mb, 86 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 87 }; 88 89 DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00"); 90 TimeSpan span = DateTime.Now - lastFullHour; 91 if (span.TotalSeconds < (Interval/1000)) { 92 if (UptimeManager.Instance.IsOnline() && UptimeManager.Instance.CalendarAvailable) { 93 //That's quiet simple: Just reconnect and you're good for new jobs 94 if (wcfService.ConnState != NetworkEnum.WcfConnState.Loggedin) { 95 Logger.Info("Client goes online according to timetable"); 96 wcfService.Connect(); 89 PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true); 90 int mb = (int)(counter.NextValue() / 1024 / 1024); 91 92 HeartBeatData heartBeatData = new HeartBeatData { 93 ClientId = info.Id, 94 FreeCores = info.NrOfCores - ConfigManager.Instance.GetUsedCores(), 95 FreeMemory = mb, 96 JobProgress = ConfigManager.Instance.GetProgressOfAllJobs() 97 }; 98 99 DateTime lastFullHour = DateTime.Parse(DateTime.Now.Hour.ToString() + ":00"); 100 TimeSpan span = DateTime.Now - lastFullHour; 101 if (span.TotalSeconds < (Interval / 1000)) { 102 if (UptimeManager.Instance.IsOnline() && UptimeManager.Instance.CalendarAvailable) { 103 //That's quiet simple: Just reconnect and you're good for new jobs 104 if (wcfService.ConnState != NetworkEnum.WcfConnState.Loggedin) { 105 Logger.Info("Client goes online according to timetable"); 106 wcfService.Connect(); 107 } 108 } else { 109 //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong 110 MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect); 97 111 } 98 } else { 99 //We have quit a lot of work to do here: snapshot all jobs, submit them back, then disconnect and then pray to god that nothing goes wrong 100 MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.UptimeLimitDisconnect); 101 } 102 } 103 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 104 wcfService.Connect(); 105 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) { 106 Logger.Debug("Sending Heartbeat: " + heartBeatData); 107 wcfService.ProcessHeartBeatAsync(heartBeatData); 112 } 113 if (wcfService.ConnState == NetworkEnum.WcfConnState.Failed) { 114 wcfService.Connect(); 115 } else if (wcfService.ConnState == NetworkEnum.WcfConnState.Loggedin) { 116 Logger.Debug("Sending Heartbeat: " + heartBeatData); 117 wcfService.ProcessHeartBeatAsync(heartBeatData); 118 } 108 119 } 109 120 } … … 111 122 void wcfService_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) { 112 123 Logger.Debug("Heartbeat received"); 113 e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 124 e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc)); 114 125 } 115 126 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/HeuristicLab.Hive.Client.Core-3.3.csproj
r4107 r4119 76 76 </PropertyGroup> 77 77 <ItemGroup> 78 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 78 79 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 79 80 <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/PluginCache.cs
r4060 r4119 42 42 //we MAY run in problems here - if there is a plugin twice in requests, there may be added two different versions of the plugin 43 43 foreach (CachedHivePluginInfoDto cache in pluginCache) { 44 if (info.Name.Equals(cache.Name) && info.Version.Equals(cache.Version) && info.BuildDate <= cache.BuildDate) {44 if (info.Name.Equals(cache.Name) && info.Version.Equals(cache.Version)) { 45 45 Logger.Debug("Found plugin " + info.Name + ", " + info.Version); 46 46 neededPlugins.Add(cache); -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Properties/AssemblyInfo.cs
r4116 r4119 57 57 // by using the '*' as shown below: 58 58 // [assembly: AssemblyVersion("1.0.*")] 59 [assembly: AssemblyVersion("3.3.0.411 1")]60 [assembly: AssemblyFileVersion("3.3.0.411 1")]61 [assembly: AssemblyBuildDate("2010/07/2 7 18:31:47")]59 [assembly: AssemblyVersion("3.3.0.4116")] 60 [assembly: AssemblyFileVersion("3.3.0.4116")] 61 [assembly: AssemblyBuildDate("2010/07/28 17:42:03")]
Note: See TracChangeset
for help on using the changeset viewer.