Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/28/10 17:48:10 (14 years ago)
Author:
cneumuel
Message:

HiveExperiment is now able to send IOptimizers of an Experiment and receive the calculated result (#1115)

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  
    4545using HeuristicLab.Hive.Client.Core.JobStorage;
    4646using HeuristicLab.Tracing;
     47using HeuristicLab.Core;
    4748
    4849namespace HeuristicLab.Hive.Client.Core {
     
    9899      if (cc.IPAdress != String.Empty && cc.Port != 0)
    99100        wcfService.SetIPAndPort(cc.IPAdress, cc.Port);
    100 
    101       if (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline())
    102         wcfService.Connect();
    103101
    104102      //Initialize the heartbeat
     
    249247        if (WcfService.Instance.ConnState == NetworkEnum.WcfConnState.Loggedin) {
    250248          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);
    257250        } else {
    258251          Logger.Info("Storing the finished job with id: " + jId + " to hdd");
     
    465458
    466459      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) {
    468461          Logger.Info("Checking for JobId: " + execKVP.Value.JobId);
    469462          Thread finThread = new Thread(new ParameterizedThreadStart(GetFinishedJob));
     
    513506  }
    514507
    515  
     508
    516509}
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Heartbeat.cs

    r4060 r4119  
    4343    private bool offline;
    4444
    45     public double Interval { get; set; }   
     45    public double Interval { get; set; }
    4646    private Timer heartbeatTimer = null;
    47        
     47
     48    private static object locker = new object();
     49
    4850    public Heartbeat() {
    4951      Interval = 100;
     
    5153
    5254    public Heartbeat(double interval) {
    53       Interval = interval;     
     55      Interval = interval;
    5456    }
    5557
     
    7476    /// <param name="sender"></param>
    7577    /// <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        }
    7886
    79       PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true);
    80       int mb = (int)(counter.NextValue() / 1024 / 1024);
     87        ClientDto info = ConfigManager.Instance.GetClientInfo();
    8188
    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);
    97111          }
    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        }
    108119      }
    109120    }
     
    111122    void wcfService_ProcessHeartBeatCompleted(object sender, ProcessHeartBeatCompletedEventArgs e) {
    112123      Logger.Debug("Heartbeat received");
    113       e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc));     
     124      e.Result.ActionRequest.ForEach(mc => MessageQueue.GetInstance().AddMessage(mc));
    114125    }
    115126
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/HeuristicLab.Hive.Client.Core-3.3.csproj

    r4107 r4119  
    7676  </PropertyGroup>
    7777  <ItemGroup>
     78    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    7879    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    7980      <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  
    4242        //we MAY run in problems here - if there is a plugin twice in requests, there may be added two different versions of the plugin
    4343        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)) {
    4545            Logger.Debug("Found plugin " + info.Name + ", " + info.Version);
    4646            neededPlugins.Add(cache);
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Properties/AssemblyInfo.cs

    r4116 r4119  
    5757// by using the '*' as shown below:
    5858// [assembly: AssemblyVersion("1.0.*")]
    59 [assembly: AssemblyVersion("3.3.0.4111")]
    60 [assembly: AssemblyFileVersion("3.3.0.4111")]
    61 [assembly: AssemblyBuildDate("2010/07/27 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.