Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/20/10 09:54:05 (14 years ago)
Author:
cneumuel
Message:

fixed invalid plugin-directory (#1159)

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  
    7979
    8080    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 help
    84       // * made public property PollStates an IEnumerable to be immutable -> didn't help
    85       // * using for loop
    86 
    8781      JobState[] pollStatesCopy = PollStates.ToArray();
    8882      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  
    6060
    6161    private WcfService wcfService;
    62     private Heartbeat beat;
     62    private HeartbeatManager beat;
    6363
    6464    /// <summary>
     
    9090
    9191      //Initialize the heartbeat
    92       beat = new Heartbeat { Interval = new TimeSpan(0, 0, 10) };
     92      beat = new HeartbeatManager { Interval = new TimeSpan(0, 0, 10) };
    9393      beat.StartHeartbeat();
    9494
     
    197197          kvp.Value.RequestSnapshot();
    198198        }
    199 
    200199      }
    201200    }
     
    293292        bool sandboxed = false;
    294293        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);
    303294        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());
    305303
    306304          AppDomain appDomain = HeuristicLab.PluginInfrastructure.Sandboxing.SandboxManager.CreateAndInitSandbox(pluginDir, null);
     
    323321            }
    324322          }
     323          beat.InterruptHeartBeatThread();
    325324        }
    326325        catch (Exception exception) {
     
    348347        SlaveStatusInfo.JobsProcessed++;
    349348        Logger.Info("Increased ProcessedJobs to:" + SlaveStatusInfo.JobsProcessed);
     349        beat.InterruptHeartBeatThread();
    350350      } else {
    351351        Logger.Error("Sending of job " + e.Result.JobId + " failed, job has been wasted. Message: " + e.Result.StatusMessage);
     
    395395      //a result within the next few heartbeats     
    396396      //if (!UptimeManager.Instance.CalendarAvailable || UptimeManager.Instance.IsOnline()) {
    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;
     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;
    402402      //}
    403403    }
     
    417417        wcfService.SetCalendarStatus(ConfigManager.Instance.GetClientInfo().Id, CalendarState.NotAllowedToFetch);
    418418      }
     419      beat.InterruptHeartBeatThread();
    419420    }
    420421
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Slave.Core/3.3/PluginCache.cs

    r4254 r4269  
    99using HeuristicLab.PluginInfrastructure.Manager;
    1010using HeuristicLab.Tracing;
     11using System.Reflection;
    1112
    1213namespace HeuristicLab.Hive.Slave.Core {
     
    1516    private static PluginCache instance = null;
    1617
    17     public const string PLUGIN_REPO = @"plugins\";
     18    public string PluginRepositoryDir { get; set; }
    1819
    1920    private List<PluginDescription> cachedPlugins = new List<PluginDescription>();
    2021
    21     private PluginManager pm = new PluginManager(PLUGIN_REPO);
     22    private PluginManager pm;
    2223
    2324    public static PluginCache Instance {
     
    2829      }
    2930    }
     31
    3032    public PluginCache() {
     33      PluginRepositoryDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins");
     34     
     35      this.pm = new PluginManager(PluginRepositoryDir);
    3136      DoUpdateRun();
    3237    }
    3338
    3439    private void DoUpdateRun() {
     40      if (!Directory.Exists(PluginRepositoryDir)) {
     41        Directory.CreateDirectory(PluginRepositoryDir);
     42      }
    3543      pm.DiscoverAndCheckPlugins();
    3644      cachedPlugins = new List<PluginDescription>(pm.Plugins);
    3745    }
    3846
    39 
    4047    [MethodImpl(MethodImplOptions.Synchronized)]
    4148    public bool CopyPluginsForJob(List<HivePluginInfoDto> requests, Guid jobId) {
    42 
    43       String targetDir = PLUGIN_REPO + jobId.ToString() + "\\";
     49      String targetDir = Path.Combine(PluginRepositoryDir, jobId.ToString());
    4450
    4551      if (Directory.Exists(targetDir)) {
     
    5056
    5157      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();
    6064        if (pd == null) {
    6165          return false;
     
    6367
    6468        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)));
    6674        }
    6775      }
     
    113121        Logger.Debug("creating new files");
    114122        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);
    116126        }
    117127
     
    124134      try {
    125135        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) {
    128139        Logger.Debug("failed while unloading " + id + " with exception " + ex);
    129140      }
Note: See TracChangeset for help on using the changeset viewer.