Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8945


Ignore:
Timestamp:
11/26/12 16:03:01 (11 years ago)
Author:
ascheibe
Message:

#1986 made the necessary changes on the server for shutting down slaves

Location:
branches/SlaveShutdown
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj

    r8600 r8945  
    9999    <None Include="Plugin.cs.frame" />
    100100    <Compile Include="Enums\Command.cs" />
     101    <Compile Include="Enums\DowntimeType.cs" />
    101102    <Compile Include="Enums\CpuArchitecture.cs" />
    102103    <Compile Include="Plugin.cs" />
     
    156157  </PropertyGroup>
    157158  <PropertyGroup>
    158    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     159    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    159160set ProjectDir=$(ProjectDir)
    160161set SolutionDir=$(SolutionDir)
     
    162163
    163164call PreBuildEvent.cmd</PreBuildEvent>
    164 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     165    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    165166export ProjectDir=$(ProjectDir)
    166167export SolutionDir=$(SolutionDir)
  • branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml

    r7916 r8945  
    9595      <Column Name="Recurring" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    9696      <Column Name="RecurringId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
     97      <Column Name="DowntimeType" Storage="_Type" Type="global::HeuristicLab.Services.Hive.DataAccess.DowntimeType" DbType="VarChar(MAX)" CanBeNull="false" />
    9798      <Association Name="Resource_Downtime" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" />
    9899    </Type>
  • branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r7916 r8945  
    33// <auto-generated>
    44//     This code was generated by a tool.
    5 //     Runtime Version:4.0.30319.269
     5//     Runtime Version:4.0.30319.17929
    66//
    77//     Changes to this file may cause incorrect behavior and will be lost if
     
    21532153    private System.Guid _RecurringId;
    21542154   
     2155    private global::HeuristicLab.Services.Hive.DataAccess.DowntimeType _Type;
     2156   
    21552157    private EntityRef<Resource> _Resource;
    21562158   
     
    21732175    partial void OnRecurringIdChanging(System.Guid value);
    21742176    partial void OnRecurringIdChanged();
     2177    partial void OnDowntimeTypeChanging(global::HeuristicLab.Services.Hive.DataAccess.DowntimeType value);
     2178    partial void OnDowntimeTypeChanged();
    21752179    #endregion
    21762180   
     
    23212325          this.SendPropertyChanged("RecurringId");
    23222326          this.OnRecurringIdChanged();
     2327        }
     2328      }
     2329    }
     2330   
     2331    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Type", DbType="VarChar(MAX)", CanBeNull=false)]
     2332    public global::HeuristicLab.Services.Hive.DataAccess.DowntimeType DowntimeType
     2333    {
     2334      get
     2335      {
     2336        return this._Type;
     2337      }
     2338      set
     2339      {
     2340        if ((this._Type != value))
     2341        {
     2342          this.OnDowntimeTypeChanging(value);
     2343          this.SendPropertyChanging();
     2344          this._Type = value;
     2345          this.SendPropertyChanged("DowntimeType");
     2346          this.OnDowntimeTypeChanged();
    23232347        }
    23242348      }
  • branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r7916 r8945  
    7575  [Recurring] Bit NOT NULL,
    7676  [RecurringId] UniqueIdentifier NOT NULL,
     77  [DowntimeType] VarChar(MAX) NOT NULL,
    7778  CONSTRAINT [PK_dbo.Downtime] PRIMARY KEY ([DowntimeId])
    7879  )
  • branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/Convert.cs

    r7916 r8945  
    118118    public static DT.Downtime ToDto(DB.Downtime source) {
    119119      if (source == null) return null;
    120       return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate };
     120      return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate, DowntimeType = source.DowntimeType };
    121121    }
    122122    public static DB.Downtime ToEntity(DT.Downtime source) {
     
    127127    public static void ToEntity(DT.Downtime source, DB.Downtime target) {
    128128      if ((source != null) && (target != null)) {
    129         target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate;
     129        target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; target.DowntimeType = source.DowntimeType;
    130130      }
    131131    }
  • branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/DataTransfer/Downtime.cs

    r7259 r8945  
    2222using System;
    2323using System.Runtime.Serialization;
     24using HeuristicLab.Services.Hive.DataAccess;
    2425
    2526namespace HeuristicLab.Services.Hive.DataTransfer {
     
    3839    [DataMember]
    3940    public Guid ResourceId { get; set; }
     41    [DataMember]
     42    public DowntimeType DowntimeType { get; set; }
    4043  }
    4144}
  • branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r7723 r8945  
    4747        if (heartbeat.HbInterval != slave.HbInterval) {
    4848          actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval));
     49        }
     50        if (ShutdownSlaveComputer(slave.Id)) {
     51          actions.Add(new MessageContainer(MessageContainer.MessageType.ShutdownComputer));
    4952        }
    5053
     
    147150    private bool SlaveIsAllowedToCalculate(Guid slaveId) {
    148151      // the slave may only calculate if there is no downtime right now. this needs to be checked for every parent resource also
    149       return dao.GetParentResources(slaveId).All(r => dao.GetDowntimes(x => x.ResourceId == r.Id && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() == 0);
     152      return dao.GetParentResources(slaveId).All(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Offline && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() == 0);
     153    }
     154
     155    private bool ShutdownSlaveComputer(Guid slaveId) {
     156      return dao.GetParentResources(slaveId).All(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Shutdown && DateTime.Now >= x.StartDate).Count() != 0);
    150157    }
    151158  }
  • branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/MessageContainer.cs

    r7259 r8945  
    4848      ShutdownSlave,  // slave should shutdown immediately without submitting results
    4949      SayHello,  // Slave should say hello, because job is unknown to the server
    50       NewHBInterval,
     50      NewHBInterval, // change the polling to a new interval
     51      ShutdownComputer, // shutdown the computer the slave runs on
    5152    };
    5253
Note: See TracChangeset for help on using the changeset viewer.