Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8340


Ignore:
Timestamp:
07/27/12 10:19:22 (12 years ago)
Author:
ascheibe
Message:

#1580 changed user account for executing the slave service to NetworkService (thanks jkarder for the patch)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Slave.App/3.3/HiveSlaveApplication.cs

    r7259 r8340  
    2020#endregion
    2121
    22 using System.IO;
    2322using System.Threading;
    2423using System.Windows.Forms;
    25 using HeuristicLab.Clients.Hive.SlaveCore.Properties;
    2624using HeuristicLab.Clients.Hive.SlaveCore.Views;
    2725using HeuristicLab.PluginInfrastructure;
     
    3230    private HeuristicLab.Clients.Hive.SlaveCore.Core core;
    3331    public override void Run() {
    34       CheckWorkingDirectories();
    3532
    3633      core = new HeuristicLab.Clients.Hive.SlaveCore.Core();
     
    4845      core.Shutdown();
    4946    }
    50 
    51     /// <summary>
    52     /// Normally the configuration file just contains the folder names of the PluginCache and the AppDomain working directory.
    53     /// This means that these folders are created in the current directory which is ok for the console client and the windows service.
    54     /// For the HL client we can't do that because the plugin infrastructure gets confused when starting HeuristicLab.
    55     /// Therefore if there is only a relative path in the config, we change that to the temp path.
    56     /// </summary>
    57     void CheckWorkingDirectories() {
    58       if (!Path.IsPathRooted(Settings.Default.PluginCacheDir)) {
    59         Settings.Default.PluginCacheDir = Path.Combine(Path.GetTempPath(), Settings.Default.PluginCacheDir);
    60         Settings.Default.Save();
    61       }
    62 
    63       if (!Path.IsPathRooted(Settings.Default.PluginTempBaseDir)) {
    64         Settings.Default.PluginTempBaseDir = Path.Combine(Path.GetTempPath(), Settings.Default.PluginTempBaseDir);
    65         Settings.Default.Save();
    66       }
    67     }
    6847  }
    6948}
  • trunk/sources/HeuristicLab.Clients.Hive.Slave.WindowsService/3.3/ProjectInstaller.Designer.cs

    r6983 r8340  
    2929      // serviceProcessInstaller1
    3030      //
    31       this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
     31      this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.NetworkService;
    3232      this.serviceProcessInstaller1.Installers.AddRange(new System.Configuration.Install.Installer[] {
    3333            this.serviceInstaller1});
  • trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/Manager/PluginManager.cs

    r7259 r8340  
    2727using System.Runtime.Serialization.Formatters.Binary;
    2828using System.Threading;
    29 using HeuristicLab.Clients.Hive.SlaveCore.Properties;
    3029using HeuristicLab.Core;
     30using CoreProperties = HeuristicLab.Clients.Hive.SlaveCore.Properties;
    3131
    3232namespace HeuristicLab.Clients.Hive.SlaveCore {
    3333  public class PluginManager {
    3434    private static object locker = new object();
    35     private string lastUsedFileName = Settings.Default.LastUsedFileName;
     35    private string lastUsedFileName = CoreProperties.Settings.Default.LastUsedFileName;
    3636    //maximum number of days after which a plugin gets deleted if not used
    37     private int pluginLifetime = Settings.Default.PluginLifetime;
     37    private int pluginLifetime = CoreProperties.Settings.Default.PluginLifetime;
    3838
    3939    private string PluginCacheDir { get; set; }
     
    4646      this.pluginService = pluginService;
    4747      this.log = log;
    48       PluginCacheDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.PluginCacheDir);
    49       PluginTempBaseDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.PluginTempBaseDir);
     48      CheckWorkingDirectories();
     49      PluginCacheDir = CoreProperties.Settings.Default.PluginCacheDir;
     50      PluginTempBaseDir = CoreProperties.Settings.Default.PluginTempBaseDir;
    5051      DoUpdateRun();
     52    }
     53
     54    /// <summary>
     55    /// Normally the configuration file just contains the folder names of the PluginCache and the AppDomain working directory.
     56    /// This means that these folders are created in the current directory which is ok for the console client and the windows service.
     57    /// For the HL client we can't do that because the plugin infrastructure gets confused when starting HeuristicLab.
     58    /// Therefore if there is only a relative path in the config, we change that to the temp path.
     59    /// </summary>
     60    private void CheckWorkingDirectories() {
     61      if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginCacheDir)) {
     62        CoreProperties.Settings.Default.PluginCacheDir = Path.Combine(Path.GetTempPath(), CoreProperties.Settings.Default.PluginCacheDir);
     63        CoreProperties.Settings.Default.Save();
     64      }
     65
     66      if (!Path.IsPathRooted(CoreProperties.Settings.Default.PluginTempBaseDir)) {
     67        CoreProperties.Settings.Default.PluginTempBaseDir = Path.Combine(Path.GetTempPath(), CoreProperties.Settings.Default.PluginTempBaseDir);
     68        CoreProperties.Settings.Default.Save();
     69      }
    5170    }
    5271
     
    85104        }
    86105
    87         if (requestedPlugin.Name == Settings.Default.ConfigurationName) {
     106        if (requestedPlugin.Name == CoreProperties.Settings.Default.ConfigurationName) {
    88107          // configuration plugin consists only of 1 file (usually the "HeuristicLab X.X.exe.config")
    89108          configFileName = Path.Combine(targetDir, Path.GetFileName(filePaths.SingleOrDefault()));
     
    93112      // copy files from PluginInfrastructure (which are not declared in any plugins)
    94113      string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    95       CopyFile(baseDir, targetDir, Settings.Default.PluginInfrastructureDll);
    96       CopyFile(baseDir, targetDir, Settings.Default.SharpZipLibDll);
    97       CopyFile(baseDir, targetDir, Settings.Default.SharpZipLibLicense);
     114      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.PluginInfrastructureDll);
     115      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.SharpZipLibDll);
     116      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.SharpZipLibLicense);
    98117
    99118      // copy slave plugins, otherwise its not possible to register the UnhandledException handler to the appdomain       
    100       CopyFile(baseDir, targetDir, Settings.Default.ClientsHiveSlaveCoreDll);
    101       CopyFile(baseDir, targetDir, Settings.Default.ClientsHiveDll);
    102       CopyFile(baseDir, targetDir, Settings.Default.HiveDll);
    103       CopyFile(baseDir, targetDir, Settings.Default.ClientsCommonDll);
     119      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.ClientsHiveSlaveCoreDll);
     120      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.ClientsHiveDll);
     121      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.HiveDll);
     122      CopyFile(baseDir, targetDir, CoreProperties.Settings.Default.ClientsCommonDll);
    104123    }
    105124
     
    109128      di.Refresh();
    110129      while (di.Exists) {
    111         Thread.Sleep(Settings.Default.DirOpSleepTime);
     130        Thread.Sleep(CoreProperties.Settings.Default.DirOpSleepTime);
    112131        di.Refresh();
    113132      }
     
    120139        di = Directory.CreateDirectory(targetDir);
    121140        while (!di.Exists) {
    122           Thread.Sleep(Settings.Default.DirOpSleepTime);
     141          Thread.Sleep(CoreProperties.Settings.Default.DirOpSleepTime);
    123142          di.Refresh();
    124143        }
     
    279298      try {
    280299        log.LogMessage("Deleting plugins...");
    281         int tries = Settings.Default.PluginDeletionRetries;
     300        int tries = CoreProperties.Settings.Default.PluginDeletionRetries;
    282301        string path = Path.Combine(PluginTempBaseDir, id.ToString());
    283302        while (tries > 0) {
     
    287306          }
    288307          catch (Exception) {
    289             Thread.Sleep(Settings.Default.PluginDeletionTimeout);
     308            Thread.Sleep(CoreProperties.Settings.Default.PluginDeletionTimeout);
    290309            tries--;
    291310            if (tries == 0) throw;
Note: See TracChangeset for help on using the changeset viewer.