- Timestamp:
- 11/28/12 09:57:35 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 24 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/SlaveShutdown (added) merged: 8944-8945,8949,8951,8953-8954
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj
r8645 r8957 104 104 <ItemGroup> 105 105 <Compile Include="HiveRoles.cs" /> 106 <Compile Include="Views\AppointmentTypeDialog.cs"> 107 <SubType>Form</SubType> 108 </Compile> 109 <Compile Include="Views\AppointmentTypeDialog.Designer.cs"> 110 <DependentUpon>AppointmentTypeDialog.cs</DependentUpon> 111 </Compile> 112 <Compile Include="Views\AppointmentTypeView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="Views\AppointmentTypeView.Designer.cs"> 116 <DependentUpon>AppointmentTypeView.cs</DependentUpon> 117 </Compile> 106 118 <Compile Include="Views\HiveAdministratorView.cs"> 107 119 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/RecurrentEvent.cs
r7259 r8957 27 27 public DateTime DateFrom { get; set; } 28 28 public DateTime DateTo { get; set; } 29 public bool AllDay { get; set; } 29 public bool AllDay { get; set; } 30 30 public HashSet<DayOfWeek> WeekDays { get; set; } 31 public DowntimeType AppointmentType { get; set; } 31 32 } 32 33 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.Designer.cs
r8924 r8957 63 63 this.cbTuesday = new System.Windows.Forms.CheckBox(); 64 64 this.cbMonday = new System.Windows.Forms.CheckBox(); 65 this.appointmentTypeView = new HeuristicLab.Clients.Hive.Administrator.Views.AppointmentTypeView(); 66 this.gbDowntimeType = new System.Windows.Forms.GroupBox(); 65 67 this.gbAppointment.SuspendLayout(); 66 68 this.gbWeekly.SuspendLayout(); 69 this.gbDowntimeType.SuspendLayout(); 67 70 this.SuspendLayout(); 68 71 // … … 149 152 // btSaveRecurrence 150 153 // 151 this.btSaveRecurrence.Location = new System.Drawing.Point(2, 2 17);154 this.btSaveRecurrence.Location = new System.Drawing.Point(2, 298); 152 155 this.btSaveRecurrence.Name = "btSaveRecurrence"; 153 156 this.btSaveRecurrence.Size = new System.Drawing.Size(147, 23); … … 159 162 // btCancelRecurrence 160 163 // 161 this.btCancelRecurrence.Location = new System.Drawing.Point(241, 2 17);164 this.btCancelRecurrence.Location = new System.Drawing.Point(241, 298); 162 165 this.btCancelRecurrence.Name = "btCancelRecurrence"; 163 166 this.btCancelRecurrence.Size = new System.Drawing.Size(147, 23); … … 253 256 this.cbMonday.UseVisualStyleBackColor = true; 254 257 // 258 // appointmentTypeView 259 // 260 this.appointmentTypeView.AppointmentType = HeuristicLab.Clients.Hive.DowntimeType.Offline; 261 this.appointmentTypeView.Location = new System.Drawing.Point(10, 19); 262 this.appointmentTypeView.Name = "appointmentTypeView"; 263 this.appointmentTypeView.Size = new System.Drawing.Size(120, 50); 264 this.appointmentTypeView.TabIndex = 45; 265 // 266 // gbDowntimeType 267 // 268 this.gbDowntimeType.Controls.Add(this.appointmentTypeView); 269 this.gbDowntimeType.Location = new System.Drawing.Point(2, 217); 270 this.gbDowntimeType.Name = "gbDowntimeType"; 271 this.gbDowntimeType.Size = new System.Drawing.Size(386, 75); 272 this.gbDowntimeType.TabIndex = 46; 273 this.gbDowntimeType.TabStop = false; 274 this.gbDowntimeType.Text = "Type of Downtime"; 275 // 255 276 // Recurrence 256 277 // 257 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);258 278 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 259 this.ClientSize = new System.Drawing.Size(393, 243); 279 this.ClientSize = new System.Drawing.Size(393, 332); 280 this.Controls.Add(this.gbDowntimeType); 260 281 this.Controls.Add(this.gbWeekly); 261 282 this.Controls.Add(this.btCancelRecurrence); … … 263 284 this.Controls.Add(this.gbAppointment); 264 285 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 265 this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon;266 286 this.Name = "Recurrence"; 287 this.ShowIcon = false; 288 this.ShowInTaskbar = false; 267 289 this.Text = "Recurrence"; 290 this.TopMost = true; 268 291 this.gbAppointment.ResumeLayout(false); 269 292 this.gbAppointment.PerformLayout(); 270 293 this.gbWeekly.ResumeLayout(false); 271 294 this.gbWeekly.PerformLayout(); 295 this.gbDowntimeType.ResumeLayout(false); 272 296 this.ResumeLayout(false); 273 297 … … 294 318 private System.Windows.Forms.CheckBox cbTuesday; 295 319 private System.Windows.Forms.CheckBox cbMonday; 320 private AppointmentTypeView appointmentTypeView; 321 private System.Windows.Forms.GroupBox gbDowntimeType; 296 322 } 297 323 } -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.cs
r7259 r8957 53 53 DateTo = dateTo, 54 54 AllDay = chbade.Checked, 55 WeekDays = days 55 WeekDays = days, 56 AppointmentType = appointmentTypeView.AppointmentType 56 57 }; 57 58 -
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r8075 r8957 91 91 } 92 92 93 private bool CreateAppointment( ) {93 private bool CreateAppointment(DowntimeType dtType) { 94 94 DateTime from, to; 95 95 … … 98 98 //whole day appointment, only dates are visible 99 99 if (DateTime.TryParse(dtpFrom.Text, out from) && DateTime.TryParse(dtpTo.Text, out to) && from <= to) 100 offlineTimes.Add(CreateAppointment(from, to.AddDays(1), true ));100 offlineTimes.Add(CreateAppointment(from, to.AddDays(1), true, dtType)); 101 101 else 102 102 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); … … 105 105 if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to) { 106 106 if (from.Date == to.Date) 107 offlineTimes.Add(CreateAppointment(from, to, false ));107 offlineTimes.Add(CreateAppointment(from, to, false, dtType)); 108 108 else { 109 109 //more than 1 day selected 110 110 while (from.Date != to.Date) { 111 offlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false ));111 offlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType)); 112 112 from = from.AddDays(1); 113 113 } 114 offlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false ));114 offlineTimes.Add(CreateAppointment(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType)); 115 115 } 116 116 } else … … 125 125 } 126 126 127 private HiveAppointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay ) {127 private HiveAppointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay, DowntimeType downtimeType) { 128 128 HiveAppointment app = new HiveAppointment(); 129 129 app.StartDate = startDate; … … 132 132 app.BorderColor = Color.Red; 133 133 app.Locked = true; 134 app.Subject = "Offline";134 app.Subject = downtimeType.ToString(); 135 135 app.Recurring = false; 136 136 return app; 137 137 } 138 138 139 private HiveAppointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay, bool recurring, Guid recurringId ) {139 private HiveAppointment CreateAppointment(DateTime startDate, DateTime endDate, bool allDay, bool recurring, Guid recurringId, DowntimeType downtimeType) { 140 140 HiveAppointment app = new HiveAppointment(); 141 141 app.StartDate = startDate; … … 144 144 app.BorderColor = Color.Red; 145 145 app.Locked = true; 146 app.Subject = "Offline";146 app.Subject = downtimeType.ToString(); 147 147 app.Recurring = recurring; 148 148 app.RecurringId = recurringId; … … 164 164 recurringAppointments.ForEach(appointment => appointment.StartDate = new DateTime(appointment.StartDate.Year, appointment.StartDate.Month, appointment.StartDate.Day, hourfrom, 0, 0)); 165 165 recurringAppointments.ForEach(appointment => appointment.EndDate = new DateTime(appointment.EndDate.Year, appointment.EndDate.Month, appointment.EndDate.Day, hourTo, 0, 0)); 166 167 DeleteRecurringAppointment(recurringId);168 offlineTimes.AddRange(recurringAppointments);169 166 } 170 167 171 168 public void DialogClosed(RecurrentEvent e) { 172 CreateDailyRecurrenceAppointments(e.DateFrom, e.DateTo, e.AllDay, e.WeekDays );173 } 174 175 private void CreateDailyRecurrenceAppointments(DateTime dateFrom, DateTime dateTo, bool allDay, HashSet<DayOfWeek> daysOfWeek ) {169 CreateDailyRecurrenceAppointments(e.DateFrom, e.DateTo, e.AllDay, e.WeekDays, e.AppointmentType); 170 } 171 172 private void CreateDailyRecurrenceAppointments(DateTime dateFrom, DateTime dateTo, bool allDay, HashSet<DayOfWeek> daysOfWeek, DowntimeType appointmentType) { 176 173 DateTime incDate = dateFrom; 177 174 Guid guid = Guid.NewGuid(); … … 179 176 while (incDate.Date <= dateTo.Date) { 180 177 if (daysOfWeek.Contains(incDate.Date.DayOfWeek)) 181 offlineTimes.Add(CreateAppointment(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid ));178 offlineTimes.Add(CreateAppointment(incDate, new DateTime(incDate.Year, incDate.Month, incDate.Day, dateTo.Hour, dateTo.Minute, 0), allDay, true, guid, appointmentType)); 182 179 incDate = incDate.AddDays(1); 183 180 } … … 284 281 private void btCreate_Click(object sender, EventArgs e) { 285 282 if (dvOnline.Selection != SelectionType.Appointment) { 286 CreateAppointment(); 283 DowntimeType dtType; 284 DialogResult result; 285 AppointmentTypeDialog dialog = new AppointmentTypeDialog(); 286 result = dialog.ShowDialog(this); 287 dtType = dialog.AppointmentType; 288 dialog.Dispose(); 289 if (result == DialogResult.Cancel) return; 290 CreateAppointment(dtType); 287 291 } else { 288 292 //now we want to change an existing appointment 289 293 if (!dvOnline.SelectedAppointment.Recurring) { 290 if (CreateAppointment( ))294 if (CreateAppointment(GetDowntimeTypeOfSelectedAppointment())) 291 295 DeleteAppointment(); 292 296 } else { … … 295 299 DialogResult res = MessageBox.Show("Change all events in this series?", "Change recurrences", MessageBoxButtons.YesNo, MessageBoxIcon.Question); 296 300 if (res != DialogResult.Yes) { 297 if (CreateAppointment( ))301 if (CreateAppointment(GetDowntimeTypeOfSelectedAppointment())) 298 302 DeleteAppointment(); 299 303 } else … … 339 343 BorderColor = Color.Red, 340 344 Locked = true, 341 Subject = "Offline",345 Subject = downtime.DowntimeType.ToString(), 342 346 Changed = downtime.Modified, 343 347 Id = downtime.Id … … 354 358 RecurringId = app.RecurringId, 355 359 ResourceId = HiveAdminClient.Instance.DowntimeForResourceId, 356 Id = app.Id 360 Id = app.Id, 361 DowntimeType = (DowntimeType)Enum.Parse(typeof(DowntimeType), app.Subject) 357 362 }; 358 363 return downtime; 359 364 } 365 366 private DowntimeType GetDowntimeTypeOfSelectedAppointment() { 367 return (DowntimeType)Enum.Parse(typeof(DowntimeType), ((HiveAppointment)dvOnline.SelectedAppointment).Subject); 368 } 360 369 } 361 370 } -
trunk/sources/HeuristicLab.Clients.Hive.Slave.ConsoleClient/3.3/app.config
r7777 r8957 126 126 <value>2</value> 127 127 </setting> 128 <setting name="ShutdownCommand" serializeAs="String"> 129 <value>shutdown.exe</value> 130 </setting> 128 131 </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings> 129 132 </userSettings> -
trunk/sources/HeuristicLab.Clients.Hive.Slave.Views/3.3/HeuristicLab.Clients.Hive.Slave.Views-3.3.csproj
r8600 r8957 291 291 </PropertyGroup> 292 292 <PropertyGroup> 293 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)293 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 294 294 set ProjectDir=$(ProjectDir) 295 295 set SolutionDir=$(SolutionDir) … … 297 297 298 298 call PreBuildEvent.cmd</PreBuildEvent> 299 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">299 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 300 300 export ProjectDir=$(ProjectDir) 301 301 export SolutionDir=$(SolutionDir) -
trunk/sources/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/app.config
r7777 r8957 119 119 <value>-1</value> 120 120 </setting> 121 <setting name="ShutdownCommand" serializeAs="String"> 122 <value>shutdown.exe</value> 123 </setting> 121 124 </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings> 122 125 </userSettings> -
trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs
r7259 r8957 25 25 using System.Threading; 26 26 using System.Threading.Tasks; 27 using HeuristicLab.Clients.Hive.SlaveCore.Properties;28 using HeuristicLab.Clients.Hive.SlaveCore.ServiceContracts;29 27 using HeuristicLab.Common; 30 28 using HeuristicLab.Core; … … 54 52 55 53 public Core() { 56 var log = new ThreadSafeLog(S ettings.Default.MaxLogCount);54 var log = new ThreadSafeLog(SlaveCore.Properties.Settings.Default.MaxLogCount); 57 55 this.pluginManager = new PluginManager(WcfService.Instance, log); 58 56 this.taskManager = new TaskManager(pluginManager, log); … … 76 74 slaveComm = new ServiceHost(typeof(SlaveCommunicationService)); 77 75 slaveComm.Open(); 78 76 79 77 // delete all left over task directories 80 78 pluginManager.CleanPluginTemp(); … … 96 94 } 97 95 ShutdownCore(); 98 } finally { 96 } 97 finally { 99 98 DeregisterServiceEvents(); 100 99 waitShutdownSem.Release(); … … 185 184 HeartbeatManager.Interval = TimeSpan.FromSeconds(interval); 186 185 } 186 break; 187 case MessageContainer.MessageType.ShutdownComputer: 188 ShutdownComputer(); 187 189 break; 188 190 } … … 450 452 } 451 453 454 private void ShutdownComputer() { 455 var t = TS.Task.Factory.StartNew(new Action(Shutdown)); 456 t.ContinueWith(c => { 457 try { 458 Process.Start(SlaveCore.Properties.Settings.Default.ShutdownCommand); 459 } 460 catch (Exception ex) { 461 if (ServiceEventLog != null) { 462 EventLogManager.LogException(ex); 463 } else 464 throw ex; 465 } 466 }); 467 } 468 452 469 /// <summary> 453 470 /// complete shutdown, should be called before the the application is exited -
trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.Designer.cs
r7777 r8957 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319.5 304 // Runtime Version:4.0.30319.586 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 311 311 } 312 312 } 313 314 [global::System.Configuration.UserScopedSettingAttribute()] 315 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 316 [global::System.Configuration.DefaultSettingValueAttribute("shutdown.exe")] 317 public string ShutdownCommand { 318 get { 319 return ((string)(this["ShutdownCommand"])); 320 } 321 set { 322 this["ShutdownCommand"] = value; 323 } 324 } 313 325 } 314 326 } -
trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/Properties/Settings.settings
r7777 r8957 75 75 <Value Profile="(Default)">-1</Value> 76 76 </Setting> 77 <Setting Name="ShutdownCommand" Type="System.String" Scope="User"> 78 <Value Profile="(Default)">shutdown.exe</Value> 79 </Setting> 77 80 </Settings> 78 81 </SettingsFile> -
trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/app.config
r7777 r8957 122 122 <value>-1</value> 123 123 </setting> 124 <setting name="ShutdownCommand" serializeAs="String"> 125 <value>shutdown.exe</value> 126 </setting> 124 127 </HeuristicLab.Clients.Hive.SlaveCore.Properties.Settings> 125 128 </userSettings> -
trunk/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/Downtime.cs
r7259 r8957 40 40 this.ResourceId = original.ResourceId; 41 41 this.StartDate = original.StartDate; 42 this.DowntimeType = original.DowntimeType; 42 43 } 43 44 -
trunk/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs
r8071 r8957 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 173794 // Runtime Version:4.0.30319.586 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 629 629 630 630 [System.Runtime.Serialization.OptionalFieldAttribute()] 631 private HeuristicLab.Clients.Hive.DowntimeType DowntimeTypeField; 632 633 [System.Runtime.Serialization.OptionalFieldAttribute()] 631 634 private System.DateTime EndDateField; 632 635 … … 652 655 this.AllDayEventField = value; 653 656 this.RaisePropertyChanged("AllDayEvent"); 657 } 658 } 659 } 660 661 [System.Runtime.Serialization.DataMemberAttribute()] 662 public HeuristicLab.Clients.Hive.DowntimeType DowntimeType { 663 get { 664 return this.DowntimeTypeField; 665 } 666 set { 667 if ((this.DowntimeTypeField.Equals(value) != true)) { 668 this.DowntimeTypeField = value; 669 this.RaisePropertyChanged("DowntimeType"); 654 670 } 655 671 } … … 1286 1302 1287 1303 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1304 [System.Runtime.Serialization.DataContractAttribute(Name = "DowntimeType", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataAccess")] 1305 public enum DowntimeType : int { 1306 1307 [System.Runtime.Serialization.EnumMemberAttribute()] 1308 Offline = 0, 1309 1310 [System.Runtime.Serialization.EnumMemberAttribute()] 1311 Shutdown = 1, 1312 } 1313 1314 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1288 1315 [System.Runtime.Serialization.DataContractAttribute(Name = "Permission", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")] 1289 1316 public enum Permission : int { … … 1613 1640 [System.Runtime.Serialization.EnumMemberAttribute()] 1614 1641 NewHBInterval = 11, 1642 1643 [System.Runtime.Serialization.EnumMemberAttribute()] 1644 ShutdownComputer = 12, 1615 1645 } 1616 1646 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.Designer.cs
r7249 r8957 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 2394 // Runtime Version:4.0.30319.586 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if -
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj
r8600 r8957 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) -
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml
r7916 r8957 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> -
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r7916 r8957 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 } -
trunk/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
r7916 r8957 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 ) -
trunk/sources/HeuristicLab.Services.Hive/3.3/Convert.cs
r7916 r8957 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 } -
trunk/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Downtime.cs
r7259 r8957 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 } -
trunk/sources/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r7723 r8957 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).Any(r => dao.GetDowntimes(x => x.ResourceId == r.Id && x.DowntimeType == DA.DowntimeType.Shutdown && (DateTime.Now >= x.StartDate) && (DateTime.Now <= x.EndDate)).Count() != 0); 150 157 } 151 158 } -
trunk/sources/HeuristicLab.Services.Hive/3.3/MessageContainer.cs
r7259 r8957 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.