Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/12 09:57:35 (12 years ago)
Author:
ascheibe
Message:

#1986 merged SlaveShutdown branch back into trunk

Location:
trunk/sources
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Services.Hive/3.3/Convert.cs

    r7916 r8957  
    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    }
  • trunk/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Downtime.cs

    r7259 r8957  
    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}
  • trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r7723 r8957  
    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).Any(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Shutdown && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() != 0);
    150157    }
    151158  }
  • trunk/sources/HeuristicLab.Services.Hive/3.3/MessageContainer.cs

    r7259 r8957  
    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.