Changeset 4269
- Timestamp:
- 08/20/10 09:54:05 (14 years ago)
- Location:
- branches/3.3-HiveMigration
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3/JobDataFetcher.cs
r4264 r4269 79 79 80 80 private void DoUpdateRun() { 81 // [chn] Exception occured here: PollStates enumeration changed!82 // todo: make access to PollStates thread-safe!83 // * added lock on locker -> didn't help84 // * made public property PollStates an IEnumerable to be immutable -> didn't help85 // * using for loop86 87 81 JobState[] pollStatesCopy = PollStates.ToArray(); 88 82 for (int i = 0; i < pollStatesCopy.Length; i++) { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/Core.cs
r4267 r4269 60 60 61 61 private WcfService wcfService; 62 private Heartbeat beat;62 private HeartbeatManager beat; 63 63 64 64 /// <summary> … … 90 90 91 91 //Initialize the heartbeat 92 beat = new Heartbeat { Interval = new TimeSpan(0, 0, 10) };92 beat = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) }; 93 93 beat.StartHeartbeat(); 94 94 … … 197 197 kvp.Value.RequestSnapshot(); 198 198 } 199 200 199 } 201 200 } … … 293 292 bool sandboxed = false; 294 293 Logger.Debug("Fetching plugins for job " + e.Result.Obj.Id); 295 296 PluginCache.Instance.PreparePlugins(e.Result.Obj.PluginsNeeded);297 298 PluginCache.Instance.CopyPluginsForJob(e.Result.Obj.PluginsNeeded, e.Result.Obj.Id);299 300 // foreach (CachedHivePluginInfoDto plugininfo in PluginCache.Instance.GetPlugins(e.Result.Job.PluginsNeeded))301 // files.AddRange(plugininfo.PluginFiles);302 Logger.Debug("Plugins fetched for job " + e.Result.Obj.Id);303 294 try { 304 String pluginDir = Path.Combine(PluginCache.PLUGIN_REPO, e.Result.Obj.Id.ToString()); 295 296 PluginCache.Instance.PreparePlugins(e.Result.Obj.PluginsNeeded); 297 PluginCache.Instance.CopyPluginsForJob(e.Result.Obj.PluginsNeeded, e.Result.Obj.Id); 298 299 // foreach (CachedHivePluginInfoDto plugininfo in PluginCache.Instance.GetPlugins(e.Result.Job.PluginsNeeded)) 300 // files.AddRange(plugininfo.PluginFiles); 301 Logger.Debug("Plugins fetched for job " + e.Result.Obj.Id); 302 String pluginDir = Path.Combine(PluginCache.Instance.PluginRepositoryDir, e.Result.Obj.Id.ToString()); 305 303 306 304 AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(pluginDir, null); … … 323 321 } 324 322 } 323 beat.InterruptHeartBeatThread(); 325 324 } 326 325 catch (Exception exception) { … … 348 347 SlaveStatusInfo.JobsProcessed++; 349 348 Logger.Info("Increased ProcessedJobs to:" + SlaveStatusInfo.JobsProcessed); 349 beat.InterruptHeartBeatThread(); 350 350 } else { 351 351 Logger.Error("Sending of job " + e.Result.JobId + " failed, job has been wasted. Message: " + e.Result.StatusMessage); … … 395 395 //a result within the next few heartbeats 396 396 //if (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline()) { 397 398 399 400 401 397 Logger.Info("CalendarAvailable is " + UptimeManager.Instance.CalendarAvailable + " and IsOnline is: " + UptimeManager.Instance.IsAllowedToCalculate()); 398 Logger.Info("Setting client online"); 399 wcfService.LoginSync(ConfigManager.Instance.GetClientInfo()); 400 JobStorageManager.CheckAndSubmitJobsFromDisc(); 401 CurrentlyFetching = false; 402 402 //} 403 403 } … … 417 417 wcfService.SetCalendarStatus(ConfigManager.Instance.GetClientInfo().Id, CalendarState.NotAllowedToFetch); 418 418 } 419 beat.InterruptHeartBeatThread(); 419 420 } 420 421 -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/PluginCache.cs
r4254 r4269 9 9 using HeuristicLab.PluginInfrastructure.Manager; 10 10 using HeuristicLab.Tracing; 11 using System.Reflection; 11 12 12 13 namespace HeuristicLab.Hive.Slave.Core { … … 15 16 private static PluginCache instance = null; 16 17 17 public const string PLUGIN_REPO = @"plugins\";18 public string PluginRepositoryDir { get; set; } 18 19 19 20 private List<PluginDescription> cachedPlugins = new List<PluginDescription>(); 20 21 21 private PluginManager pm = new PluginManager(PLUGIN_REPO);22 private PluginManager pm; 22 23 23 24 public static PluginCache Instance { … … 28 29 } 29 30 } 31 30 32 public PluginCache() { 33 PluginRepositoryDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins"); 34 35 this.pm = new PluginManager(PluginRepositoryDir); 31 36 DoUpdateRun(); 32 37 } 33 38 34 39 private void DoUpdateRun() { 40 if (!Directory.Exists(PluginRepositoryDir)) { 41 Directory.CreateDirectory(PluginRepositoryDir); 42 } 35 43 pm.DiscoverAndCheckPlugins(); 36 44 cachedPlugins = new List<PluginDescription>(pm.Plugins); 37 45 } 38 46 39 40 47 [MethodImpl(MethodImplOptions.Synchronized)] 41 48 public bool CopyPluginsForJob(List<HivePluginInfoDto> requests, Guid jobId) { 42 43 String targetDir = PLUGIN_REPO + jobId.ToString() + "\\"; 49 String targetDir = Path.Combine(PluginRepositoryDir, jobId.ToString()); 44 50 45 51 if (Directory.Exists(targetDir)) { … … 50 56 51 57 foreach (HivePluginInfoDto requestedPlugin in requests) { 52 PluginDescription pd = 53 cachedPlugins.Where( 54 cp => 55 cp.Name == requestedPlugin.Name && 56 cp.Version.Major == requestedPlugin.Version.Major && 57 cp.Version.Minor == requestedPlugin.Version.Minor && 58 cp.Version.Revision >= requestedPlugin.Version.Revision). 59 SingleOrDefault(); 58 PluginDescription pd = cachedPlugins.Where(cp => 59 cp.Name == requestedPlugin.Name && 60 cp.Version.Major == requestedPlugin.Version.Major && 61 cp.Version.Minor == requestedPlugin.Version.Minor && 62 cp.Version.Revision >= requestedPlugin.Version.Revision). 63 SingleOrDefault(); 60 64 if (pd == null) { 61 65 return false; … … 63 67 64 68 foreach (IPluginFile ipf in pd.Files) { 65 File.Copy(ipf.Name, targetDir + ipf.Name.Split('\\').Last()); 69 string x = targetDir + ipf.Name.Split('\\').Last(); 70 string y = Path.Combine(targetDir, Path.GetFileName(ipf.Name)); 71 72 //File.Copy(ipf.Name, targetDir + ipf.Name.Split('\\').Last()); 73 File.Copy(ipf.Name, Path.Combine(targetDir, Path.GetFileName(ipf.Name))); 66 74 } 67 75 } … … 113 121 Logger.Debug("creating new files"); 114 122 foreach (HivePluginFile pf in updateablePlugin.PluginFiles) { 115 File.WriteAllBytes(PLUGIN_REPO + pf.Name.Split('\\').Last(), pf.BinaryFile); 123 string x = PluginRepositoryDir + pf.Name.Split('\\').Last(); 124 string y = Path.Combine(PluginRepositoryDir, Path.GetFileName(pf.Name)); 125 File.WriteAllBytes(Path.Combine(PluginRepositoryDir, Path.GetFileName(pf.Name)), pf.BinaryFile); 116 126 } 117 127 … … 124 134 try { 125 135 Logger.Debug("unloading..."); 126 Directory.Delete(Path.Combine(PLUGIN_REPO, id.ToString()), true); 127 } catch (Exception ex) { 136 Directory.Delete(Path.Combine(PluginRepositoryDir, id.ToString()), true); 137 } 138 catch (Exception ex) { 128 139 Logger.Debug("failed while unloading " + id + " with exception " + ex); 129 140 } -
branches/3.3-HiveMigration/tools/cleanHiveDatabase.sql
r4159 r4269 4 4 DELETE FROM [HeuristicLab.Hive].[dbo].UptimeStatistics 5 5 DELETE FROM [HeuristicLab.Hive].[dbo].UptimeCalendar 6 DELETE FROM [HeuristicLab.Hive].[dbo]. ClientConfig7 DELETE FROM [HeuristicLab.Hive].[dbo]. ClientGroup_Resource6 DELETE FROM [HeuristicLab.Hive].[dbo].SlaveConfig 7 DELETE FROM [HeuristicLab.Hive].[dbo].SlaveGroup_Resource 8 8 DELETE FROM [HeuristicLab.Hive].[dbo].[Resource] 9 9 DELETE FROM [HeuristicLab.Hive].[dbo].Job -
branches/3.3-HiveMigration/tools/prepareHiveDatabase.sql
r4170 r4269 6 6 ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId DROP ROWGUIDCOL; 7 7 ALTER TABLE dbo.Job ALTER COLUMN JobId DROP ROWGUIDCOL; 8 ALTER TABLE dbo. ClientConfig ALTER COLUMN ClientConfigId DROP ROWGUIDCOL;9 ALTER TABLE dbo. ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId DROP ROWGUIDCOL;8 ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId DROP ROWGUIDCOL; 9 ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId DROP ROWGUIDCOL; 10 10 ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId DROP ROWGUIDCOL; 11 11 ALTER TABLE dbo.Project ALTER COLUMN ProjectId DROP ROWGUIDCOL; … … 17 17 ALTER TABLE dbo.AssignedResources DROP CONSTRAINT [DF_AssignedResources_AssignedRessourcesId]; 18 18 ALTER TABLE dbo.Job DROP CONSTRAINT [DF_Job_JobId]; 19 ALTER TABLE dbo. ClientConfig DROP CONSTRAINT [DF_ClientConfig_ClientConfigId];20 ALTER TABLE dbo. ClientGroup_Resource DROP CONSTRAINT [DF_ClientGroup_ResourceClientGroup_RessourceId];19 ALTER TABLE dbo.SlaveConfig DROP CONSTRAINT [DF_SlaveConfig_SlaveConfigId]; 20 ALTER TABLE dbo.SlaveGroup_Resource DROP CONSTRAINT [DF_SlaveGroup_ResourceSlaveGroup_RessourceId]; 21 21 ALTER TABLE dbo.PluginInfo DROP CONSTRAINT [DF_PluginInfo_PluginId]; 22 22 ALTER TABLE dbo.Project DROP CONSTRAINT [DF_Project_ProjectId]; … … 34 34 ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId; 35 35 36 ALTER TABLE dbo. ClientConfig ALTER COLUMN ClientConfigId ADD ROWGUIDCOL;37 ALTER TABLE dbo. ClientConfig WITH NOCHECK ADD CONSTRAINT [DF_ClientConfig_ClientConfigId] DEFAULT (newid()) FOR ClientConfigId;36 ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId ADD ROWGUIDCOL; 37 ALTER TABLE dbo.SlaveConfig WITH NOCHECK ADD CONSTRAINT [DF_SlaveConfig_SlaveConfigId] DEFAULT (newid()) FOR SlaveConfigId; 38 38 39 ALTER TABLE dbo. ClientGroup_Resource ALTER COLUMN ClientGroup_RessourceId ADD ROWGUIDCOL;40 ALTER TABLE dbo. ClientGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_ClientGroup_Resource_ClientGroup_RessourceId] DEFAULT (newid()) FOR ClientGroup_RessourceId;39 ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId ADD ROWGUIDCOL; 40 ALTER TABLE dbo.SlaveGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_SlaveGroup_Resource_SlaveGroup_RessourceId] DEFAULT (newid()) FOR SlaveGroup_RessourceId; 41 41 42 42 ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId ADD ROWGUIDCOL;
Note: See TracChangeset
for help on using the changeset viewer.