Changeset 4269 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive
- Timestamp:
- 08/20/10 09:54:05 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive
- Files:
-
- 1 deleted
- 3 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 }
Note: See TracChangeset
for help on using the changeset viewer.