- Timestamp:
- 11/26/12 16:03:01 (12 years ago)
- 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 99 99 <None Include="Plugin.cs.frame" /> 100 100 <Compile Include="Enums\Command.cs" /> 101 <Compile Include="Enums\DowntimeType.cs" /> 101 102 <Compile Include="Enums\CpuArchitecture.cs" /> 102 103 <Compile Include="Plugin.cs" /> … … 156 157 </PropertyGroup> 157 158 <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) 159 160 set ProjectDir=$(ProjectDir) 160 161 set SolutionDir=$(SolutionDir) … … 162 163 163 164 call PreBuildEvent.cmd</PreBuildEvent> 164 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">165 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 165 166 export ProjectDir=$(ProjectDir) 166 167 export SolutionDir=$(SolutionDir) -
branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml
r7916 r8945 95 95 <Column Name="Recurring" Type="System.Boolean" DbType="Bit" CanBeNull="false" /> 96 96 <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" /> 97 98 <Association Name="Resource_Downtime" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" /> 98 99 </Type> -
branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r7916 r8945 3 3 // <auto-generated> 4 4 // This code was generated by a tool. 5 // Runtime Version:4.0.30319. 2695 // Runtime Version:4.0.30319.17929 6 6 // 7 7 // Changes to this file may cause incorrect behavior and will be lost if … … 2153 2153 private System.Guid _RecurringId; 2154 2154 2155 private global::HeuristicLab.Services.Hive.DataAccess.DowntimeType _Type; 2156 2155 2157 private EntityRef<Resource> _Resource; 2156 2158 … … 2173 2175 partial void OnRecurringIdChanging(System.Guid value); 2174 2176 partial void OnRecurringIdChanged(); 2177 partial void OnDowntimeTypeChanging(global::HeuristicLab.Services.Hive.DataAccess.DowntimeType value); 2178 partial void OnDowntimeTypeChanged(); 2175 2179 #endregion 2176 2180 … … 2321 2325 this.SendPropertyChanged("RecurringId"); 2322 2326 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(); 2323 2347 } 2324 2348 } -
branches/SlaveShutdown/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
r7916 r8945 75 75 [Recurring] Bit NOT NULL, 76 76 [RecurringId] UniqueIdentifier NOT NULL, 77 [DowntimeType] VarChar(MAX) NOT NULL, 77 78 CONSTRAINT [PK_dbo.Downtime] PRIMARY KEY ([DowntimeId]) 78 79 ) -
branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/Convert.cs
r7916 r8945 118 118 public static DT.Downtime ToDto(DB.Downtime source) { 119 119 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 }; 121 121 } 122 122 public static DB.Downtime ToEntity(DT.Downtime source) { … … 127 127 public static void ToEntity(DT.Downtime source, DB.Downtime target) { 128 128 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; 130 130 } 131 131 } -
branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/DataTransfer/Downtime.cs
r7259 r8945 22 22 using System; 23 23 using System.Runtime.Serialization; 24 using HeuristicLab.Services.Hive.DataAccess; 24 25 25 26 namespace HeuristicLab.Services.Hive.DataTransfer { … … 38 39 [DataMember] 39 40 public Guid ResourceId { get; set; } 41 [DataMember] 42 public DowntimeType DowntimeType { get; set; } 40 43 } 41 44 } -
branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r7723 r8945 47 47 if (heartbeat.HbInterval != slave.HbInterval) { 48 48 actions.Add(new MessageContainer(MessageContainer.MessageType.NewHBInterval)); 49 } 50 if (ShutdownSlaveComputer(slave.Id)) { 51 actions.Add(new MessageContainer(MessageContainer.MessageType.ShutdownComputer)); 49 52 } 50 53 … … 147 150 private bool SlaveIsAllowedToCalculate(Guid slaveId) { 148 151 // 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); 150 157 } 151 158 } -
branches/SlaveShutdown/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r7259 r8945 48 48 ShutdownSlave, // slave should shutdown immediately without submitting results 49 49 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 51 52 }; 52 53
Note: See TracChangeset
for help on using the changeset viewer.