Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5793


Ignore:
Timestamp:
03/22/11 15:54:58 (12 years ago)
Author:
cneumuel
Message:

#1233

  • implemented correct downloading of paused jobs. its now also possible to change parameters and resume a algorithm
  • removed Prepare() calls in ExperimentManager and in slave, as it prevents corrent resuming of paused jobs
  • made events in ItemTreeView be invoked in the correct thread
  • reduced log output in ExperimentManager
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Core.cs

    r5789 r5793  
    159159        switch (container.Message) {
    160160          case MessageContainer.MessageType.CalculateJob:
    161             clientCom.LogMessage("Task.StartNew[0]: jobId: " + container.JobId);
    162161            Task.Factory.StartNew((jobIdObj) => {
    163162              Guid jobId = (Guid)jobIdObj;
    164               clientCom.LogMessage("Task.StartNew[1]: jobId: " + jobId);
    165163              Job job = wcfService.GetJob(jobId);
    166164              if (job == null) throw new JobNotFoundException(jobId);
     
    217215
    218216    private void DoPauseJob(Guid jobId) {
    219       Job job = Jobs[jobId];
    220 
    221       if (job != null) {
    222         engines[job.Id].Pause();
    223         JobData sJob = engines[job.Id].GetPausedJob();
    224         // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is paused
    225         job.ExecutionTime = engines[job.Id].ExecutionTime;
    226 
    227         try {
    228           clientCom.LogMessage("Sending the paused job with id: " + job.Id);
    229           wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused);
    230           SlaveStatusInfo.JobsProcessed++;    //TODO: count or not count, thats the question
    231         }
    232         catch (Exception e) {
    233           clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
    234         }
    235         finally {
    236           KillAppDomain(job.Id); // kill app-domain in every case         
    237         }
    238       }
    239     }
    240 
    241     private void DoStopJob(Guid guid) {
    242       Job job = Jobs[guid];
    243 
    244       if (job != null) {
    245         engines[job.Id].Stop();
    246         JobData sJob = engines[job.Id].GetFinishedJob();
    247         // job.Exception = engines[job.Id].CurrentException; // can there be an exception if a job is stopped regularly
    248         job.ExecutionTime = engines[job.Id].ExecutionTime;
    249 
    250         try {
    251           clientCom.LogMessage("Sending the stoppped job with id: " + job.Id);
    252           wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused);
    253           SlaveStatusInfo.JobsProcessed++;    //TODO: count or not count, thats the question
    254         }
    255         catch (Exception e) {
    256           clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
    257         }
    258         finally {
    259           KillAppDomain(job.Id); // kill app-domain in every case         
     217      if (!Jobs.ContainsKey(jobId)) {
     218        clientCom.LogMessage("DoPauseJob: Can't find job with id " + jobId);
     219      } else {
     220        Job job = Jobs[jobId];
     221
     222        if (job != null) {
     223          engines[job.Id].Pause();
     224          JobData sJob = engines[job.Id].GetPausedJob();
     225          job.ExecutionTime = engines[job.Id].ExecutionTime;
     226
     227          try {
     228            clientCom.LogMessage("Sending the paused job with id: " + job.Id);
     229            wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Paused);
     230            SlaveStatusInfo.JobsProcessed++;    //TODO: count or not count, thats the question
     231          }
     232          catch (Exception e) {
     233            clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
     234          }
     235          finally {
     236            KillAppDomain(job.Id); // kill app-domain in every case         
     237          }
     238        }
     239      }
     240    }
     241
     242    private void DoStopJob(Guid jobId) {
     243      if (!Jobs.ContainsKey(jobId)) {
     244        clientCom.LogMessage("DoStopJob: Can't find job with id " + jobId);
     245      } else {
     246        Job job = Jobs[jobId];
     247
     248        if (job != null) {
     249          engines[job.Id].Stop();
     250          JobData sJob = engines[job.Id].GetFinishedJob();
     251          job.ExecutionTime = engines[job.Id].ExecutionTime;
     252
     253          try {
     254            clientCom.LogMessage("Sending the stoppped job with id: " + job.Id);
     255            wcfService.UpdateJobData(job, sJob, ConfigManager.Instance.GetClientInfo().Id, JobState.Finished);
     256            SlaveStatusInfo.JobsProcessed++;    //TODO: count or not count, thats the question
     257          }
     258          catch (Exception e) {
     259            clientCom.LogMessage("Transmitting to server failed. Storing the paused job with id: " + job.Id + " to hdd (" + e.ToString() + ")");
     260          }
     261          finally {
     262            KillAppDomain(job.Id); // kill app-domain in every case         
     263          }
    260264        }
    261265      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Executor.cs

    r5789 r5793  
    7676          Job.Resume(childjobs.Select(j => PersistenceUtil.Deserialize<IJob>(j.Data)));
    7777        } else {
    78           Job.Prepare();
     78          // Job.Prepare(); // do NOT prepare here, otherwise paused jobs get restarted
    7979          Job.Start();
    8080        }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/Administration/MenuItems/AdministrationMenuItem.cs

    r5469 r5793  
    2727  public class AdministrationMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
    2828    public override string Name {
    29       get { return "& Administration"; }
     29      get { return "&Administration (dev)"; }
    3030    }
    3131    public override IEnumerable<string> Structure {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs

    r5779 r5793  
    7171    }
    7272
    73     void Content_OptimizerJobChanged(object sender, EventArgs e) {
     73    protected void Content_OptimizerJobChanged(object sender, EventArgs e) {
    7474      RegisterJobEvents();
    7575      Job_OptimizerChanged(this, e);
    7676    }
    7777
    78     void Job_OptimizerChanged(object sender, EventArgs e) {
     78    protected void Job_OptimizerChanged(object sender, EventArgs e) {
    7979      if (Content != null && Content.Job != null && Content.OptimizerJob.Optimizer != null) {
    8080        optimizerNamedItemView.Content = Content.OptimizerJob.Optimizer;
     
    130130          this.dateFinishedTextBox.Text = Content.Job.DateFinished.ToString();
    131131          this.exceptionTextBox.Text = Content.Job.CurrentStateLog != null ? Content.Job.CurrentStateLog.Exception : string.Empty;
     132          this.lastUpdatedTextBox.Text = Content.Job.LastJobDataUpdate.ToString();
    132133          if (Content.OptimizerJob.ComputeInParallel) {
    133134            this.stateLogViewHost.Content = new StateLogListList(
     
    144145          this.exceptionTextBox.Text = string.Empty;
    145146          this.stateLogViewHost.Content = null;
     147          this.lastUpdatedTextBox.Text = string.Empty;
    146148        }
    147149        SetEnabledStateOfControls();
     
    158160      this.dateFinishedTextBox.ReadOnly = true;
    159161      this.exceptionTextBox.ReadOnly = true;
     162      this.lastUpdatedTextBox.ReadOnly = true;
    160163
    161164      this.priorityTextBox.ReadOnly = this.ReadOnly;
     
    167170      this.pauseButton.Enabled = Content != null && Content.Job.State == JobState.Calculating;
    168171      this.stopButton.Enabled = Content != null && (Content.Job.State == JobState.Calculating || Content.Job.State == JobState.Waiting || Content.Job.State == JobState.Paused);
     172      this.showOptimizerButton.Enabled = Content != null && Content.Job.State == JobState.Paused && Content.OptimizerJob != null && Content.OptimizerJob.Optimizer != null;
    169173
    170174      optimizerNamedItemView.ReadOnly = true;
     
    204208      Content.Stop();
    205209    }
     210    private void showOptimizerButton_Click(object sender, EventArgs e) {
     211      MainFormManager.MainForm.ShowContent(Content.OptimizerJob.Optimizer);
     212    }
    206213  }
    207214}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.designer.cs

    r5779 r5793  
    3232      this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    3333      this.detailsTabPage = new System.Windows.Forms.TabPage();
     34      this.restartButton = new System.Windows.Forms.Button();
     35      this.pauseButton = new System.Windows.Forms.Button();
     36      this.stopButton = new System.Windows.Forms.Button();
    3437      this.optimizerGroupBox = new System.Windows.Forms.GroupBox();
     38      this.showOptimizerButton = new System.Windows.Forms.Button();
     39      this.lastUpdatedTextBox = new System.Windows.Forms.TextBox();
     40      this.lastUpdatedLabel = new System.Windows.Forms.Label();
    3541      this.optimizerNamedItemView = new HeuristicLab.Core.Views.NamedItemView();
    3642      this.configurationGroupBox = new System.Windows.Forms.GroupBox();
     
    5965      this.exceptionTextBox = new System.Windows.Forms.TextBox();
    6066      this.tabControl = new System.Windows.Forms.TabControl();
    61       this.restartButton = new System.Windows.Forms.Button();
    62       this.pauseButton = new System.Windows.Forms.Button();
    63       this.stopButton = new System.Windows.Forms.Button();
    6467      this.logTabPage.SuspendLayout();
    6568      this.stateLogTabPage.SuspendLayout();
     
    7881      this.logTabPage.Name = "logTabPage";
    7982      this.logTabPage.Padding = new System.Windows.Forms.Padding(3);
    80       this.logTabPage.Size = new System.Drawing.Size(406, 492);
     83      this.logTabPage.Size = new System.Drawing.Size(611, 492);
    8184      this.logTabPage.TabIndex = 1;
    8285      this.logTabPage.Text = "Log";
     
    125128      this.runsTabPage.Location = new System.Drawing.Point(4, 22);
    126129      this.runsTabPage.Name = "runsTabPage";
    127       this.runsTabPage.Size = new System.Drawing.Size(406, 492);
     130      this.runsTabPage.Size = new System.Drawing.Size(611, 492);
    128131      this.runsTabPage.TabIndex = 4;
    129132      this.runsTabPage.Text = "Runs";
     
    164167      this.detailsTabPage.UseVisualStyleBackColor = true;
    165168      //
     169      // restartButton
     170      //
     171      this.restartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     172      this.restartButton.Image = ((System.Drawing.Image)(resources.GetObject("restartButton.Image")));
     173      this.restartButton.Location = new System.Drawing.Point(3, 465);
     174      this.restartButton.Name = "restartButton";
     175      this.restartButton.Size = new System.Drawing.Size(24, 24);
     176      this.restartButton.TabIndex = 30;
     177      this.restartButton.UseVisualStyleBackColor = true;
     178      this.restartButton.Click += new System.EventHandler(this.restartButton_Click);
     179      //
     180      // pauseButton
     181      //
     182      this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     183      this.pauseButton.Enabled = false;
     184      this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));
     185      this.pauseButton.Location = new System.Drawing.Point(33, 465);
     186      this.pauseButton.Name = "pauseButton";
     187      this.pauseButton.Size = new System.Drawing.Size(24, 24);
     188      this.pauseButton.TabIndex = 31;
     189      this.pauseButton.UseVisualStyleBackColor = true;
     190      this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
     191      //
     192      // stopButton
     193      //
     194      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     195      this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));
     196      this.stopButton.Location = new System.Drawing.Point(63, 465);
     197      this.stopButton.Name = "stopButton";
     198      this.stopButton.Size = new System.Drawing.Size(24, 24);
     199      this.stopButton.TabIndex = 32;
     200      this.stopButton.UseVisualStyleBackColor = true;
     201      this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
     202      //
    166203      // optimizerGroupBox
    167204      //
    168205      this.optimizerGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    169206                  | System.Windows.Forms.AnchorStyles.Right)));
     207      this.optimizerGroupBox.Controls.Add(this.showOptimizerButton);
     208      this.optimizerGroupBox.Controls.Add(this.lastUpdatedTextBox);
     209      this.optimizerGroupBox.Controls.Add(this.lastUpdatedLabel);
    170210      this.optimizerGroupBox.Controls.Add(this.optimizerNamedItemView);
    171211      this.optimizerGroupBox.Location = new System.Drawing.Point(6, 29);
    172212      this.optimizerGroupBox.Name = "optimizerGroupBox";
    173       this.optimizerGroupBox.Size = new System.Drawing.Size(599, 74);
     213      this.optimizerGroupBox.Size = new System.Drawing.Size(599, 129);
    174214      this.optimizerGroupBox.TabIndex = 28;
    175215      this.optimizerGroupBox.TabStop = false;
    176216      this.optimizerGroupBox.Text = "Optimizer";
     217      //
     218      // showOptimizerButton
     219      //
     220      this.showOptimizerButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     221                  | System.Windows.Forms.AnchorStyles.Right)));
     222      this.showOptimizerButton.Location = new System.Drawing.Point(12, 99);
     223      this.showOptimizerButton.Name = "showOptimizerButton";
     224      this.showOptimizerButton.Size = new System.Drawing.Size(581, 23);
     225      this.showOptimizerButton.TabIndex = 3;
     226      this.showOptimizerButton.Text = "Show Optimizer";
     227      this.showOptimizerButton.UseVisualStyleBackColor = true;
     228      this.showOptimizerButton.Click += new System.EventHandler(this.showOptimizerButton_Click);
     229      //
     230      // lastUpdatedTextBox
     231      //
     232      this.lastUpdatedTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     233                  | System.Windows.Forms.AnchorStyles.Right)));
     234      this.lastUpdatedTextBox.Location = new System.Drawing.Point(78, 73);
     235      this.lastUpdatedTextBox.Name = "lastUpdatedTextBox";
     236      this.lastUpdatedTextBox.Size = new System.Drawing.Size(515, 20);
     237      this.lastUpdatedTextBox.TabIndex = 2;
     238      //
     239      // lastUpdatedLabel
     240      //
     241      this.lastUpdatedLabel.AutoSize = true;
     242      this.lastUpdatedLabel.Location = new System.Drawing.Point(9, 76);
     243      this.lastUpdatedLabel.Name = "lastUpdatedLabel";
     244      this.lastUpdatedLabel.Size = new System.Drawing.Size(71, 13);
     245      this.lastUpdatedLabel.TabIndex = 1;
     246      this.lastUpdatedLabel.Text = "LastUpdated:";
    177247      //
    178248      // optimizerNamedItemView
     
    200270      this.configurationGroupBox.Controls.Add(this.computeInParallelLabel);
    201271      this.configurationGroupBox.Controls.Add(this.computeInParallelCheckBox);
    202       this.configurationGroupBox.Location = new System.Drawing.Point(6, 106);
     272      this.configurationGroupBox.Location = new System.Drawing.Point(6, 164);
    203273      this.configurationGroupBox.Name = "configurationGroupBox";
    204274      this.configurationGroupBox.Size = new System.Drawing.Size(599, 119);
     
    314384      this.jobStatusGroupBox.Controls.Add(this.dateFinishedLabel);
    315385      this.jobStatusGroupBox.Controls.Add(this.exceptionTextBox);
    316       this.jobStatusGroupBox.Location = new System.Drawing.Point(6, 226);
     386      this.jobStatusGroupBox.Location = new System.Drawing.Point(6, 289);
    317387      this.jobStatusGroupBox.Name = "jobStatusGroupBox";
    318388      this.jobStatusGroupBox.Size = new System.Drawing.Size(599, 162);
     
    444514      this.tabControl.Size = new System.Drawing.Size(619, 518);
    445515      this.tabControl.TabIndex = 25;
    446       //
    447       // restartButton
    448       //
    449       this.restartButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    450       this.restartButton.Image = ((System.Drawing.Image)(resources.GetObject("restartButton.Image")));
    451       this.restartButton.Location = new System.Drawing.Point(3, 465);
    452       this.restartButton.Name = "restartButton";
    453       this.restartButton.Size = new System.Drawing.Size(24, 24);
    454       this.restartButton.TabIndex = 30;
    455       this.restartButton.UseVisualStyleBackColor = true;
    456       this.restartButton.Click += new System.EventHandler(this.restartButton_Click);
    457       //
    458       // pauseButton
    459       //
    460       this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    461       this.pauseButton.Enabled = false;
    462       this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));
    463       this.pauseButton.Location = new System.Drawing.Point(33, 465);
    464       this.pauseButton.Name = "pauseButton";
    465       this.pauseButton.Size = new System.Drawing.Size(24, 24);
    466       this.pauseButton.TabIndex = 31;
    467       this.pauseButton.UseVisualStyleBackColor = true;
    468       this.pauseButton.Click += new System.EventHandler(this.pauseButton_Click);
    469       //
    470       // stopButton
    471       //
    472       this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    473       this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));
    474       this.stopButton.Location = new System.Drawing.Point(63, 465);
    475       this.stopButton.Name = "stopButton";
    476       this.stopButton.Size = new System.Drawing.Size(24, 24);
    477       this.stopButton.TabIndex = 32;
    478       this.stopButton.UseVisualStyleBackColor = true;
    479       this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
    480516      //
    481517      // HiveJobView
     
    492528      this.detailsTabPage.PerformLayout();
    493529      this.optimizerGroupBox.ResumeLayout(false);
     530      this.optimizerGroupBox.PerformLayout();
    494531      this.configurationGroupBox.ResumeLayout(false);
    495532      this.configurationGroupBox.PerformLayout();
     
    525562    private System.Windows.Forms.GroupBox jobStatusGroupBox;
    526563    private System.Windows.Forms.TextBox stateTextBox;
    527     private System.Windows.Forms.Label dateCalculatedLabel;
    528564    private System.Windows.Forms.Label stateLabel;
    529     private System.Windows.Forms.TextBox dateCalculatedText;
    530565    private System.Windows.Forms.TextBox dateFinishedTextBox;
    531566    private System.Windows.Forms.TextBox executionTimeTextBox;
    532     private System.Windows.Forms.TextBox dateCreatedTextBox;
    533567    private System.Windows.Forms.Label executionTimeLabel;
    534568    private System.Windows.Forms.Label exceptionLabel;
    535     private System.Windows.Forms.Label dateCreatedLabel;
    536569    private System.Windows.Forms.Label dateFinishedLabel;
    537570    private System.Windows.Forms.TextBox exceptionTextBox;
     
    540573    private System.Windows.Forms.Button pauseButton;
    541574    private System.Windows.Forms.Button stopButton;
     575    private System.Windows.Forms.Button showOptimizerButton;
     576    private System.Windows.Forms.TextBox lastUpdatedTextBox;
     577    private System.Windows.Forms.Label lastUpdatedLabel;
     578    private System.Windows.Forms.Label dateCalculatedLabel;
     579    private System.Windows.Forms.TextBox dateCalculatedText;
     580    private System.Windows.Forms.TextBox dateCreatedTextBox;
     581    private System.Windows.Forms.Label dateCreatedLabel;
    542582
    543583  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.cs

    r5779 r5793  
    5252      item.ItemsRemoved -= new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved);
    5353      item.CollectionReset -= new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset);
    54       item.ToStringChanged -= new System.EventHandler(item_ToStringChanged);
     54      item.ToStringChanged -= new EventHandler(item_ToStringChanged);
    5555      item.ItemImageChanged -= new EventHandler(item_ItemImageChanged);
    5656      foreach (TreeNode childNode in node.Nodes) {
     
    7070      item.ItemsRemoved += new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved);
    7171      item.CollectionReset += new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset);
    72       item.ToStringChanged += new System.EventHandler(item_ToStringChanged);
     72      item.ToStringChanged += new EventHandler(item_ToStringChanged);
    7373      item.ItemImageChanged += new EventHandler(item_ItemImageChanged);
    7474      foreach (TreeNode childNode in node.Nodes) {
     
    7878
    7979    #region Event Handlers (Content)
    80     // Put event handlers of the content here
     80    private void item_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
     81      if (InvokeRequired) {
     82        Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsAdded), sender, e);
     83      } else {
     84        TreeNode node = GetNodeByItem(sender as IItemTree);
     85        foreach (IItemTree item in e.Items) {
     86          AddChildNodes(item, node.Nodes, true);
     87          node.ExpandAll();
     88          UpdateNodeItemImage(node);
     89        }
     90      }
     91    }
     92
     93    private void item_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
     94      if (InvokeRequired) {
     95        Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved), sender, e);
     96      } else {
     97        TreeNode node = GetNodeByItem(sender as IItemTree);
     98        foreach (IItemTree item in e.Items) {
     99          RemoveChildNodes(item, node.Nodes);
     100        }
     101        RebuildImageList();
     102      }
     103    }
     104
     105    private void item_CollectionReset(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
     106      if (InvokeRequired) {
     107        Invoke(new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset), sender, e);
     108      } else {
     109        TreeNode node = GetNodeByItem(sender as IItemTree);
     110        foreach (IItemTree item in e.OldItems) {
     111          RemoveChildNodes(item, node.Nodes);
     112        }
     113        RebuildImageList();
     114        foreach (IItemTree item in e.Items) {
     115          AddChildNodes(item, node.Nodes, true);
     116        }
     117      }
     118    }
     119
     120    private void item_ToStringChanged(object sender, EventArgs e) {
     121      if (InvokeRequired) {
     122        Invoke(new EventHandler(item_ToStringChanged), sender, e);
     123      } else {
     124        var item = sender as IItemTree;
     125        TreeNode node = GetNodeByItem(item);
     126        node.Text = item.ToString();
     127      }
     128    }
     129
     130    private void item_ItemImageChanged(object sender, EventArgs e) {
     131      if (InvokeRequired) {
     132        Invoke(new EventHandler(item_ItemImageChanged), sender, e);
     133      } else {
     134        var item = sender as IItemTree;
     135        TreeNode node = GetNodeByItem(item);
     136        UpdateNodeItemImage(node);
     137      }
     138    }
     139
     140    private void treeView_DoubleClick(object sender, EventArgs e) {
     141      if (InvokeRequired) {
     142        Invoke(new EventHandler(treeView_DoubleClick), sender, e);
     143      } else {
     144        if (treeView.SelectedNode != null) {
     145          var item = treeView.SelectedNode.Tag as IItemTree;
     146          if (item != null) {
     147            IContentView view = MainFormManager.MainForm.ShowContent(item);
     148            if (view != null) {
     149              view.ReadOnly = ReadOnly;
     150              view.Locked = Locked;
     151            }
     152          }
     153        }
     154      }
     155    }
    81156    #endregion
    82157
     
    86161        // Add code when content has been changed and is null
    87162        ClearNodes();
     163        detailsViewHost.Content = null;
    88164      } else {
    89165        // Add code when content has been changed and is not null
     
    122198      treeNodeCollection.RemoveAt(idx);
    123199    }
    124 
    125     private void item_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
    126       TreeNode node = GetNodeByItem(sender as IItemTree);
    127       foreach (IItemTree item in e.Items) {
    128         AddChildNodes(item, node.Nodes, true);
    129         node.ExpandAll();
    130         UpdateNodeItemImage(node);
    131       }
    132     }
    133 
    134     private void item_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
    135       TreeNode node = GetNodeByItem(sender as IItemTree);
    136       foreach (IItemTree item in e.Items) {
    137         RemoveChildNodes(item, node.Nodes);
    138       }
    139       RebuildImageList();
    140     }
    141 
    142     private void item_CollectionReset(object sender, CollectionItemsChangedEventArgs<IItemTree> e) {
    143       TreeNode node = GetNodeByItem(sender as IItemTree);
    144       foreach (IItemTree item in e.OldItems) {
    145         RemoveChildNodes(item, node.Nodes);
    146       }
    147       RebuildImageList();
    148       foreach (IItemTree item in e.Items) {
    149         AddChildNodes(item, node.Nodes, true);
    150       }
    151     }
    152 
    153     private void item_ToStringChanged(object sender, EventArgs e) {
    154       var item = sender as IItemTree;
    155       TreeNode node = GetNodeByItem(item);
    156       node.Text = item.ToString();
    157     }
    158 
    159     private void item_ItemImageChanged(object sender, EventArgs e) {
    160       var item = sender as IItemTree;
    161       TreeNode node = GetNodeByItem(item);
    162       UpdateNodeItemImage(node);
    163     }
    164 
     200   
    165201    private TreeNode GetNodeByItem(IItemTree item) {
    166202      TreeNode found = null;
     
    212248    // Put event handlers of child controls here.
    213249    private void treeView_AfterSelect(object sender, TreeViewEventArgs e) {
    214       viewHost.Content = (IContent)treeView.SelectedNode.Tag;
     250      detailsViewHost.Content = (IContent)treeView.SelectedNode.Tag;
    215251    }
    216252    #endregion
     
    232268      }
    233269    }
    234 
    235     private void treeView_DoubleClick(object sender, EventArgs e) {
    236       if (treeView.SelectedNode != null) {
    237         var item = treeView.SelectedNode.Tag as IItemTree;
    238         if (item != null) {
    239           IContentView view = MainFormManager.MainForm.ShowContent(item);
    240           if (view != null) {
    241             view.ReadOnly = ReadOnly;
    242             view.Locked = Locked;
    243           }
    244         }
    245       }
    246     }
    247270  }
    248271}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.designer.cs

    r5779 r5793  
    2929      this.imageList = new System.Windows.Forms.ImageList(this.components);
    3030      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
    31       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     31      this.detailsViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    3232      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    3333      this.splitContainer.Panel1.SuspendLayout();
     
    7777      // detailsGroupBox
    7878      //
    79       this.detailsGroupBox.Controls.Add(this.viewHost);
     79      this.detailsGroupBox.Controls.Add(this.detailsViewHost);
    8080      this.detailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    8181      this.detailsGroupBox.Location = new System.Drawing.Point(0, 0);
     
    8686      this.detailsGroupBox.Text = "Details";
    8787      //
    88       // viewHost
     88      // detailsViewHost
    8989      //
    90       this.viewHost.Caption = "View";
    91       this.viewHost.Content = null;
    92       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    93       this.viewHost.Enabled = false;
    94       this.viewHost.Location = new System.Drawing.Point(3, 16);
    95       this.viewHost.Name = "viewHost";
    96       this.viewHost.ReadOnly = false;
    97       this.viewHost.Size = new System.Drawing.Size(414, 444);
    98       this.viewHost.TabIndex = 0;
    99       this.viewHost.ViewsLabelVisible = true;
    100       this.viewHost.ViewType = null;
     90      this.detailsViewHost.Caption = "View";
     91      this.detailsViewHost.Content = null;
     92      this.detailsViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
     93      this.detailsViewHost.Enabled = false;
     94      this.detailsViewHost.Location = new System.Drawing.Point(3, 16);
     95      this.detailsViewHost.Name = "detailsViewHost";
     96      this.detailsViewHost.ReadOnly = false;
     97      this.detailsViewHost.Size = new System.Drawing.Size(414, 444);
     98      this.detailsViewHost.TabIndex = 0;
     99      this.detailsViewHost.ViewsLabelVisible = true;
     100      this.detailsViewHost.ViewType = null;
    101101      //
    102102      // ItemTreeView
     
    119119    private System.Windows.Forms.SplitContainer splitContainer;
    120120    private System.Windows.Forms.TreeView treeView;
    121     private MainForm.WindowsForms.ViewHost viewHost;
     121    private MainForm.WindowsForms.ViewHost detailsViewHost;
    122122    private System.Windows.Forms.ImageList imageList;
    123123    private System.Windows.Forms.GroupBox detailsGroupBox;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/MenuItems/ExperimentManagerMenuItem.cs

    r5512 r5793  
    2727  public class ExperimentManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
    2828    public override string Name {
    29       get { return "&Experiment Manager 3.4"; }
     29      get { return "&Experiment Manager (dev)"; }
    3030    }
    3131    public override IEnumerable<string> Structure {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveExperimentClient.cs

    r5786 r5793  
    495495      jobResultPoller.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured);
    496496      jobResultPoller.JobResultsReceived += new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived);
    497       jobResultPoller.PollingStarted += new EventHandler(jobResultPoller_PollingStarted);
    498       jobResultPoller.PollingFinished += new EventHandler(jobResultPoller_PollingFinished);
    499497      jobResultPoller.IsPollingChanged += new EventHandler(jobResultPoller_IsPollingChanged);
    500498    }
     
    502500      jobResultPoller.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(jobResultPoller_ExceptionOccured);
    503501      jobResultPoller.JobResultsReceived -= new EventHandler<EventArgs<IEnumerable<LightweightJob>>>(jobResultPoller_JobResultReceived);
    504       jobResultPoller.PollingStarted -= new EventHandler(jobResultPoller_PollingStarted);
    505       jobResultPoller.PollingFinished -= new EventHandler(jobResultPoller_PollingFinished);
    506502      jobResultPoller.IsPollingChanged -= new EventHandler(jobResultPoller_IsPollingChanged);
    507503    }
    508504    private void jobResultPoller_IsPollingChanged(object sender, EventArgs e) {
    509505      this.IsPollingResults = jobResultPoller.IsPolling;
    510     }
    511     private void jobResultPoller_PollingFinished(object sender, EventArgs e) {
    512       LogMessage("Polling results finished");
    513     }
    514     private void jobResultPoller_PollingStarted(object sender, EventArgs e) {
    515       LogMessage("Polling results started");
    516506    }
    517507    private void jobResultPoller_JobResultReceived(object sender, EventArgs<IEnumerable<LightweightJob>> e) {
     
    527517            OptimizerJob optimizerJob = LoadOptimizerJob(hj.Job.Id);
    528518            if (optimizerJob == null) {
    529               // something bad happened to this job. set to finished to allow the rest beeing downloaded
    530               //hj.IsFinishedOptimizerDownloaded = true;
     519              // something bad happened to this job. bad job, BAAAD job!
    531520            } else {
    532521              // if the job is paused, download but don't integrate into parent optimizer (to avoid Prepare)
    533522              if (hj.Job.State == JobState.Paused) {
    534                
     523                hj.OptimizerJob = optimizerJob;
    535524              } else {
    536525                if (lightweightJob.ParentJobId.HasValue) {
    537526                  HiveJob parentHiveJob = HiveJob.GetHiveJobByJobId(lightweightJob.ParentJobId.Value);
    538527                  parentHiveJob.UpdateChildOptimizer(optimizerJob, hj.Job.Id);
    539                 } else {
    540                   //this.HiveJob.IsFinishedOptimizerDownloaded = true;
    541528                }
    542529              }
     
    554541
    555542    private bool AllJobsFinished() {
    556       //return HiveJob.GetAllHiveJobs().All(hj => hj.IsFinishedOptimizerDownloaded);
    557543      return HiveJob.GetAllHiveJobs().All(j => j.Job.State == JobState.Finished
    558544                                            || j.Job.State == JobState.Aborted
     
    623609        this.HiveJob = allHiveJobs[this.rootJobId];
    624610
    625 
    626         //// download them first
    627         //IDictionary<Guid, Job> allJobs = new Dictionary<Guid, Job>();
    628         //IDictionary<Guid, JobData> allJobDatas = new Dictionary<Guid, JobData>();
    629         //foreach (LightweightJob lightweightJob in allResults) {
    630         //  jobCount++;
    631         //  progress.Status = string.Format("Downloading {0} of {1} jobs...", jobCount, totalJobCount);
    632         //  allJobs.Add(lightweightJob.Id, service.GetJob(lightweightJob.Id));
    633         //  allJobDatas.Add(lightweightJob.Id, service.GetJobData(lightweightJob.Id));
    634         //  progress.ProgressValue = (double)jobCount / totalJobCount;
    635         //}
    636 
    637         //jobCount = 1;
    638         //progress.Status = string.Format("Deserializing {0} of {1} jobs... ({2} kb)", jobCount, totalJobCount, allJobDatas[this.rootJobId].Data.Count() / 1024);
    639         //this.HiveJob = new HiveJob(allJobs[this.rootJobId], allJobDatas[this.rootJobId], false);
    640         //allJobDatas.Remove(this.rootJobId); // reduce memory footprint
    641         //allJobs.Remove(this.rootJobId);
    642         //progress.ProgressValue = (double)jobCount / totalJobCount;
    643 
    644 
    645611        if (this.HiveJob.Job.DateFinished.HasValue && this.HiveJob.Job.DateCreated.HasValue) {
    646612          this.ExecutionTime = this.HiveJob.Job.DateFinished.Value - this.HiveJob.Job.DateCreated.Value;
     
    656622
    657623        // build child-job tree
    658         //LoadChildResults(service, this.HiveJob, allResults, allJobs, allJobDatas, progress, totalJobCount, ref jobCount);
    659624        BuildHiveJobTree(this.HiveJob, allJobs, allHiveJobs);
    660625        StartResultPolling();
     
    739704      return pluginDatas;
    740705    }
    741 
    742     /// <summary>
    743     /// Gets the Ids of all plugins needed for executing the job.
    744     /// All loaded plugins are assumed to be necessary.
    745     /// If a plugin with the same name and version is already online, it is used. Otherwise the local plugin is uploaded.
    746     /// If useLocalPlugins is true, all local plugins are uploaded regardless of the existence of the same plugin online.
    747     /// </summary>
    748     //public static List<Guid> GetPluginsNeededIds(bool useLocalPlugins) {
    749     //  IEnumerable<IPluginDescription> localPlugins = ApplicationManager.Manager.Plugins;
    750     //  List<Guid> pluginsNeededIds = new List<Guid>();
    751 
    752     //  using (var service = ServiceLocator.Instance.GetService()) {
    753     //    IEnumerable<Plugin> onlinePlugins = service.Obj.GetPlugins();
    754 
    755     //    foreach (IPluginDescription localPlugin in localPlugins) {
    756     //      Plugin found = onlinePlugins.Where(onlinePlugin => onlinePlugin.Name == localPlugin.Name && onlinePlugin.Version == localPlugin.Version).SingleOrDefault();
    757     //      if (!useLocalPlugins && found != null) {
    758     //        // plugin is available online; reuse
    759     //        pluginsNeededIds.Add(found.Id);
    760     //      } else {
    761     //        // upload the plugin
    762     //        Plugin p = new Plugin() { Name = localPlugin.Name, Version = localPlugin.Version, IsLocal = useLocalPlugins };
    763     //        List<PluginData> pluginDatas = new List<PluginData>();
    764 
    765     //        foreach (IPluginFile pf in localPlugin.Files) {
    766     //          PluginData pluginData = new PluginData();
    767 
    768     //          pluginData.Data = File.ReadAllBytes(pf.Name);
    769     //          pluginDatas.Add(pluginData);
    770     //        }
    771     //        pluginsNeededIds.Add(service.Obj.AddPlugin(p, pluginDatas));
    772     //      }
    773     //    }
    774     //  }
    775     //  return pluginsNeededIds;
    776     //}
    777706    #endregion
    778707
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobClient.cs

    r5786 r5793  
    7070    public OptimizerJob OptimizerJob {
    7171      get { return optimizerJob; }
    72       private set {
     72      internal set {
    7373        if (optimizerJob != null && syncJobsWithOptimizers) {
    7474          this.childHiveJobs.Clear();
     
    289289      syncJobsWithOptimizers = false;
    290290      if (this.OptimizerJob != null && hiveJob.OptimizerJob != null) {
     291        // if job is in state Paused, it has to preserve its ResultCollection, which is cleared when a optimizer is added to an experiment
     292        OptimizerJob optimizerJobClone = null;
     293        if (hiveJob.Job.State == JobState.Paused) {
     294          optimizerJobClone = (OptimizerJob)hiveJob.OptimizerJob.Clone();
     295        }
     296
    291297        if (this.OptimizerJob.Optimizer is Optimization.Experiment) {
    292298          if (!this.OptimizerJob.OptimizerAsExperiment.Optimizers.Contains(hiveJob.OptimizerJob.Optimizer)) {
     
    295301        } else if (this.OptimizerJob.Optimizer is Optimization.BatchRun) {
    296302          UpdateOptimizerInBatchRun(this.OptimizerJob.OptimizerAsBatchRun, hiveJob.OptimizerJob);
     303        }
     304
     305        if (hiveJob.Job.State == JobState.Paused) {
     306          hiveJob.OptimizerJob = optimizerJobClone;
    297307        }
    298308      }
     
    524534    private void OnOptimizerJobChanged() {
    525535      OptimizerJob_ComputeInParallelChanged(this, EventArgs.Empty);
    526       var handler = JobChanged;
     536      var handler = OptimizerJobChanged;
    527537      if (handler != null) handler(this, EventArgs.Empty);
    528538    }
     
    649659
    650660    public void Restart() {
    651       ServiceLocator.Instance.CallHiveService(s => s.RestartJob(this.job.Id));
     661      ServiceLocator.Instance.CallHiveService(service => {
     662        JobData jobData = new JobData();
     663        jobData.JobId = this.job.Id;
     664        jobData.Data = PersistenceUtil.Serialize(this.optimizerJob);
     665        service.UpdateJobData(this.Job, jobData);
     666        service.RestartJob(this.job.Id);
     667        Job job = service.GetJob(this.job.Id);
     668        this.job.LastJobDataUpdate = job.LastJobDataUpdate;
     669      });
    652670    }
    653671  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ExperimentManager/HiveJobDownloader.cs

    r5599 r5793  
    8888        HiveJob hiveJob = new HiveJob(job, jobData, false);
    8989        jobData.Data = null; // reduce memory consumption.
    90         hiveJob.OptimizerJob.Prepare(); // reduce memory consumption.
    9190        hiveJob.Job = job;
    9291        return hiveJob;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs

    r5779 r5793  
    22using System.Collections.Generic;
    33using System.Linq;
     4using System.Security.Permissions;
    45using System.ServiceModel;
    56using HeuristicLab.Services.Hive.Common;
     
    3233
    3334    #region Job Methods
    34     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    35     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     35    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     36    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    3637    public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) {
    3738      return trans.UseTransaction(() => {
     
    5253    }
    5354
    54     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    55     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     55    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     56    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    5657    public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
    5758      return trans.UseTransaction(() => {
     
    6162    }
    6263
    63     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    64     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    65     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     64    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     65    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     66    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    6667    public Job GetJob(Guid jobId) {
    6768      return dao.GetJob(jobId);
    6869    }
    6970
    70     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    71     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     71    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     72    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    7273    public IEnumerable<Job> GetJobs() {
    7374      return dao.GetJobs(x => true);
    7475    }
    7576
    76     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    77     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     77    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     78    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    7879    public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) {
    7980      return dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray();
    8081    }
    8182
    82     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    83     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     83    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     84    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    8485    public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
    8586      return GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray();
    8687    }
    8788
    88     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    89     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    90     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     89    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     90    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     91    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    9192    public JobData GetJobData(Guid jobId) {
    9293      return dao.GetJobData(jobId);
    9394    }
    9495
    95     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    96     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    97     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     96    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     97    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     98    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    9899    public void UpdateJob(Job job) {
    99100      trans.UseTransaction(() => {
     
    102103    }
    103104
    104     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    105     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    106     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     105    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     106    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     107    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    107108    public void UpdateJobData(Job job, JobData jobData) {
    108109      trans.UseTransaction(() => {
     
    113114    }
    114115
    115     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    116     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    117     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     116    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     117    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     118    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    118119    public void DeleteJob(Guid jobId) {
    119120      trans.UseTransaction(() => {
     
    122123    }
    123124
    124     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    125     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    126     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     125    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     126    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     127    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    127128    public void DeleteChildJobs(Guid parentJobId) {
    128129      trans.UseTransaction(() => {
     
    135136    }
    136137
    137     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    138     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    139     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     138    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     139    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     140    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    140141    public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {
    141142      return trans.UseTransaction(() => {
     
    155156
    156157    #region Job Control Methods
    157     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    158     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    159     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     158    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     159    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     160    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    160161    public void StopJob(Guid jobId) {
    161162      trans.UseTransaction(() => {
     
    167168    }
    168169
    169     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    170     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    171     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     170    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     171    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     172    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    172173    public void PauseJob(Guid jobId) {
    173174      trans.UseTransaction(() => {
     
    179180    }
    180181
    181     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    182     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    183     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     182    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     183    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     184    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    184185    public void RestartJob(Guid jobId) {
    185186      trans.UseTransaction(() => {
     
    192193
    193194    #region HiveExperiment Methods
    194     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    195     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     195    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     196    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    196197    public HiveExperiment GetHiveExperiment(Guid id) {
    197198      return dao.GetHiveExperiments(x =>
     
    201202    }
    202203
    203     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    204     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     204    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     205    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    205206    public IEnumerable<HiveExperiment> GetHiveExperiments() {
    206207      return dao.GetHiveExperiments(x => x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0);
    207208    }
    208209
    209     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]   
     210    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]   
    210211    public IEnumerable<HiveExperiment> GetAllHiveExperiments() {
    211212      return dao.GetHiveExperiments(x => true);
    212213    }
    213214
    214     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    215     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     215    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     216    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    216217    public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
    217218      return trans.UseTransaction(() => {
     
    222223    }
    223224
    224     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    225     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     225    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     226    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    226227    public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
    227228      trans.UseTransaction(() => {
     
    230231    }
    231232
    232     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    233     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     233    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     234    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    234235    public void DeleteHiveExperiment(Guid hiveExperimentId) {
    235236      trans.UseTransaction(() => {
     
    241242
    242243    #region Login Methods
    243     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     244    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    244245    public void Hello(Slave slaveInfo) {
    245246      trans.UseTransaction(() => {
     
    254255    }
    255256
    256     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     257    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    257258    public void GoodBye(Guid slaveId) {
    258259      trans.UseTransaction(() => {
     
    267268
    268269    #region Heartbeat Methods
    269     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     270    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    270271    public List<MessageContainer> Heartbeat(Heartbeat heartbeat) {
    271272      TriggerLifecycle(false);
     
    275276
    276277    #region Plugin Methods
    277     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    278     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     278    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     279    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    279280    public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) {
    280281      return trans.UseTransaction(() => {
     
    290291    }
    291292
    292     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    293     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    294     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     293    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     294    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     295    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    295296    public IEnumerable<Plugin> GetPlugins() {
    296297      return dao.GetPlugins(x => x.IsLocal == false);
    297298    }
    298299
    299     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    300     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    301     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
     300    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     301    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     302    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]
    302303    public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) {
    303304      List<PluginData> pluginDatas = new List<PluginData>();
     
    319320
    320321    #region Slave Methods
    321     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    322     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     322    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     323    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    323324    public Guid AddSlave(Slave slave) {
    324325      return trans.UseTransaction(() => dao.AddSlave(slave));
    325326    }
    326327
    327     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    328     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     328    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     329    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    329330    public Guid AddSlaveGroup(SlaveGroup slaveGroup) {
    330331      return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
    331332    }
    332333
    333     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    334     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     334    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     335    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    335336    public Slave GetSlave(Guid slaveId) {
    336337      return dao.GetSlave(slaveId);
     
    341342    }
    342343
    343     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    344     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     344    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     345    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    345346    public IEnumerable<Slave> GetSlaves() {
    346347      return dao.GetSlaves(x => true);
    347348    }
    348349
    349     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    350     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     350    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     351    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    351352    public IEnumerable<SlaveGroup> GetSlaveGroups() {
    352353      return dao.GetSlaveGroups(x => true);
    353354    }
    354355
    355     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    356     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     356    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     357    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    357358    public void UpdateSlave(Slave slave) {
    358359      trans.UseTransaction(() => {
     
    361362    }
    362363
    363     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    364     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     364    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     365    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    365366    public void UpdateSlaveGroup(SlaveGroup slaveGroup) {
    366367      trans.UseTransaction(() => {
     
    369370    }
    370371
    371     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    372     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     372    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     373    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    373374    public void DeleteSlave(Guid slaveId) {
    374375      trans.UseTransaction(() => {
     
    377378    }
    378379
    379     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    380     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     380    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     381    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    381382    public void DeleteSlaveGroup(Guid slaveGroupId) {
    382383      trans.UseTransaction(() => {
     
    385386    }
    386387
    387     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    388     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     388    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     389    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    389390    public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) {
    390391      trans.UseTransaction(() => {
     
    395396    }
    396397
    397     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    398     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     398    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     399    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    399400    public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) {
    400401      trans.UseTransaction(() => {
     
    405406    }
    406407
    407     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    408     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
     408    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     409    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]
    409410    public Guid GetResourceId(string resourceName) {
    410411      return trans.UseTransaction(() => {
     
    450451    #region Appointment Methods
    451452
    452     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     453    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    453454    public Guid AddAppointment(Appointment appointment) {
    454455      return trans.UseTransaction(() => dao.AddAppointment(appointment));
    455456    }
    456457
    457     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     458    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    458459    public void DeleteAppointment(Guid appointmentId) {
    459460      trans.UseTransaction(() => {
     
    462463    }
    463464
    464     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     465    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    465466    public void UpdateAppointment(Appointment appointment) {
    466467      trans.UseTransaction(() => {
     
    469470    }
    470471
    471     // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
     472    [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]
    472473    public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) {
    473474      return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
Note: See TracChangeset for help on using the changeset viewer.