Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/11 15:51:11 (13 years ago)
Author:
cneumuel
Message:

#1233

  • changed the workflow of aquireing a new job from server.
    • if a job is available for calculation, the slave receives the jobId already with the heartbeats. The job is then exclusively assigned to this slave.
  • extended the metainfo for a slave by OperatingSystem and CpuArchitecture
  • enhanced the way plugin-dependencies are discovered by using the types used by XmlGenerator. Now only mimimum amount of plugins are transferred.
  • selection of waiting jobs now consideres assigned slave-group
  • more unit tests for service
  • added unit tests for experiment manager
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConfigManager.cs

    r5314 r5404  
    2626using HeuristicLab.Services.Hive.Common.DataTransfer;
    2727using HeuristicLab.Clients.Hive.Slave.Properties;
     28using System.Management;
     29using System.Diagnostics;
    2830
    2931
     
    4446
    4547    public Core Core { get; set; }
    46     private HeuristicLab.Services.Hive.Common.DataTransfer.Slave hardwareInfo;
    47 
     48    private HeuristicLab.Services.Hive.Common.DataTransfer.Slave slave;
     49   
    4850    /// <summary>
    4951    /// Constructor for the singleton, must recover Guid, Calendar, ...
    5052    /// </summary>
    5153    private ConfigManager() {
    52       hardwareInfo = new HeuristicLab.Services.Hive.Common.DataTransfer.Slave();
    53 
    54       if (Settings.Default.Guid == Guid.Empty) {
    55         hardwareInfo.Id = Guid.NewGuid();
    56         Settings.Default.Guid = hardwareInfo.Id;
    57         Settings.Default.Save();
    58       } else
    59         hardwareInfo.Id = Settings.Default.Guid;
    60 
    61       hardwareInfo.Cores = Environment.ProcessorCount;
    62       hardwareInfo.Memory = 1024;
    63       hardwareInfo.Name = Environment.MachineName;
     54      slave = new HeuristicLab.Services.Hive.Common.DataTransfer.Slave();
     55      slave.Id = GetUniqueMachineId();
     56      slave.Name = Environment.MachineName;
     57      slave.Cores = Environment.ProcessorCount;
     58      slave.Memory = GetPhysicalMemory();
     59      slave.CpuArchitecture = Environment.Is64BitOperatingSystem ? CpuArchitecture.x64 : CpuArchitecture.x86;
     60      slave.OperatingSystem = Environment.OSVersion.VersionString;
    6461    }
    6562
     
    7168      //TODO: how to display connectedsince in gui?
    7269      //hardwareInfo.Login = WcfService.Instance.ConnectedSince;
    73       return hardwareInfo;
     70      return slave;
    7471    }
    7572
     
    8178      //Todo: Locking
    8279      StatusCommons st = new StatusCommons();
    83       st.ClientGuid = hardwareInfo.Id;
     80      st.ClientGuid = slave.Id;
    8481
    8582      st.Status = WcfService.Instance.ConnState;
    8683      st.ConnectedSince = WcfService.Instance.ConnectedSince;
    8784
    88       st.TotalCores = hardwareInfo.Cores.HasValue ? hardwareInfo.Cores.Value : 0;
    89       st.FreeCores = hardwareInfo.Cores.HasValue ? hardwareInfo.Cores.Value - GetUsedCores() : 0;
     85      st.TotalCores = slave.Cores.HasValue ? slave.Cores.Value : 0;
     86      st.FreeCores = slave.Cores.HasValue ? slave.Cores.Value - GetUsedCores() : 0;
    9087
    9188      st.JobsAborted = SlaveStatusInfo.JobsAborted;
     
    128125    }
    129126
     127    public static Guid GetUniqueMachineId() {
     128      // todo: instead of creating a new id, generate an ID from hardware IDs which is always the same for one machine
     129      if (Settings.Default.Guid == Guid.Empty) {
     130        Guid id = Guid.NewGuid();
     131        Settings.Default.Guid = id;
     132        Settings.Default.Save();
     133        return id;
     134      } else
     135        return Settings.Default.Guid;
     136    }
     137
     138    public static int GetPhysicalMemory() {
     139      return 1024; // todo
     140    }
     141
     142    public static int GetFreeMemory() {
     143      PerformanceCounter counter = new PerformanceCounter("Memory", "Available Bytes", true);
     144      int mb = (int)(counter.NextValue() / 1024 / 1024);
     145      return mb;
     146    }
    130147  }
    131148}
Note: See TracChangeset for help on using the changeset viewer.