Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6381


Ignore:
Timestamp:
06/08/11 00:04:16 (13 years ago)
Author:
cneumuel
Message:

#1233

  • locking for childHiveJobs in OptimizerHiveJob avoid multi threaded access issues
  • added IsPrivileged to gui
  • minor changes
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
7 added
6 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Administration/3.4

    • Property svn:ignore set to
      bin
      obj
      HeuristicLab.Clients.Hive.Administration-3.4.csproj.user
      HeuristicLab.Clients.Hive.Administration-3.4.csproj.vs10x
      HeuristicLabClientsHiveAdministrationPlugin.cs
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4

    • Property svn:ignore set to
      bin
      HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj.user
      HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj.vs10x
      HeuristicLabClientsHiveExperimentManagerPlugin.cs
      obj
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj

    r6373 r6381  
    151151  </ItemGroup>
    152152  <ItemGroup>
    153     <Compile Include="Views\HiveExperimentListView.cs">
     153    <Compile Include="Views\RefreshableHiveExperimentListView.cs">
    154154      <SubType>UserControl</SubType>
    155155    </Compile>
    156     <Compile Include="Views\HiveExperimentListView.Designer.cs">
    157       <DependentUpon>HiveExperimentListView.cs</DependentUpon>
     156    <Compile Include="Views\RefreshableHiveExperimentListView.Designer.cs">
     157      <DependentUpon>RefreshableHiveExperimentListView.cs</DependentUpon>
    158158    </Compile>
    159159    <Compile Include="Views\HiveExperimentManagerView.cs">
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentManagerView.Designer.cs

    r6373 r6381  
    4646    private void InitializeComponent() {
    4747      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HiveExperimentManagerView));
    48       this.hiveExperimentListView = new HiveExperimentListView();
     48      this.hiveExperimentListView = new RefreshableHiveExperimentListView();
    4949      this.refreshButton = new System.Windows.Forms.Button();
    5050      this.SuspendLayout();
     
    8686    #endregion
    8787
    88     private HiveExperimentListView hiveExperimentListView;
     88    private RefreshableHiveExperimentListView hiveExperimentListView;
    8989    private System.Windows.Forms.Button refreshButton;
    9090
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.Designer.cs

    r6373 r6381  
    5050      this.tabControl = new System.Windows.Forms.TabControl();
    5151      this.jobsTabPage = new System.Windows.Forms.TabPage();
     52      this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.ExperimentManager.HiveJobItemTreeView();
    5253      this.logTabPage = new System.Windows.Forms.TabPage();
    5354      this.logView = new HeuristicLab.Core.Views.LogView();
     
    7374      this.calculatingLabel = new System.Windows.Forms.Label();
    7475      this.jobsLabel = new System.Windows.Forms.Label();
    75       this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.ExperimentManager.HiveJobItemTreeView();
     76      this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox();
    7677      this.tabControl.SuspendLayout();
    7778      this.jobsTabPage.SuspendLayout();
     
    9091      this.tabControl.Name = "tabControl";
    9192      this.tabControl.SelectedIndex = 0;
    92       this.tabControl.Size = new System.Drawing.Size(821, 520);
     93      this.tabControl.Size = new System.Drawing.Size(717, 452);
    9394      this.tabControl.TabIndex = 4;
    9495      //
     
    9899      this.jobsTabPage.Location = new System.Drawing.Point(4, 22);
    99100      this.jobsTabPage.Name = "jobsTabPage";
    100       this.jobsTabPage.Size = new System.Drawing.Size(813, 494);
     101      this.jobsTabPage.Size = new System.Drawing.Size(709, 426);
    101102      this.jobsTabPage.TabIndex = 5;
    102103      this.jobsTabPage.Text = "Jobs";
    103104      this.jobsTabPage.UseVisualStyleBackColor = true;
     105      //
     106      // jobsTreeView
     107      //
     108      this.jobsTreeView.AllowDrop = true;
     109      this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     110                  | System.Windows.Forms.AnchorStyles.Left)
     111                  | System.Windows.Forms.AnchorStyles.Right)));
     112      this.jobsTreeView.Caption = "ItemTree View";
     113      this.jobsTreeView.Content = null;
     114      this.jobsTreeView.Location = new System.Drawing.Point(2, 3);
     115      this.jobsTreeView.Name = "jobsTreeView";
     116      this.jobsTreeView.ReadOnly = false;
     117      this.jobsTreeView.Size = new System.Drawing.Size(704, 420);
     118      this.jobsTreeView.TabIndex = 0;
     119      this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop);
     120      this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter);
     121      this.jobsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragOver);
    104122      //
    105123      // logTabPage
     
    128146      this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    129147      this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image")));
    130       this.startButton.Location = new System.Drawing.Point(0, 604);
     148      this.startButton.Location = new System.Drawing.Point(0, 536);
    131149      this.startButton.Name = "startButton";
    132150      this.startButton.Size = new System.Drawing.Size(24, 24);
     
    140158      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    141159      this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));
    142       this.stopButton.Location = new System.Drawing.Point(60, 604);
     160      this.stopButton.Location = new System.Drawing.Point(60, 536);
    143161      this.stopButton.Name = "stopButton";
    144162      this.stopButton.Size = new System.Drawing.Size(24, 24);
     
    153171      this.resetButton.Enabled = false;
    154172      this.resetButton.Image = ((System.Drawing.Image)(resources.GetObject("resetButton.Image")));
    155       this.resetButton.Location = new System.Drawing.Point(90, 604);
     173      this.resetButton.Location = new System.Drawing.Point(90, 536);
    156174      this.resetButton.Name = "resetButton";
    157175      this.resetButton.Size = new System.Drawing.Size(24, 24);
     
    165183      this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    166184      this.executionTimeLabel.AutoSize = true;
    167       this.executionTimeLabel.Location = new System.Drawing.Point(595, 611);
     185      this.executionTimeLabel.Location = new System.Drawing.Point(491, 543);
    168186      this.executionTimeLabel.Name = "executionTimeLabel";
    169187      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
     
    174192      //
    175193      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    176       this.executionTimeTextBox.Location = new System.Drawing.Point(684, 608);
     194      this.executionTimeTextBox.Location = new System.Drawing.Point(580, 540);
    177195      this.executionTimeTextBox.Name = "executionTimeTextBox";
    178196      this.executionTimeTextBox.ReadOnly = true;
     
    185203      this.pauseButton.Enabled = false;
    186204      this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));
    187       this.pauseButton.Location = new System.Drawing.Point(30, 604);
     205      this.pauseButton.Location = new System.Drawing.Point(30, 536);
    188206      this.pauseButton.Name = "pauseButton";
    189207      this.pauseButton.Size = new System.Drawing.Size(24, 24);
     
    208226      this.resourceNamesTextBox.Location = new System.Drawing.Point(73, 53);
    209227      this.resourceNamesTextBox.Name = "resourceNamesTextBox";
    210       this.resourceNamesTextBox.Size = new System.Drawing.Size(494, 20);
     228      this.resourceNamesTextBox.Size = new System.Drawing.Size(304, 20);
    211229      this.resourceNamesTextBox.TabIndex = 14;
    212230      this.resourceNamesTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated);
     
    216234      this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    217235      this.useLocalPluginsCheckBox.AutoSize = true;
    218       this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(573, 56);
     236      this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(469, 56);
    219237      this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox";
    220238      this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(105, 17);
     
    239257      this.nameTextBox.Location = new System.Drawing.Point(73, 27);
    240258      this.nameTextBox.Name = "nameTextBox";
    241       this.nameTextBox.Size = new System.Drawing.Size(605, 20);
     259      this.nameTextBox.Size = new System.Drawing.Size(501, 20);
    242260      this.nameTextBox.TabIndex = 21;
    243261      this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated);
     
    274292      this.infoGroupBox.Controls.Add(this.calculatingLabel);
    275293      this.infoGroupBox.Controls.Add(this.jobsLabel);
    276       this.infoGroupBox.Location = new System.Drawing.Point(684, 5);
     294      this.infoGroupBox.Location = new System.Drawing.Point(580, 5);
    277295      this.infoGroupBox.Name = "infoGroupBox";
    278296      this.infoGroupBox.Size = new System.Drawing.Size(133, 89);
     
    335353      this.jobsLabel.Text = "Jobs:";
    336354      //
    337       // jobsTreeView
    338       //
    339       this.jobsTreeView.AllowDrop = true;
    340       this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    341                   | System.Windows.Forms.AnchorStyles.Left)
    342                   | System.Windows.Forms.AnchorStyles.Right)));
    343       this.jobsTreeView.Caption = "ItemTree View";
    344       this.jobsTreeView.Content = null;
    345       this.jobsTreeView.Location = new System.Drawing.Point(2, 3);
    346       this.jobsTreeView.Name = "jobsTreeView";
    347       this.jobsTreeView.ReadOnly = false;
    348       this.jobsTreeView.Size = new System.Drawing.Size(808, 488);
    349       this.jobsTreeView.TabIndex = 0;
    350       this.jobsTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragDrop);
    351       this.jobsTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragEnter);
    352       this.jobsTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.jobsTreeView_DragOver);
     355      // isPrivilegedCheckBox
     356      //
     357      this.isPrivilegedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     358      this.isPrivilegedCheckBox.AutoSize = true;
     359      this.isPrivilegedCheckBox.Location = new System.Drawing.Point(383, 55);
     360      this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox";
     361      this.isPrivilegedCheckBox.Size = new System.Drawing.Size(80, 17);
     362      this.isPrivilegedCheckBox.TabIndex = 26;
     363      this.isPrivilegedCheckBox.Text = "IsPrivileged";
     364      this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the job will be executed in a privileged sandbox on the slave.");
     365      this.isPrivilegedCheckBox.UseVisualStyleBackColor = true;
     366      this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckedChanged);
    353367      //
    354368      // RefreshableHiveExperimentView
     
    356370      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    357371      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     372      this.Controls.Add(this.isPrivilegedCheckBox);
    358373      this.Controls.Add(this.infoGroupBox);
    359374      this.Controls.Add(this.refreshAutomaticallyCheckBox);
     
    372387      this.Controls.Add(this.resetButton);
    373388      this.Name = "RefreshableHiveExperimentView";
    374       this.Size = new System.Drawing.Size(821, 628);
     389      this.Size = new System.Drawing.Size(717, 560);
    375390      this.tabControl.ResumeLayout(false);
    376391      this.jobsTabPage.ResumeLayout(false);
     
    410425    private System.Windows.Forms.Label calculatingLabel;
    411426    private System.Windows.Forms.Label jobsLabel;
     427    private System.Windows.Forms.CheckBox isPrivilegedCheckBox;
    412428
    413429  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.cs

    r6373 r6381  
    103103        resourceNamesTextBox.Text = string.Empty;
    104104        useLocalPluginsCheckBox.Checked = false;
     105        isPrivilegedCheckBox.Checked = false;
    105106        logView.Content = null;
    106         //includeJobsCheckBox.Checked = false;
    107         refreshAutomaticallyCheckBox.Checked = false;
     107        refreshAutomaticallyCheckBox.Checked = false;       
    108108        logView.Content = null;
    109109      } else {
     
    112112        resourceNamesTextBox.Text = Content.HiveExperiment.ResourceNames;
    113113        useLocalPluginsCheckBox.Checked = Content.HiveExperiment.UseLocalPlugins;
    114         //includeJobsCheckBox.Checked = Content.IncludeJobs;
     114        isPrivilegedCheckBox.Checked = Content.HiveExperiment.IsPrivileged;
    115115        refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically;
    116116        logView.Content = Content.Log;
     
    138138        this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded;
    139139
     140        this.isPrivilegedCheckBox.Enabled = Content.IsControllable && !(Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded); // TODO: check if user has the rights to do this
    140141        this.useLocalPluginsCheckBox.Enabled = Content.IsControllable && !(Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded);
    141142        this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.HiveExperiment.ExecutionState == ExecutionState.Started;
    142143        this.refreshButton.Enabled = Content.IsControllable && alreadyUploaded;
    143144        this.Locked = !Content.IsControllable || Content.HiveExperiment.ExecutionState == ExecutionState.Started;
     145
    144146      }
    145147      SetEnabledStateOfExecutableButtons();
     
    296298    private void useLocalPluginsCheckBox_CheckedChanged(object sender, EventArgs e) {
    297299      if (Content != null) Content.HiveExperiment.UseLocalPlugins = useLocalPluginsCheckBox.Checked;
     300    }
     301
     302    private void isPrivilegedCheckBox_CheckedChanged(object sender, EventArgs e) {
     303      if (Content != null) Content.HiveExperiment.IsPrivileged = isPrivilegedCheckBox.Checked;
    298304    }
    299305
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r6371 r6381  
    228228      Guid jobId = (Guid)jobIdObj;
    229229      Job job = null;
    230       bool usedCoresIncremented = false;
     230      int usedCores = 0;
    231231      try {
    232232        job = wcfService.GetJob(jobId);
     
    234234        if (ConfigManager.Instance.GetFreeCores() < job.CoresNeeded) throw new OutOfCoresException();
    235235        if (ConfigManager.GetFreeMemory() < job.MemoryNeeded) throw new OutOfMemoryException();
    236         SlaveStatusInfo.IncrementUsedCores(job.CoresNeeded); usedCoresIncremented = true;
     236        SlaveStatusInfo.IncrementUsedCores(job.CoresNeeded); usedCores = job.CoresNeeded;
    237237        JobData jobData = wcfService.GetJobData(jobId);
    238238        if (jobData == null) throw new JobDataNotFoundException(jobId);
     
    242242      }
    243243      catch (JobNotFoundException) {
    244         if (usedCoresIncremented) SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded);
     244        SlaveStatusInfo.DecrementUsedCores(usedCores);
    245245        throw;
    246246      }
    247247      catch (JobDataNotFoundException) {
    248         SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded);
     248        SlaveStatusInfo.DecrementUsedCores(usedCores);
    249249        throw;
    250250      }
    251251      catch (JobAlreadyRunningException) {
    252         SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded);
     252        SlaveStatusInfo.DecrementUsedCores(usedCores);
    253253        throw;
    254254      }
     
    261261        throw;
    262262      }
    263       catch (Exception) {
    264         if (usedCoresIncremented) SlaveStatusInfo.DecrementUsedCores(job.CoresNeeded);
     263      catch (Exception e) {
     264        SlaveStatusInfo.DecrementUsedCores(usedCores);
     265        wcfService.UpdateJobState(jobId, JobState.Waiting, e.ToString()); // unknown internal error - report and set waiting again
    265266        throw;
    266267      }
     
    372373        job.ExecutionTime = slaveJob.ExecutionTime;
    373374        if (jobData != null) {
    374           wcfService.UpdateJobData(job, jobData, configManager.GetClientInfo().Id, JobState.Failed);
     375          wcfService.UpdateJobData(job, jobData, configManager.GetClientInfo().Id, JobState.Failed, exception.ToString());
    375376        } else {
    376377          wcfService.UpdateJobState(job.Id, JobState.Failed, exception.ToString());
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs

    r6371 r6381  
    154154    #region Job Events
    155155    private void Job_JobFailed(object sender, EventArgs e) {
     156      IsStopping = true;
    156157      EventArgs<Exception> ex = (EventArgs<Exception>)e;
    157158      currentException = ex.Value;
     
    161162
    162163    private void Job_JobStopped(object sender, EventArgs e) {
     164      IsStopping = true;
    163165      if (wasJobAborted)
    164166        pauseStopSem.Release();
     
    168170
    169171    private void Job_JobPaused(object sender, EventArgs e) {
     172      IsPausing = true;
    170173      pauseStopSem.Release();
    171174      executorQueue.AddMessage(ExecutorMessageType.JobPaused);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Manager/JobManager.cs

    r6371 r6381  
    8686        }
    8787        catch (Exception) {
     88          RemoveSlaveJob(job.Id, slaveJob); // clean up and rethrow
    8889          slaveJob.DisposeAppDomain();
    89           RemoveSlaveJob(job.Id, slaveJob); // clean up and rethrow
    9090          throw;
    9191        }
     
    268268        if (jobData == null) throw new SerializationException();
    269269      }
    270       catch { }
     270      catch { /* jobData will be null */ }
    271271      SlaveStatusInfo.IncrementJobsFailed();
    272272      OnJobFailed(slaveJob, jobData, e.Value2);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/WcfService.cs

    r6371 r6381  
    101101    /// Uploads the jobData and sets a new jobState (while correctly setting Transferring state)
    102102    /// </summary>
    103     public void UpdateJobData(Job job, JobData jobData, Guid slaveId, JobState state) {
     103    public void UpdateJobData(Job job, JobData jobData, Guid slaveId, JobState state, string exception = "") {
    104104      CallHiveService(service => {
    105105        service.UpdateJob(job);
    106106        job = service.UpdateJobState(job.Id, JobState.Transferring, slaveId, null, null);
    107107        service.UpdateJobData(job, jobData);
    108         service.UpdateJobState(job.Id, state, slaveId, null, null);
     108        service.UpdateJobState(job.Id, state, slaveId, null, exception);
    109109      });
    110110    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/HeuristicLab.Clients.Hive.Views-3.4.csproj

    r6373 r6381  
    125125  </ItemGroup>
    126126  <ItemGroup>
    127     <Compile Include="HiveJobs\ControllableHiveJobView.cs">
    128       <SubType>UserControl</SubType>
    129     </Compile>
    130     <Compile Include="HiveJobs\ControllableHiveJobView.designer.cs">
    131       <DependentUpon>ControllableHiveJobView.cs</DependentUpon>
     127    <Compile Include="HiveJobs\OptimizerHiveJobView.cs">
     128      <SubType>UserControl</SubType>
     129    </Compile>
     130    <Compile Include="HiveJobs\OptimizerHiveJobView.designer.cs">
     131      <DependentUpon>OptimizerHiveJobView.cs</DependentUpon>
    132132    </Compile>
    133133    <Compile Include="HiveItemView.cs">
     
    220220  </ItemGroup>
    221221  <ItemGroup>
    222     <EmbeddedResource Include="HiveJobs\ControllableHiveJobView.resx">
    223       <DependentUpon>ControllableHiveJobView.cs</DependentUpon>
     222    <EmbeddedResource Include="HiveJobs\OptimizerHiveJobView.resx">
     223      <DependentUpon>OptimizerHiveJobView.cs</DependentUpon>
    224224    </EmbeddedResource>
    225225    <EmbeddedResource Include="HiveJobs\HiveJobView.resx">
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveClient.cs

    r6373 r6381  
    225225
    226226          foreach (HiveJob hiveJob in refreshableHiveExperiment.HiveExperiment.HiveJobs) {
    227             UploadJobWithChildren(refreshableHiveExperiment.HiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.UseLocalPlugins, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log);
     227            UploadJobWithChildren(refreshableHiveExperiment.HiveExperiment.Progress, service, hiveJob, null, resourceIds, ref jobCount, totalJobCount, configFilePlugin.Id, refreshableHiveExperiment.HiveExperiment.UseLocalPlugins, refreshableHiveExperiment.HiveExperiment.Id, refreshableHiveExperiment.Log, refreshableHiveExperiment.HiveExperiment.IsPrivileged);
    228228          }
    229229
     
    257257    /// <param name="parentHiveJob">shall be null if its the root job</param>
    258258    /// <param name="groups"></param>
    259     private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, bool useLocalPlugins, Guid hiveExperimentId, ILog log) {
     259    private void UploadJobWithChildren(IProgress progress, IHiveService service, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, ref int jobCount, int totalJobCount, Guid configPluginId, bool useLocalPlugins, Guid hiveExperimentId, ILog log, bool isPrivileged) {
    260260      jobCount++;
    261261      progress.Status = string.Format("Serializing job {0} of {1}", jobCount, totalJobCount);
     
    263263      List<IPluginDescription> plugins;
    264264
    265       if (hiveJob.ItemJob.ComputeInParallel &&
    266         (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) {
     265      if (hiveJob.ItemJob.ComputeInParallel && (hiveJob.ItemJob.Item is Optimization.Experiment || hiveJob.ItemJob.Item is Optimization.BatchRun)) {
    267266        hiveJob.Job.IsParentJob = true;
    268267        hiveJob.Job.FinishWhenChildJobsFinished = true;
     
    279278      hiveJob.Job.PluginsNeededIds.Add(configPluginId);
    280279      hiveJob.Job.HiveExperimentId = hiveExperimentId;
     280      hiveJob.Job.IsPrivileged = isPrivileged;
    281281
    282282      progress.Status = string.Format("Uploading job {0} of {1} ({2} kb, {3} objects)", jobCount, totalJobCount, jobData.Data.Count() / 1024, hiveJob.ItemJob.GetObjectGraphObjects().Count());
     
    293293
    294294      foreach (HiveJob child in hiveJob.ChildHiveJobs) {
    295         UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins, hiveExperimentId, log);
     295        UploadJobWithChildren(progress, service, child, hiveJob, groups, ref jobCount, totalJobCount, configPluginId, useLocalPlugins, hiveExperimentId, log, isPrivileged);
    296296      }
    297297    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/EngineHiveJob.cs

    r6373 r6381  
    5656
    5757      // clone operation and remove unnecessary scopes; don't do this earlier to avoid memory problems
    58       lock (locker) {
     58      //lock (locker) {
    5959        ((IAtomicOperation)ItemJob.InitialOperation).Scope.Parent = parentScopeClone;
    6060        ItemJob.InitialOperation = (IOperation)ItemJob.InitialOperation.Clone();
    6161        ((IAtomicOperation)ItemJob.InitialOperation).Scope.ClearParentScopes();
    6262        jobData.Data = PersistenceUtil.Serialize(ItemJob, out usedTypes);
    63       }
     63      //}
    6464
    6565      // add type objects from object graph to work around ticket #1527
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/HiveJob.cs

    r6373 r6381  
    2525using System.Drawing;
    2626using System.Linq;
     27using System.Threading;
    2728using HeuristicLab.Collections;
    2829using HeuristicLab.Common;
     
    3738  public class HiveJob : NamedItem, IItemTree<HiveJob> {
    3839    protected static object locker = new object();
     40    protected ReaderWriterLockSlim childHiveJobsLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
    3941
    4042    public override Image ItemImage {
     
    109111    protected ItemList<HiveJob> childHiveJobs;
    110112    public virtual ReadOnlyItemList<HiveJob> ChildHiveJobs {
    111       get { return childHiveJobs.AsReadOnly(); }
     113      get {
     114        childHiveJobsLock.EnterReadLock();
     115        try {
     116          return childHiveJobs.AsReadOnly();
     117        }
     118        finally { childHiveJobsLock.ExitReadLock(); }
     119      }
    112120    }
    113121
     
    117125    #region Constructors and Cloning
    118126    public HiveJob() {
    119       this.Job = new Job() {
    120         CoresNeeded = 1,
    121         MemoryNeeded = 0
    122       };
     127      this.Job = new Job() { CoresNeeded = 1, MemoryNeeded = 0 };
    123128      job.State = JobState.Offline;
    124129      this.childHiveJobs = new ItemList<HiveJob>();
     
    152157      this.Job = cloner.Clone(original.job);
    153158      this.ItemJob = cloner.Clone(original.ItemJob);
    154       this.childHiveJobs = cloner.Clone(original.childHiveJobs);
     159      original.childHiveJobsLock.EnterReadLock();
     160      try {
     161        this.childHiveJobs = cloner.Clone(original.childHiveJobs);
     162      }
     163      finally { original.childHiveJobsLock.ExitReadLock(); }
    155164      this.syncJobsWithOptimizers = original.syncJobsWithOptimizers;
    156165      this.isFinishedJobDownloaded = original.isFinishedJobDownloaded;
     
    198207
    199208    public virtual void AddChildHiveJob(HiveJob hiveJob) {
    200       this.childHiveJobs.Add(hiveJob);
     209      childHiveJobsLock.EnterWriteLock();
     210      try {
     211        this.childHiveJobs.Add(hiveJob);
     212      }
     213      finally { childHiveJobsLock.ExitWriteLock(); }
    201214    }
    202215
     
    237250      IEnumerable<Type> usedTypes;
    238251      byte[] jobByteArray = PersistenceUtil.Serialize(this.ItemJob, out usedTypes);
    239 
    240       JobData jobData = new JobData() {
    241         JobId = job.Id,
    242         Data = jobByteArray
    243       };
    244 
     252      JobData jobData = new JobData() { JobId = job.Id, Data = jobByteArray };
    245253      PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
    246 
    247254      return jobData;
    248255    }
     
    295302    /// </summary>
    296303    public IEnumerable<HiveJob> GetAllHiveJobs() {
    297       var jobs = new List<HiveJob>();
    298       jobs.Add(this);
    299       foreach (HiveJob child in this.ChildHiveJobs) {
    300         jobs.AddRange(child.GetAllHiveJobs());
    301       }
    302       return jobs;
     304      childHiveJobsLock.EnterReadLock();
     305      try {
     306        var jobs = new List<HiveJob>();
     307        jobs.Add(this);
     308        foreach (HiveJob child in this.childHiveJobs) {
     309          jobs.AddRange(child.GetAllHiveJobs());
     310        }
     311        return jobs;
     312      }
     313      finally { childHiveJobsLock.ExitReadLock(); }
    303314    }
    304315
    305316    public HiveJob GetParentByJobId(Guid jobId) {
    306       if (this.ChildHiveJobs.SingleOrDefault(j => j.job.Id == jobId) != null)
    307         return this;
    308       foreach (HiveJob child in this.childHiveJobs) {
    309         HiveJob result = child.GetParentByJobId(jobId);
    310         if (result != null)
    311           return result;
    312       }
    313       return null;
     317      childHiveJobsLock.EnterReadLock();
     318      try {
     319        if (this.ChildHiveJobs.SingleOrDefault(j => j.job.Id == jobId) != null)
     320          return this;
     321        foreach (HiveJob child in this.childHiveJobs) {
     322          HiveJob result = child.GetParentByJobId(jobId);
     323          if (result != null)
     324            return result;
     325        }
     326        return null;
     327      }
     328      finally { childHiveJobsLock.ExitWriteLock(); }
    314329    }
    315330
     
    321336        return this;
    322337      } else {
    323         foreach (HiveJob child in this.ChildHiveJobs) {
    324           HiveJob result = child.GetHiveJobByJobId(jobId);
    325           if (result != null)
    326             return result;
    327         }
     338        childHiveJobsLock.EnterReadLock();
     339        try {
     340          foreach (HiveJob child in this.childHiveJobs) {
     341            HiveJob result = child.GetHiveJobByJobId(jobId);
     342            if (result != null)
     343              return result;
     344          }
     345        }
     346        finally { childHiveJobsLock.ExitReadLock(); }
    328347      }
    329348      return null;
     
    331350
    332351    public void RemoveByJobId(Guid jobId) {
    333       IEnumerable<HiveJob> jobs = ChildHiveJobs.Where(j => j.Job.Id == jobId).ToList(); // if Guid.Empty needs to be removed, there could be more than one with this jobId
    334       foreach (HiveJob j in jobs) {
    335         this.childHiveJobs.Remove(j);
    336       }
    337       foreach (HiveJob child in ChildHiveJobs) {
    338         child.RemoveByJobId(jobId);
    339       }
     352      childHiveJobsLock.EnterWriteLock();
     353      try {
     354        IEnumerable<HiveJob> jobs = childHiveJobs.Where(j => j.Job.Id == jobId).ToList();
     355        foreach (HiveJob j in jobs) {
     356          this.childHiveJobs.Remove(j);
     357        }
     358        foreach (HiveJob child in childHiveJobs) {
     359          child.RemoveByJobId(jobId);
     360        }
     361      }
     362      finally { childHiveJobsLock.ExitWriteLock(); }
    340363    }
    341364
    342365    public IEnumerable<IItemTree<HiveJob>> GetChildItems() {
    343       return this.childHiveJobs;
     366      return this.ChildHiveJobs;
    344367    }
    345368
     
    371394    public void Pause() {
    372395      if (this.Job.IsParentJob) {
    373         foreach (var child in ChildHiveJobs) {
    374           ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.job.Id));
    375         }
     396        childHiveJobsLock.EnterReadLock();
     397        try {
     398          foreach (var child in childHiveJobs) {
     399            ServiceLocator.Instance.CallHiveService(s => s.PauseJob(child.job.Id));
     400          }
     401        }
     402        finally { childHiveJobsLock.ExitReadLock(); }
    376403      } else {
    377404        ServiceLocator.Instance.CallHiveService(s => s.PauseJob(this.job.Id));
     
    381408    public void Stop() {
    382409      if (this.Job.IsParentJob) {
    383         foreach (var child in ChildHiveJobs) {
    384           ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.job.Id));
    385         }
     410        childHiveJobsLock.EnterReadLock();
     411        try {
     412          foreach (var child in childHiveJobs) {
     413            ServiceLocator.Instance.CallHiveService(s => s.StopJob(child.job.Id));
     414          }
     415        }
     416        finally { childHiveJobsLock.ExitReadLock(); }
    386417      } else {
    387418        ServiceLocator.Instance.CallHiveService(s => s.StopJob(this.job.Id));
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveJobs/OptimizerHiveJob.cs

    r6373 r6381  
    129129    private void Optimizers_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
    130130      if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) {
    131         foreach (var item in e.Items) {
    132           if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") {
    133             this.childHiveJobs.Add(new OptimizerHiveJob(item.Value));
    134           }
    135         }
     131        childHiveJobsLock.EnterWriteLock();
     132        try {
     133          foreach (var item in e.Items) {
     134            if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") {
     135              this.childHiveJobs.Add(new OptimizerHiveJob(item.Value));
     136            }
     137          }
     138        }
     139        finally { childHiveJobsLock.ExitWriteLock(); }
    136140      }
    137141    }
    138142    private void Optimizers_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
    139143      if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) {
    140         foreach (var item in e.OldItems) {
    141           this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
    142         }
    143         foreach (var item in e.Items) {
    144           if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") {
    145             this.childHiveJobs.Add(new OptimizerHiveJob(item.Value));
    146           }
    147         }
     144        childHiveJobsLock.EnterWriteLock();
     145        try {
     146          foreach (var item in e.OldItems) {
     147            this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
     148          }
     149          foreach (var item in e.Items) {
     150            if (GetChildByOptimizer(item.Value) == null && item.Value.Name != "Placeholder") {
     151              this.childHiveJobs.Add(new OptimizerHiveJob(item.Value));
     152            }
     153          }
     154        }
     155        finally { childHiveJobsLock.ExitWriteLock(); }
    148156      }
    149157    }
    150158    private void Optimizers_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
    151159      if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) {
    152         foreach (var item in e.Items) {
    153           this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
    154         }
     160        childHiveJobsLock.EnterWriteLock();
     161        try {
     162          foreach (var item in e.Items) {
     163            this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
     164          }
     165        }
     166        finally { childHiveJobsLock.ExitWriteLock(); }
    155167      }
    156168    }
    157169    private void Optimizers_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<IOptimizer>> e) {
    158170      if (syncJobsWithOptimizers && this.ItemJob.ComputeInParallel) {
    159         foreach (var item in e.Items) {
    160           this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
    161         }
     171        childHiveJobsLock.EnterWriteLock();
     172        try {
     173          foreach (var item in e.Items) {
     174            this.childHiveJobs.Remove(this.GetChildByOptimizer(item.Value));
     175          }
     176        }
     177        finally { childHiveJobsLock.ExitWriteLock(); }
    162178      }
    163179    }
     
    182198
    183199      OptimizerHiveJob child = (OptimizerHiveJob)this.ChildHiveJobs.Single(j => j.Job.Id == childJobId);
    184       if (!optimizerJob.ComputeInParallel) {
    185         child.syncJobsWithOptimizers = false;
    186         child.ItemJob = optimizerJob;
    187         child.syncJobsWithOptimizers = true;
    188       }
     200      childHiveJobsLock.EnterReadLock();
     201      try {
     202        if (!optimizerJob.ComputeInParallel) {
     203          child.syncJobsWithOptimizers = false;
     204          child.ItemJob = optimizerJob;
     205          child.syncJobsWithOptimizers = true;
     206        }
     207      }
     208      finally { childHiveJobsLock.ExitReadLock(); }
    189209      syncJobsWithOptimizers = true;
    190210    }
     
    243263        }
    244264      }
    245       foreach (OptimizerHiveJob child in childHiveJobs) {
    246         child.SetIndexInParentOptimizerList(this);
    247       }
     265      childHiveJobsLock.EnterReadLock();
     266      try {
     267        foreach (OptimizerHiveJob child in childHiveJobs) {
     268          child.SetIndexInParentOptimizerList(this);
     269        }
     270      }
     271      finally { childHiveJobsLock.ExitReadLock(); }
    248272    }
    249273
     
    302326      }
    303327
    304       JobData jobData = new JobData() {
    305         JobId = job.Id,
    306         Data = jobByteArray
    307       };
    308 
     328      JobData jobData = new JobData() { JobId = job.Id, Data = jobByteArray };
    309329      PluginUtil.CollectDeclaringPlugins(plugins, usedTypes);
    310 
    311330      return jobData;
    312331    }
    313332
    314333    public OptimizerHiveJob GetChildByOptimizerJob(OptimizerJob optimizerJob) {
    315       foreach (OptimizerHiveJob child in ChildHiveJobs) {
    316         if (child.ItemJob == optimizerJob)
    317           return child;
    318       }
    319       return null;
     334      childHiveJobsLock.EnterReadLock();
     335      try {
     336        foreach (OptimizerHiveJob child in childHiveJobs) {
     337          if (child.ItemJob == optimizerJob)
     338            return child;
     339        }
     340        return null;
     341      }
     342      finally { childHiveJobsLock.ExitReadLock(); }
    320343    }
    321344
    322345    public HiveJob<OptimizerJob> GetChildByOptimizer(IOptimizer optimizer) {
    323       foreach (OptimizerHiveJob child in ChildHiveJobs) {
    324         if (child.ItemJob.Item == optimizer)
    325           return child;
    326       }
    327       return null;
     346      childHiveJobsLock.EnterReadLock();
     347      try {
     348        foreach (OptimizerHiveJob child in childHiveJobs) {
     349          if (child.ItemJob.Item == optimizer)
     350            return child;
     351        }
     352        return null;
     353      }
     354      finally { childHiveJobsLock.ExitReadLock(); }
    328355    }
    329356
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/ItemJob.cs

    r6373 r6381  
    3131  [Item("Item Job", "Represents a executable hive job which contains a HeuristicLab Item.")]
    3232  [StorableClass]
    33   public abstract class ItemJob : DeepCloneable, IJob {
     33  public abstract class ItemJob : NamedItem, IJob {
    3434    public virtual bool IsParallelizable {
    3535      get { return true; }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/Jobs/OptimizerJob.cs

    r6373 r6381  
    8686
    8787    #region IJob Members
    88 
    8988    public override ExecutionState ExecutionState {
    9089      get { return Item.ExecutionState; }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs

    r6373 r6381  
    395395
    396396    public override string ToString() {
    397       return HiveExperiment.ToString();
     397      return string.Format("{0} {1}", HiveExperiment.DateCreated.ToString("MM.dd.yyyy HH:mm"), HiveExperiment.ToString());
    398398    }
    399399  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperiment.cs

    r6372 r6381  
    3333      get { return useLocalPlugins; }
    3434      set { useLocalPlugins = value; }
     35    }
     36
     37    private bool isPrivileged;
     38    public bool IsPrivileged {
     39      get { return isPrivileged; }
     40      set { isPrivileged = value; }
    3541    }
    3642
     
    8995      this.ResourceNames = "HEAL";
    9096      this.HiveJobs = new ItemCollection<HiveJob>();
     97      this.DateCreated = DateTime.Now;
    9198    }
    9299
     
    103110      this.UseLocalPlugins = original.UseLocalPlugins;
    104111      this.ExecutionTime = original.ExecutionTime;
     112      this.IsPrivileged = original.IsPrivileged;
    105113    }
    106114    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Hive/3.4/IJob.cs

    r6372 r6381  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425
    2526namespace HeuristicLab.Hive {
    26   public interface IJob : INamedItem {
    27 
     27  public interface IJob : IDeepCloneable, ICloneable {
    2828    TimeSpan ExecutionTime { get; }
    2929
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Views/3.4/HiveEngineView.Designer.cs

    r6373 r6381  
    3333      this.tabControl = new System.Windows.Forms.TabControl();
    3434      this.jobsTabPage = new System.Windows.Forms.TabPage();
    35       this.hiveExperimentListView = new HiveExperimentListView();
     35      this.hiveExperimentListView = new HeuristicLab.Clients.Hive.ExperimentManager.Views.RefreshableHiveExperimentListView();
    3636      this.logTabPage = new System.Windows.Forms.TabPage();
    3737      this.logView = new HeuristicLab.Core.Views.LogView();
     
    3939      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
    4040      this.useLocalPluginsCheckBox = new System.Windows.Forms.CheckBox();
     41      this.isPrivilegedCheckBox = new System.Windows.Forms.CheckBox();
    4142      this.tabControl.SuspendLayout();
    4243      this.jobsTabPage.SuspendLayout();
     
    6061      this.resourceIdsTextBox.Location = new System.Drawing.Point(189, 52);
    6162      this.resourceIdsTextBox.Name = "resourceIdsTextBox";
    62       this.resourceIdsTextBox.Size = new System.Drawing.Size(405, 20);
     63      this.resourceIdsTextBox.Size = new System.Drawing.Size(319, 20);
    6364      this.resourceIdsTextBox.TabIndex = 4;
    6465      this.resourceIdsTextBox.Text = "HEAL";
     
    184185      this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    185186      this.useLocalPluginsCheckBox.AutoSize = true;
    186       this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(600, 55);
     187      this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(598, 55);
    187188      this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox";
    188       this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(103, 17);
     189      this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(105, 17);
    189190      this.useLocalPluginsCheckBox.TabIndex = 12;
    190       this.useLocalPluginsCheckBox.Text = "useLocalPlugins";
     191      this.useLocalPluginsCheckBox.Text = "UseLocalPlugins";
    191192      this.useLocalPluginsCheckBox.UseVisualStyleBackColor = true;
    192193      this.useLocalPluginsCheckBox.CheckedChanged += new System.EventHandler(this.useLocalPluginsCheckBox_CheckedChanged);
    193194      //
     195      // isPrivilegedCheckBox
     196      //
     197      this.isPrivilegedCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     198      this.isPrivilegedCheckBox.AutoSize = true;
     199      this.isPrivilegedCheckBox.Location = new System.Drawing.Point(514, 55);
     200      this.isPrivilegedCheckBox.Name = "isPrivilegedCheckBox";
     201      this.isPrivilegedCheckBox.Size = new System.Drawing.Size(80, 17);
     202      this.isPrivilegedCheckBox.TabIndex = 13;
     203      this.isPrivilegedCheckBox.Text = "IsPrivileged";
     204      this.isPrivilegedCheckBox.UseVisualStyleBackColor = true;
     205      this.isPrivilegedCheckBox.CheckedChanged += new System.EventHandler(this.isPrivilegedCheckBox_CheckedChanged);
     206      //
    194207      // HiveEngineView
    195208      //
    196209      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    197210      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     211      this.Controls.Add(this.isPrivilegedCheckBox);
    198212      this.Controls.Add(this.useLocalPluginsCheckBox);
    199213      this.Controls.Add(this.executionTimeTextBox);
     
    231245    private System.Windows.Forms.CheckBox useLocalPluginsCheckBox;
    232246    private HeuristicLab.Core.Views.LogView logView;
    233     private HiveExperimentListView hiveExperimentListView;
     247    private RefreshableHiveExperimentListView hiveExperimentListView;
     248    private System.Windows.Forms.CheckBox isPrivilegedCheckBox;
    234249  }
    235250}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine.Views/3.4/HiveEngineView.cs

    r6212 r6381  
    7474        executionTimeOnHiveTextBox.Text = string.Empty;
    7575        useLocalPluginsCheckBox.Checked = false;
     76        isPrivilegedCheckBox.Checked = false;
    7677        hiveExperimentListView.Content = null;
    7778        logView.Content = null;
     
    8182        executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString();
    8283        useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins;
     84        isPrivilegedCheckBox.Checked = Content.IsPrivileged;
    8385        hiveExperimentListView.Content = Content.HiveExperiments;
    8486        logView.Content = Content.Log;
     
    9395        priorityTextBox.ReadOnly = this.ReadOnly;
    9496        useLocalPluginsCheckBox.Enabled = !this.ReadOnly;
     97        isPrivilegedCheckBox.Enabled = !this.ReadOnly; // TODO: check for user rights
    9598      } else {
    9699        resourceIdsTextBox.ReadOnly = false;
    97100        priorityTextBox.ReadOnly = false;
    98101        useLocalPluginsCheckBox.Enabled = false;
     102        isPrivilegedCheckBox.Enabled = false;
    99103      }
    100104    }
     
    112116      Content.UseLocalPlugins = useLocalPluginsCheckBox.Checked;
    113117    }
     118
     119    private void isPrivilegedCheckBox_CheckedChanged(object sender, EventArgs e) {
     120      Content.IsPrivileged = isPrivilegedCheckBox.Checked;
     121    }
    114122    #endregion
    115 
    116 
    117123  }
    118124}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs

    r6373 r6381  
    7474    }
    7575
     76    [Storable]
     77    private bool isPrivileged;
     78    public bool IsPrivileged {
     79      get { return isPrivileged; }
     80      set { isPrivileged = value; }
     81    }
     82
    7683    // [Storable] -> HiveExperiment can't be storable, so RefreshableHiveExperiment can't be stored
    7784    private ItemCollection<RefreshableHiveExperiment> hiveExperiments = new ItemCollection<RefreshableHiveExperiment>();
     
    108115      this.executionTimeOnHive = original.executionTimeOnHive;
    109116      this.useLocalPlugins = original.useLocalPlugins;
     117      this.IsPrivileged = original.IsPrivileged;
    110118      // this.hiveExperiments = cloner.Clone(original.hiveExperiments); do not clone hiveExperiments - otherwise they would be sent with every job
    111119    }
     
    187195          //  }
    188196          //} else if (coll.Parallel) {
    189           if(coll.Parallel) {
     197          if (coll.Parallel) {
    190198            // clone the parent scope here and reuse it for each operation. otherwise for each job the whole scope-tree first needs to be copied and then cleaned, which causes a lot of work for the Garbage Collector
    191199            IScope parentScopeClone = (IScope)((IAtomicOperation)coll.First()).Scope.Parent.Clone();
     
    272280      IScope[] scopes = new Scope[jobs.Length];
    273281      object locker = new object();
    274       IDictionary<Guid, int> jobIndices = new Dictionary<Guid, int>();
    275282      var hiveExperiment = refreshableHiveExperiment.HiveExperiment;
    276283
    277284      try {
    278         List<Guid> remainingJobIds = new List<Guid>();
    279 
    280285        // create upload-tasks
    281         var uploadTasks = new List<Task<Job>>();
    282286        for (int i = 0; i < jobs.Length; i++) {
    283           hiveExperiment.HiveJobs.Add(new EngineHiveJob(jobs[i], parentScopeClone));
     287          var engineHiveJob = new EngineHiveJob(jobs[i], parentScopeClone);
     288          engineHiveJob.Job.Priority = this.Priority;
     289          hiveExperiment.HiveJobs.Add(engineHiveJob);
    284290
    285291          // shuffle random variable to avoid the same random sequence in each operation; todo: does not yet work (it cannot find the random variable)
     
    288294            random.Reset(random.Next());
    289295        }
    290         HiveClient.StartExperiment((e) => {
    291           LogException(e);
    292         }, refreshableHiveExperiment);
     296        HiveClient.StartExperiment((e) => { LogException(e); }, refreshableHiveExperiment);
    293297
    294298        // do polling until experiment is finished and all jobs are downloaded
    295299        while (!refreshableHiveExperiment.AllJobsFinished()) {
    296           Thread.Sleep(500);
     300          Thread.Sleep(2000);
    297301          this.ExecutionTimeOnHive = TimeSpan.FromMilliseconds(hiveExperiments.Sum(x => x.HiveExperiment.ExecutionTime.TotalMilliseconds));
    298302          cancellationToken.ThrowIfCancellationRequested();
    299303        }
    300304        LogMessage(string.Format("{0} finished (TotalExecutionTime: {1}).", refreshableHiveExperiment.ToString(), refreshableHiveExperiment.HiveExperiment.ExecutionTime));
     305
     306        var failedJobs = hiveExperiment.HiveJobs.Where(x => x.Job.State == JobState.Failed);
     307        if(failedJobs.Count() > 0) {
     308          throw new HiveEngineException("Job failed: " + failedJobs.First().Job.StateLog.Last().Exception);
     309        }
    301310
    302311        // get scopes
    303312        int j = 0;
    304313        foreach (var hiveJob in hiveExperiment.HiveJobs) {
    305           if (hiveJob.Job.State != JobState.Finished)
    306             throw new HiveEngineException("Job failed: " + hiveJob.Job.StateLog.Last().Exception);
    307 
    308314          var scope = ((IAtomicOperation)((EngineJob)hiveJob.ItemJob).InitialOperation).Scope;
    309315          scopes[j++] = scope;
     
    313319      catch (OperationCanceledException e) {
    314320        lock (locker) {
    315           if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id);
     321          DeleteHiveExperiment(hiveExperiment.Id);
    316322        }
    317323        throw e;
     
    319325      catch (Exception e) {
    320326        lock (locker) {
    321           if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id);
     327          DeleteHiveExperiment(hiveExperiment.Id);
    322328        }
    323329        LogException(e);
     
    333339        hiveExperiment.UseLocalPlugins = this.UseLocalPlugins;
    334340        hiveExperiment.ResourceNames = this.ResourceNames;
     341        hiveExperiment.IsPrivileged = this.IsPrivileged;
    335342        var refreshableHiveExperiment = new RefreshableHiveExperiment(hiveExperiment);
    336343        refreshableHiveExperiment.IsControllable = false;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests

    • Property svn:ignore
      •  

        old new  
        55HeuristicLab.HiveEngine-3.4.Tests.csproj.vs10x
        66Meta-GA - Meta Optimization Problem (Genetic Programming - Symbolic Regression 3.4 scaled)_small.hl
         7HeuristicLab.HiveEngine-3.4.ConsoleTests.csproj.user
         8HeuristicLab.HiveEngine-3.4.ConsoleTests.csproj.vs10x
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests/Program.cs

    r6373 r6381  
    4747      GeneticAlgorithm alg = new GeneticAlgorithm();
    4848      alg.Problem = new SingleObjectiveTestFunctionProblem();
    49       alg.Engine = new HiveEngine() { ResourceNames = "CHRISTOPH-PC" };
     49      alg.Engine = new HiveEngine() { ResourceNames = "HEAL" };
    5050      alg.Elites.Value = 0;
    5151      alg.PopulationSize.Value = 10;
Note: See TracChangeset for help on using the changeset viewer.