Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4269


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

fixed invalid plugin-directory (#1159)

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  
    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      }
  • branches/3.3-HiveMigration/tools/cleanHiveDatabase.sql

    r4159 r4269  
    44DELETE FROM [HeuristicLab.Hive].[dbo].UptimeStatistics
    55DELETE FROM [HeuristicLab.Hive].[dbo].UptimeCalendar
    6 DELETE FROM [HeuristicLab.Hive].[dbo].ClientConfig
    7 DELETE FROM [HeuristicLab.Hive].[dbo].ClientGroup_Resource
     6DELETE FROM [HeuristicLab.Hive].[dbo].SlaveConfig
     7DELETE FROM [HeuristicLab.Hive].[dbo].SlaveGroup_Resource
    88DELETE FROM [HeuristicLab.Hive].[dbo].[Resource]
    99DELETE FROM [HeuristicLab.Hive].[dbo].Job
  • branches/3.3-HiveMigration/tools/prepareHiveDatabase.sql

    r4170 r4269  
    66ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId DROP ROWGUIDCOL;
    77ALTER 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;
     8ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId DROP ROWGUIDCOL;
     9ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId DROP ROWGUIDCOL;
    1010ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId DROP ROWGUIDCOL;
    1111ALTER TABLE dbo.Project ALTER COLUMN ProjectId DROP ROWGUIDCOL;
     
    1717ALTER TABLE dbo.AssignedResources DROP CONSTRAINT [DF_AssignedResources_AssignedRessourcesId];
    1818ALTER 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];
     19ALTER TABLE dbo.SlaveConfig DROP CONSTRAINT [DF_SlaveConfig_SlaveConfigId];
     20ALTER TABLE dbo.SlaveGroup_Resource DROP CONSTRAINT [DF_SlaveGroup_ResourceSlaveGroup_RessourceId];
    2121ALTER TABLE dbo.PluginInfo DROP CONSTRAINT [DF_PluginInfo_PluginId];
    2222ALTER TABLE dbo.Project DROP CONSTRAINT [DF_Project_ProjectId];
     
    3434ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId;
    3535
    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;
     36ALTER TABLE dbo.SlaveConfig ALTER COLUMN SlaveConfigId ADD ROWGUIDCOL;
     37ALTER TABLE dbo.SlaveConfig WITH NOCHECK ADD CONSTRAINT [DF_SlaveConfig_SlaveConfigId] DEFAULT (newid()) FOR SlaveConfigId;
    3838
    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;
     39ALTER TABLE dbo.SlaveGroup_Resource ALTER COLUMN SlaveGroup_RessourceId ADD ROWGUIDCOL;
     40ALTER TABLE dbo.SlaveGroup_Resource WITH NOCHECK ADD CONSTRAINT [DF_SlaveGroup_Resource_SlaveGroup_RessourceId] DEFAULT (newid()) FOR SlaveGroup_RessourceId;
    4141
    4242ALTER TABLE dbo.PluginInfo ALTER COLUMN PluginId ADD ROWGUIDCOL;
Note: See TracChangeset for help on using the changeset viewer.