Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/11 13:43:05 (14 years ago)
Author:
cneumuel
Message:

#1233

  • changed relationship between Job and HiveExperiment. There is no more HiveExperiment.RootJobId, instead there is Job.HiveExperimentId.
  • One HiveExperiment can now have multiple Experiments.
  • TreeView supports multiple root nodes
  • HiveEngine creates a HiveExperiment for each set of jobs, so jobs cannot be without an parent experiment anymore (no more loose jobs)
  • updated ExperimentManager binaries
Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
1 deleted
7 edited

Legend:

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

    • Property svn:ignore
      •  

        old new  
        44PrecompiledWeb
        55CreateEventLogSources
         6WindowsFormsTestProject
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4

    • Property svn:ignore
      •  

        old new  
        22obj
        33HeuristicLab.HiveEngine-3.4.csproj.vs10x
         4HeuristicLabHiveEnginePlugin.cs
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HeuristicLab.HiveEngine-3.4.csproj

    r5958 r6006  
    104104    <Reference Include="HeuristicLab.Clients.Common-3.3">
    105105      <HintPath>..\..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Clients.Common-3.3.dll</HintPath>
     106    </Reference>
     107    <Reference Include="HeuristicLab.Clients.Hive.Views-3.4">
     108      <HintPath>..\..\HeuristicLab.Clients.Hive.Views\3.4\obj\Debug\HeuristicLab.Clients.Hive.Views-3.4.dll</HintPath>
    106109    </Reference>
    107110    <Reference Include="HeuristicLab.Collections-3.3">
     
    162165    <Compile Include="HiveEngine.cs" />
    163166    <Compile Include="Exceptions\HiveEngineException.cs" />
    164     <Compile Include="Properties\AssemblyInfo.cs" />
    165     <None Include="Properties\AssemblyInfo.frame" />
     167    <None Include="Properties\AssemblyInfo.cs.frame" />
    166168  </ItemGroup>
    167169  <ItemGroup>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/HiveEngine.cs

    r6000 r6006  
    2525
    2626    [Storable]
    27     public string ResourceIds { get; set; }
     27    public string ResourceNames { get; set; }
    2828
    2929    [Storable]
     
    4646    }
    4747
     48    [Storable]
     49    private bool useLocalPlugins;
     50    public bool UseLocalPlugins {
     51      get { return useLocalPlugins; }
     52      set { useLocalPlugins = value; }
     53    }
     54
     55    [Storable]
     56    private ItemCollection<HiveExperiment> hiveExperiments;
     57    public ItemCollection<HiveExperiment> HiveExperiments {
     58      get { return hiveExperiments; }
     59      set { hiveExperiments = value; }
     60    }
     61
    4862    private List<Plugin> onlinePlugins;
    4963    public List<Plugin> OnlinePlugins {
     
    6074    #region constructors and cloning
    6175    public HiveEngine() {
    62       ResourceIds = "HEAL";
     76      ResourceNames = "HEAL";
     77      HiveExperiments = new ItemCollection<HiveExperiment>();
     78      Priority = 0;
    6379    }
    6480
     
    6783    protected HiveEngine(HiveEngine original, Cloner cloner)
    6884      : base(original, cloner) {
    69       this.ResourceIds = original.ResourceIds;
     85      this.ResourceNames = original.ResourceNames;
    7086      this.currentOperator = cloner.Clone(original.currentOperator);
    7187      this.priority = original.priority;
    7288      this.executionTimeOnHive = original.executionTimeOnHive;
     89      this.useLocalPlugins = original.useLocalPlugins;
    7390    }
    7491    public override IDeepCloneable Clone(Cloner cloner) {
     
    123140
    124141            IScope[] scopes = ExecuteOnHive(jobs, parentScopeClone, cancellationToken);
    125             //IScope[] scopes = ExecuteLocally(jobs, parentScopeClone, cancellationToken);
    126142           
    127143            for (int i = 0; i < coll.Count; i++) {
     
    186202    }
    187203
    188     private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) {
    189       IScope[] scopes = new Scope[jobs.Length];
    190 
    191       for (int i = 0; i < jobs.Length; i++) {
    192         var job = (EngineJob)jobs[i].Clone();
    193         job.Start();
    194         while (job.ExecutionState != ExecutionState.Stopped) {
    195           Thread.Sleep(100);
    196         }
    197         scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope;
    198       }
    199 
    200       return scopes;
    201     }
     204    // testfunction:
     205    //private IScope[] ExecuteLocally(EngineJob[] jobs, IScope parentScopeClone, CancellationToken cancellationToken) {
     206    //  IScope[] scopes = new Scope[jobs.Length];
     207    //  for (int i = 0; i < jobs.Length; i++) {
     208    //    var job = (EngineJob)jobs[i].Clone();
     209    //    job.Start();
     210    //    while (job.ExecutionState != ExecutionState.Stopped) {
     211    //      Thread.Sleep(100);
     212    //    }
     213    //    scopes[i] = ((IAtomicOperation)job.InitialOperation).Scope;
     214    //  }
     215    //  return scopes;
     216    //}
    202217
    203218    /// <summary>
     
    211226      object locker = new object();
    212227      IDictionary<Guid, int> jobIndices = new Dictionary<Guid, int>();
     228      var hiveExperiment = new HiveExperiment();;
    213229
    214230      try {
     
    218234        int finishedCount = 0;
    219235        int uploadCount = 0;
     236
     237        // create hive experiment
     238        hiveExperiment.Name = "HiveEngine Run " + hiveExperiments.Count;
     239        hiveExperiment.UseLocalPlugins = this.UseLocalPlugins;
     240        hiveExperiment.ResourceNames = this.ResourceNames;
     241        hiveExperiment.RefreshAutomatically = false;
     242        hiveExperiment.Id = ServiceLocator.Instance.CallHiveService(s => s.AddHiveExperiment(hiveExperiment));
     243        hiveExperiments.Add(hiveExperiment);
    220244
    221245        // create upload-tasks
     
    230254
    231255          uploadTasks.Add(Task.Factory.StartNew<Job>((keyValuePairObj) => {
    232             return UploadJob(keyValuePairObj, parentScopeClone, cancellationToken, GetResourceIds());
     256            return UploadJob(keyValuePairObj, parentScopeClone, cancellationToken, GetResourceIds(), hiveExperiment.Id);
    233257          }, new KeyValuePair<int, EngineJob>(i, job), cancellationToken));
    234258        }
     
    313337
    314338        LogMessage(string.Format("All jobs finished (TotalExecutionTime: {0}).", executionTimes.Sum()));
    315         DeleteJobs(jobIndices);
     339        DeleteHiveExperiment(hiveExperiment.Id);
    316340
    317341        return scopes;
     
    319343      catch (OperationCanceledException e) {
    320344        lock (locker) {
    321           if (jobIndices != null) DeleteJobs(jobIndices);
     345          if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id);
    322346        }
    323347        throw e;
     
    325349      catch (Exception e) {
    326350        lock (locker) {
    327           if (jobIndices != null) DeleteJobs(jobIndices);
     351          if (jobIndices != null) DeleteHiveExperiment(hiveExperiment.Id);
    328352        }
    329353        LogException(e);
     
    332356    }
    333357
    334     private void DeleteJobs(IDictionary<Guid, int> jobIndices) {
    335       if (jobIndices.Count > 0) {
    336         TryAndRepeat(() => {
    337           LogMessage(string.Format("Deleting {0} jobs on hive.", jobIndices.Count));
    338           ServiceLocator.Instance.CallHiveService(service => {
    339             foreach (Guid jobId in jobIndices.Keys) {
    340               service.DeleteJob(jobId);
    341             }
    342             jobIndices.Clear();
    343           });
    344         }, 5, string.Format("Could not delete {0} jobs", jobIndices.Count));
    345       }
     358    private void DeleteHiveExperiment(Guid hiveExperimentId) {
     359      TryAndRepeat(() => {
     360        ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(hiveExperimentId));
     361      }, 5, string.Format("Could not delete jobs"));
    346362    }
    347363
    348364    private static object locker = new object();
    349     private Job UploadJob(object keyValuePairObj, IScope parentScopeClone, CancellationToken cancellationToken, List<Guid> resourceIds) {
     365    private Job UploadJob(object keyValuePairObj, IScope parentScopeClone, CancellationToken cancellationToken, List<Guid> resourceIds, Guid hiveExperimentId) {
    350366      var keyValuePair = (KeyValuePair<int, EngineJob>)keyValuePairObj;
    351367      Job job = new Job();
     
    370386        job.PluginsNeededIds = ServiceLocator.Instance.CallHiveService(s => PluginUtil.GetPluginDependencies(s, this.OnlinePlugins, this.AlreadyUploadedPlugins, neededPlugins, false));
    371387        job.Priority = priority;
     388        job.HiveExperimentId = hiveExperimentId;
    372389
    373390        try {
     
    396413    private List<Guid> GetResourceIds() {
    397414      return ServiceLocator.Instance.CallHiveService(service => {
    398         var resourceNames = ResourceIds.Split(';');
     415        var resourceNames = ResourceNames.Split(';');
    399416        var resourceIds = new List<Guid>();
    400417        foreach (var resourceName in resourceNames) {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Properties

    • Property svn:ignore set to
      AssemblyInfo.cs
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Views/HiveEngineView.Designer.cs

    r5958 r6006  
    3030      this.label1 = new System.Windows.Forms.Label();
    3131      this.executionTimeOnHiveTextBox = new System.Windows.Forms.TextBox();
     32      this.tabControl = new System.Windows.Forms.TabControl();
     33      this.jobsTabPage = new System.Windows.Forms.TabPage();
     34      this.hiveExperimentListView = new HeuristicLab.Clients.Hive.Views.HiveExperimentListView();
     35      this.logTabPage = new System.Windows.Forms.TabPage();
     36      this.logView = new HeuristicLab.Core.Views.LogView();
     37      this.executionTimeLabel = new System.Windows.Forms.Label();
     38      this.executionTimeTextBox = new System.Windows.Forms.TextBox();
     39      this.useLocalPluginsCheckBox = new System.Windows.Forms.CheckBox();
     40      this.tabControl.SuspendLayout();
     41      this.jobsTabPage.SuspendLayout();
     42      this.logTabPage.SuspendLayout();
    3243      this.SuspendLayout();
    33       //
    34       // executionTimeTextBox
    35       //
    36       this.executionTimeTextBox.Size = new System.Drawing.Size(623, 20);
    37       //
    38       // logView
    39       //
    40       this.logView.Location = new System.Drawing.Point(0, 78);
    41       this.logView.Size = new System.Drawing.Size(715, 469);
    4244      //
    4345      // resourceIdsLabel
     
    5759      this.resourceIdsTextBox.Location = new System.Drawing.Point(189, 52);
    5860      this.resourceIdsTextBox.Name = "resourceIdsTextBox";
    59       this.resourceIdsTextBox.Size = new System.Drawing.Size(526, 20);
     61      this.resourceIdsTextBox.Size = new System.Drawing.Size(405, 20);
    6062      this.resourceIdsTextBox.TabIndex = 4;
    6163      this.resourceIdsTextBox.Text = "HEAL";
     
    9799      this.executionTimeOnHiveTextBox.Name = "executionTimeOnHiveTextBox";
    98100      this.executionTimeOnHiveTextBox.ReadOnly = true;
    99       this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(586, 20);
     101      this.executionTimeOnHiveTextBox.Size = new System.Drawing.Size(577, 20);
    100102      this.executionTimeOnHiveTextBox.TabIndex = 8;
     103      //
     104      // tabControl
     105      //
     106      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     107                  | System.Windows.Forms.AnchorStyles.Left)
     108                  | System.Windows.Forms.AnchorStyles.Right)));
     109      this.tabControl.Controls.Add(this.jobsTabPage);
     110      this.tabControl.Controls.Add(this.logTabPage);
     111      this.tabControl.Location = new System.Drawing.Point(3, 78);
     112      this.tabControl.Name = "tabControl";
     113      this.tabControl.SelectedIndex = 0;
     114      this.tabControl.Size = new System.Drawing.Size(700, 460);
     115      this.tabControl.TabIndex = 9;
     116      //
     117      // jobsTabPage
     118      //
     119      this.jobsTabPage.Controls.Add(this.hiveExperimentListView);
     120      this.jobsTabPage.Location = new System.Drawing.Point(4, 22);
     121      this.jobsTabPage.Name = "jobsTabPage";
     122      this.jobsTabPage.Padding = new System.Windows.Forms.Padding(3);
     123      this.jobsTabPage.Size = new System.Drawing.Size(692, 434);
     124      this.jobsTabPage.TabIndex = 0;
     125      this.jobsTabPage.Text = "Jobs";
     126      this.jobsTabPage.UseVisualStyleBackColor = true;
     127      //
     128      // hiveExperimentListView
     129      //
     130      this.hiveExperimentListView.Caption = "HiveExperimentList View";
     131      this.hiveExperimentListView.Content = null;
     132      this.hiveExperimentListView.Dock = System.Windows.Forms.DockStyle.Fill;
     133      this.hiveExperimentListView.Location = new System.Drawing.Point(3, 3);
     134      this.hiveExperimentListView.Name = "hiveExperimentListView";
     135      this.hiveExperimentListView.ReadOnly = false;
     136      this.hiveExperimentListView.Size = new System.Drawing.Size(686, 428);
     137      this.hiveExperimentListView.TabIndex = 0;
     138      //
     139      // logTabPage
     140      //
     141      this.logTabPage.Controls.Add(this.logView);
     142      this.logTabPage.Location = new System.Drawing.Point(4, 22);
     143      this.logTabPage.Name = "logTabPage";
     144      this.logTabPage.Padding = new System.Windows.Forms.Padding(3);
     145      this.logTabPage.Size = new System.Drawing.Size(692, 434);
     146      this.logTabPage.TabIndex = 1;
     147      this.logTabPage.Text = "Log";
     148      this.logTabPage.UseVisualStyleBackColor = true;
     149      //
     150      // logView
     151      //
     152      this.logView.Caption = "SlaveView";
     153      this.logView.Content = null;
     154      this.logView.Dock = System.Windows.Forms.DockStyle.Fill;
     155      this.logView.Location = new System.Drawing.Point(3, 3);
     156      this.logView.Name = "logView";
     157      this.logView.ReadOnly = false;
     158      this.logView.Size = new System.Drawing.Size(686, 428);
     159      this.logView.TabIndex = 0;
     160      //
     161      // executionTimeLabel
     162      //
     163      this.executionTimeLabel.AutoSize = true;
     164      this.executionTimeLabel.Location = new System.Drawing.Point(4, 6);
     165      this.executionTimeLabel.Name = "executionTimeLabel";
     166      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13);
     167      this.executionTimeLabel.TabIndex = 10;
     168      this.executionTimeLabel.Text = "Execution Time:";
     169      //
     170      // executionTimeTextBox
     171      //
     172      this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     173                  | System.Windows.Forms.AnchorStyles.Left)
     174                  | System.Windows.Forms.AnchorStyles.Right)));
     175      this.executionTimeTextBox.Location = new System.Drawing.Point(129, 3);
     176      this.executionTimeTextBox.Name = "executionTimeTextBox";
     177      this.executionTimeTextBox.ReadOnly = true;
     178      this.executionTimeTextBox.Size = new System.Drawing.Size(577, 20);
     179      this.executionTimeTextBox.TabIndex = 11;
     180      //
     181      // useLocalPluginsCheckBox
     182      //
     183      this.useLocalPluginsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     184      this.useLocalPluginsCheckBox.AutoSize = true;
     185      this.useLocalPluginsCheckBox.Location = new System.Drawing.Point(600, 55);
     186      this.useLocalPluginsCheckBox.Name = "useLocalPluginsCheckBox";
     187      this.useLocalPluginsCheckBox.Size = new System.Drawing.Size(103, 17);
     188      this.useLocalPluginsCheckBox.TabIndex = 12;
     189      this.useLocalPluginsCheckBox.Text = "useLocalPlugins";
     190      this.useLocalPluginsCheckBox.UseVisualStyleBackColor = true;
     191      this.useLocalPluginsCheckBox.CheckedChanged += new System.EventHandler(this.useLocalPluginsCheckBox_CheckedChanged);
    101192      //
    102193      // HiveEngineView
     
    104195      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    105196      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     197      this.Controls.Add(this.useLocalPluginsCheckBox);
     198      this.Controls.Add(this.executionTimeTextBox);
     199      this.Controls.Add(this.executionTimeLabel);
     200      this.Controls.Add(this.tabControl);
    106201      this.Controls.Add(this.label1);
    107202      this.Controls.Add(this.executionTimeOnHiveTextBox);
     
    111206      this.Controls.Add(this.resourceIdsTextBox);
    112207      this.Name = "HiveEngineView";
    113       this.Size = new System.Drawing.Size(715, 550);
    114       this.Controls.SetChildIndex(this.resourceIdsTextBox, 0);
    115       this.Controls.SetChildIndex(this.resourceIdsLabel, 0);
    116       this.Controls.SetChildIndex(this.priorityLabel, 0);
    117       this.Controls.SetChildIndex(this.priorityTextBox, 0);
    118       this.Controls.SetChildIndex(this.logView, 0);
    119       this.Controls.SetChildIndex(this.executionTimeLabel, 0);
    120       this.Controls.SetChildIndex(this.executionTimeTextBox, 0);
    121       this.Controls.SetChildIndex(this.executionTimeOnHiveTextBox, 0);
    122       this.Controls.SetChildIndex(this.label1, 0);
     208      this.Size = new System.Drawing.Size(706, 541);
     209      this.tabControl.ResumeLayout(false);
     210      this.jobsTabPage.ResumeLayout(false);
     211      this.logTabPage.ResumeLayout(false);
    123212      this.ResumeLayout(false);
    124213      this.PerformLayout();
     
    134223    private System.Windows.Forms.Label label1;
    135224    protected System.Windows.Forms.TextBox executionTimeOnHiveTextBox;
     225    private System.Windows.Forms.TabControl tabControl;
     226    private System.Windows.Forms.TabPage jobsTabPage;
     227    private System.Windows.Forms.TabPage logTabPage;
     228    private System.Windows.Forms.Label executionTimeLabel;
     229    protected System.Windows.Forms.TextBox executionTimeTextBox;
     230    private System.Windows.Forms.CheckBox useLocalPluginsCheckBox;
     231    private HeuristicLab.Core.Views.LogView logView;
     232    private Clients.Hive.Views.HiveExperimentListView hiveExperimentListView;
    136233  }
    137234}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Views/HiveEngineView.cs

    r5958 r6006  
    11using System;
    2 using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Data;
    6 using System.Linq;
    7 using System.Text;
     2using HeuristicLab.Core.Views;
    83using HeuristicLab.MainForm;
    9 using HeuristicLab.Optimization.Views;
    10 using HeuristicLab.Core.Views;
    114
    125namespace HeuristicLab.HiveEngine.Views {
    136  [View("Hive Engine View")]
    147  [Content(typeof(HiveEngine), IsDefaultView = true)]
    15   public sealed partial class HiveEngineView : EngineView {
     8  public sealed partial class HiveEngineView : ItemView {
    169    public new HiveEngine Content {
    1710      get { return (HiveEngine)base.Content; }
     
    2417
    2518    protected override void DeregisterContentEvents() {
     19      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
    2620      Content.ExecutionTimeOnHiveChanged -= new EventHandler(Content_ExecutionTimeOnHiveChanged);
    2721      base.DeregisterContentEvents();
     
    3024    protected override void RegisterContentEvents() {
    3125      base.RegisterContentEvents();
     26      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
    3227      Content.ExecutionTimeOnHiveChanged += new EventHandler(Content_ExecutionTimeOnHiveChanged);
    3328    }
    3429
    3530    #region Event Handlers (Content)
     31    private void Content_ExecutionStateChanged(object sender, EventArgs e) {
     32      if (InvokeRequired) {
     33        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
     34      } else {
     35        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
     36      }
     37    }
     38
    3639    private void Content_ExecutionTimeOnHiveChanged(object sender, EventArgs e) {
    3740      if (InvokeRequired) {
     
    4952        priorityTextBox.Text = string.Empty;
    5053        executionTimeOnHiveTextBox.Text = string.Empty;
     54        useLocalPluginsCheckBox.Checked = false;
     55        hiveExperimentListView.Content = null;
     56        logView.Content = null;
    5157      } else {
    52         resourceIdsTextBox.Text = Content.ResourceIds;
     58        resourceIdsTextBox.Text = Content.ResourceNames;
    5359        priorityTextBox.Text = Content.Priority.ToString();
    5460        executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString();
     61        useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins;
     62        hiveExperimentListView.Content = Content.HiveExperiments;
     63        logView.Content = Content.Log;
    5564      }
    5665    }
     
    6271        resourceIdsTextBox.ReadOnly = this.ReadOnly;
    6372        priorityTextBox.ReadOnly = this.ReadOnly;
     73        useLocalPluginsCheckBox.Enabled = !this.ReadOnly;
    6474      } else {
    6575        resourceIdsTextBox.ReadOnly = false;
    6676        priorityTextBox.ReadOnly = false;
     77        useLocalPluginsCheckBox.Enabled = false;
    6778      }
    6879    }
     
    7081    #region Event Handlers (child controls)
    7182    private void resourceIdsTextBox_TextChanged(object sender, EventArgs e) {
    72       Content.ResourceIds = resourceIdsTextBox.Text;
     83      Content.ResourceNames = resourceIdsTextBox.Text;
    7384    }
    74     #endregion
    7585
    7686    private void priorityTextBox_TextChanged(object sender, EventArgs e) {
    7787      Content.Priority = int.Parse(priorityTextBox.Text);
    7888    }
     89
     90    private void useLocalPluginsCheckBox_CheckedChanged(object sender, EventArgs e) {
     91      Content.UseLocalPlugins = useLocalPluginsCheckBox.Checked;
     92    }
     93    #endregion
     94
     95
    7996  }
    8097}
Note: See TracChangeset for help on using the changeset viewer.