Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4120


Ignore:
Timestamp:
07/29/10 16:58:35 (14 years ago)
Author:
cneumuel
Message:

further improvement and stabilisation of HiveExperiment (#1115)

Location:
branches/3.3-HiveMigration/sources/HeuristicLab.Hive
Files:
7 added
2 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive 3.3.sln

    r4111 r4120  
    154154    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
    155155    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Debug|x64.ActiveCfg = Debug|Any CPU
    156     {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Debug|x86.ActiveCfg = Debug|Any CPU
     156    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Debug|x86.ActiveCfg = Debug|x86
     157    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Debug|x86.Build.0 = Debug|x86
    157158    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Release|Any CPU.ActiveCfg = Release|Any CPU
    158159    {C92AAC8C-4D88-449C-ABA5-2B935D769842}.Release|Any CPU.Build.0 = Release|Any CPU
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Client.Core/3.3/Properties/AssemblyInfo.cs

    r4119 r4120  
    5757// by using the '*' as shown below:
    5858// [assembly: AssemblyVersion("1.0.*")]
    59 [assembly: AssemblyVersion("3.3.0.4116")]
    60 [assembly: AssemblyFileVersion("3.3.0.4116")]
    61 [assembly: AssemblyBuildDate("2010/07/28 17:42:03")]
     59[assembly: AssemblyVersion("3.3.0.4119")]
     60[assembly: AssemblyFileVersion("3.3.0.4119")]
     61[assembly: AssemblyBuildDate("2010/07/29 16:49:03")]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3HeuristicLab.Hive.Experiment.Views-3.3.csproj.user
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HeuristicLab.Hive.Experiment.Views-3.3.csproj

    r4119 r4120  
    7373      <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
    7474    </Reference>
    75     <Reference Include="HeuristicLab.Hive.Experiment.Views-3.3, Version=3.3.0.4111, Culture=neutral, processorArchitecture=MSIL" />
     75    <Reference Include="HeuristicLab.DataAccess-3.3, Version=3.3.0.4091, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     76    <Reference Include="HeuristicLab.Hive.Experiment.Views-3.3, Version=3.3.0.4119, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    7677    <Reference Include="HeuristicLab.Hive.Server.Console-3.3">
    7778      <HintPath>..\..\HeuristicLab.Hive.Server.Console\3.3\obj\Debug\HeuristicLab.Hive.Server.Console-3.3.dll</HintPath>
     
    9293      <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
    9394    </Reference>
     95    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    9496    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    9597      <HintPath>..\..\..\..\..\..\..\..\..\Programme\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     
    101103    <Reference Include="System.Xml.Linq" />
    102104    <Reference Include="System.Data.DataSetExtensions" />
    103     <Reference Include="Microsoft.CSharp" />
    104105    <Reference Include="System.Data" />
    105106    <Reference Include="System.Xml" />
     
    113114      <DependentUpon>HiveExperimentView.cs</DependentUpon>
    114115    </Compile>
     116    <Compile Include="JobItemListView.cs">
     117      <SubType>UserControl</SubType>
     118    </Compile>
     119    <Compile Include="JobItemListView.Designer.cs">
     120      <DependentUpon>JobItemListView.cs</DependentUpon>
     121    </Compile>
     122    <Compile Include="JobItemView.cs">
     123      <SubType>UserControl</SubType>
     124    </Compile>
     125    <Compile Include="JobItemView.Designer.cs">
     126      <DependentUpon>JobItemView.cs</DependentUpon>
     127    </Compile>
    115128    <Compile Include="Properties\AssemblyInfo.cs" />
    116129  </ItemGroup>
     
    120133  </ItemGroup>
    121134  <ItemGroup>
     135    <ProjectReference Include="..\..\HeuristicLab.Hive.Contracts\3.3\HeuristicLab.Hive.Contracts-3.3.csproj">
     136      <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project>
     137      <Name>HeuristicLab.Hive.Contracts-3.3</Name>
     138    </ProjectReference>
    122139    <ProjectReference Include="..\..\HeuristicLab.Hive.Experiment\3.3\HeuristicLab.Hive.Experiment-3.3.csproj">
    123140      <Project>{A84C0A25-13D0-40A6-924F-53556D9691DC}</Project>
    124141      <Name>HeuristicLab.Hive.Experiment-3.3</Name>
     142    </ProjectReference>
     143    <ProjectReference Include="..\..\HeuristicLab.Hive.JobBase\3.3\HeuristicLab.Hive.JobBase-3.3.csproj">
     144      <Project>{21187322-52DD-4243-80A4-A85F0263E63B}</Project>
     145      <Name>HeuristicLab.Hive.JobBase-3.3</Name>
    125146    </ProjectReference>
    126147  </ItemGroup>
     
    128149    <EmbeddedResource Include="HiveExperimentView.resx">
    129150      <DependentUpon>HiveExperimentView.cs</DependentUpon>
     151    </EmbeddedResource>
     152    <EmbeddedResource Include="JobItemView.resx">
     153      <DependentUpon>JobItemView.cs</DependentUpon>
    130154    </EmbeddedResource>
    131155  </ItemGroup>
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveExperimentView.Designer.cs

    r4116 r4120  
    5353      this.loadExperimentButton = new System.Windows.Forms.Button();
    5454      this.hiveStatusTabPage = new System.Windows.Forms.TabPage();
     55      this.jobListView = new HeuristicLab.Hive.Experiment.Views.JobItemListView();
     56      this.logTabPage = new System.Windows.Forms.TabPage();
     57      this.logView = new HeuristicLab.Core.Views.LogView();
    5558      this.startButton = new System.Windows.Forms.Button();
    5659      this.stopButton = new System.Windows.Forms.Button();
     
    6669      this.tabControl.SuspendLayout();
    6770      this.experimentTabPage.SuspendLayout();
     71      this.hiveStatusTabPage.SuspendLayout();
     72      this.logTabPage.SuspendLayout();
    6873      this.SuspendLayout();
    6974      //
     
    8590      this.tabControl.Controls.Add(this.experimentTabPage);
    8691      this.tabControl.Controls.Add(this.hiveStatusTabPage);
    87       this.tabControl.Location = new System.Drawing.Point(0, 135);
     92      this.tabControl.Controls.Add(this.logTabPage);
     93      this.tabControl.Location = new System.Drawing.Point(0, 99);
    8894      this.tabControl.Name = "tabControl";
    8995      this.tabControl.SelectedIndex = 0;
    90       this.tabControl.Size = new System.Drawing.Size(735, 359);
     96      this.tabControl.Size = new System.Drawing.Size(735, 395);
    9197      this.tabControl.TabIndex = 4;
    9298      //
     
    100106      this.experimentTabPage.Name = "experimentTabPage";
    101107      this.experimentTabPage.Padding = new System.Windows.Forms.Padding(3);
    102       this.experimentTabPage.Size = new System.Drawing.Size(727, 333);
     108      this.experimentTabPage.Size = new System.Drawing.Size(727, 369);
    103109      this.experimentTabPage.TabIndex = 1;
    104110      this.experimentTabPage.Text = "Experiment";
     
    149155      // hiveStatusTabPage
    150156      //
     157      this.hiveStatusTabPage.Controls.Add(this.jobListView);
    151158      this.hiveStatusTabPage.Location = new System.Drawing.Point(4, 22);
    152159      this.hiveStatusTabPage.Name = "hiveStatusTabPage";
    153160      this.hiveStatusTabPage.Padding = new System.Windows.Forms.Padding(3);
    154       this.hiveStatusTabPage.Size = new System.Drawing.Size(727, 333);
     161      this.hiveStatusTabPage.Size = new System.Drawing.Size(727, 369);
    155162      this.hiveStatusTabPage.TabIndex = 2;
    156163      this.hiveStatusTabPage.Text = "HiveStatus";
    157164      this.hiveStatusTabPage.UseVisualStyleBackColor = true;
     165      //
     166      // jobListView
     167      //
     168      this.jobListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     169                  | System.Windows.Forms.AnchorStyles.Left)
     170                  | System.Windows.Forms.AnchorStyles.Right)));
     171      this.jobListView.Caption = "JobList View";
     172      this.jobListView.Content = null;
     173      this.jobListView.Location = new System.Drawing.Point(3, 6);
     174      this.jobListView.Name = "jobListView";
     175      this.jobListView.ReadOnly = false;
     176      this.jobListView.Size = new System.Drawing.Size(721, 360);
     177      this.jobListView.TabIndex = 0;
     178      //
     179      // logTabPage
     180      //
     181      this.logTabPage.Controls.Add(this.logView);
     182      this.logTabPage.Location = new System.Drawing.Point(4, 22);
     183      this.logTabPage.Name = "logTabPage";
     184      this.logTabPage.Size = new System.Drawing.Size(727, 369);
     185      this.logTabPage.TabIndex = 3;
     186      this.logTabPage.Text = "Log";
     187      this.logTabPage.UseVisualStyleBackColor = true;
     188      //
     189      // logView
     190      //
     191      this.logView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     192                  | System.Windows.Forms.AnchorStyles.Left)
     193                  | System.Windows.Forms.AnchorStyles.Right)));
     194      this.logView.Caption = "Log View";
     195      this.logView.Content = null;
     196      this.logView.Location = new System.Drawing.Point(3, 4);
     197      this.logView.Name = "logView";
     198      this.logView.ReadOnly = false;
     199      this.logView.Size = new System.Drawing.Size(721, 362);
     200      this.logView.TabIndex = 0;
    158201      //
    159202      // startButton
     
    300343      this.tabControl.ResumeLayout(false);
    301344      this.experimentTabPage.ResumeLayout(false);
     345      this.hiveStatusTabPage.ResumeLayout(false);
     346      this.logTabPage.ResumeLayout(false);
    302347      this.ResumeLayout(false);
    303348      this.PerformLayout();
     
    323368    private System.Windows.Forms.Button loadExperimentButton;
    324369    private Core.Views.NamedItemView experimentNamedItemView;
     370    private System.Windows.Forms.TabPage logTabPage;
     371    private Core.Views.LogView logView;
     372    private JobItemListView jobListView;
    325373
    326374  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveExperimentView.cs

    r4119 r4120  
    8181        serverUrlTextBox.Text = Content.ServerUrl;
    8282        experimentNamedItemView.Content = Content.Experiment;
     83        logView.Content = Content.Log;
     84        jobListView.Content = Content.JobItems;
    8385      }
    8486    }
     
    104106        Content.Prepare();
    105107      }
    106       SetEnabledStateOfExecutableButtons();
     108      SetEnabledStateOfControls();
    107109    }
    108110
     
    189191        stopButton.Enabled = (Content.ExecutionState == ExecutionState.Started) || (Content.ExecutionState == ExecutionState.Paused);
    190192        resetButton.Enabled = Content.ExecutionState != ExecutionState.Started;
     193       
    191194      }
    192195    }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/HiveExperimentView.resx

    r4116 r4120  
    128128    <value>
    129129        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    130         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCwAA
    131         CwsBbQSEtwAAALZJREFUOE9j/P//PwNFAGQAOi7bn+2GTRybGIZmkKKEGRH/iTUEpwGWZfpEGYLVgKgp
     130        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCAAA
     131        CwgBwL2l2gAAALZJREFUOE9j/P//PwNFAGQAOi7bn+2GTRybGIZmkKKEGRH/iTUEpwGWZfpEGYLVgKgp
    132132        Qf833Fr8nxhDsBoQPMEbZDtRhmA1wKfLGWwACEctCsDrEqwGODZb/M/YEAvWbNus/1+nWOG/RBo3iFZD
    133133        jwmsBpjX6KFo5k9gwaoZnIawxa1eqTLcZnyacRqgki8FdjYhzTgNkM4QJEozTgNEkjlx+pmoQMQW2rjy
     
    138138    <value>
    139139        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    140         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCwAA
    141         CwsBbQSEtwAAAXJJREFUOE+tkj1IQmEYhWsoaIi2xmhpiYSgKFoiCMLJJYSEJiEI0mgIyqjA6vaLUKIU
     140        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCAAA
     141        CwgBwL2l2gAAAXJJREFUOE+tkj1IQmEYhWsoaIi2xmhpiYSgKFoiCMLJJYSEJiEI0mgIyqjA6vaLUKIU
    142142        iZlJKKUoWEbZDzVYCYlQYVxcNDIoRND8ud7idD83C27g7YNvPM8573nfcgBlgh4BCPmCxIX0Qtx/ATTu
    143143        Lyy78ph3ZKC2pTBlSWB86w2jhleMrD9jWB9N/jQsSkDEj5FPPERZ+J7yOL5j4PYzsPsYGL1piKR7nL64
     
    151151    <value>
    152152        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    153         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCwAA
    154         CwsBbQSEtwAAAYNJREFUOE9j/P//PwNFAGQAJZgizWDXI9veu/nvfxhuW/vtf+OKz/9rF7//XzHv1f+S
     153        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCAAA
     154        CwgBwL2l2gAAAYNJREFUOE9j/P//PwNFAGQAJZgizWDXI9veu/nvfxhuW/vtf+OKz/9rF7//XzHv1f+S
    155155        2c//F0x//L901mOgFoSrUQzo2vDr/6aT3/6vPPTl/4I9n/5ffvDzf+/ad/+bl74BG5I3/cV/3dBVuA0A
    156156        2bri4Jf/83Z9+n/ryS+Qwv8NS978L5378n/O1Of/k3qf/Vf1W4TbAJCT5+z49P/hyx9gzSBQMvvl/6wp
     
    164164    <value>
    165165        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
    166         YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCwAA
    167         CwsBbQSEtwAAAMZJREFUOE9j/P//PwNFAGQAJZgizWDXU2I7VgN6N//937Xh1/+8qY8+gRSg89EtxHAB
     166        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALCAAA
     167        CwgBwL2l2gAAAMZJREFUOE9j/P//PwNFAGQAJZgizWDXU2I7VgN6N//937Xh1/+8qY8+gRSg89EtxHAB
    168168        SPPVh3/+64auAqr9z4DOJ2hA29pv/289/f1f1W8R2AB0PkEDGld8/n/54e//cm6zwAag8wkaULv4/f8T
    169169        13//F7ObBDYAnU/QgIp5r/7vvvDzP79ZN9gAdD5BA0pmP/+//uTP/5wGrWAD0PkEDSiY/vj/gj2f/7Pq
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment.Views/3.3/Properties/AssemblyInfo.cs

    r4119 r4120  
    5555// You can specify all the values or you can default the Revision and Build Numbers
    5656// by using the '*' as shown below:
    57 [assembly: AssemblyVersion("3.3.0.4116")]
    58 [assembly: AssemblyFileVersion("3.3.0.4116")]
    59 [assembly: AssemblyBuildDate("2010/07/28 17:42:56")]
     57[assembly: AssemblyVersion("3.3.0.4119")]
     58[assembly: AssemblyFileVersion("3.3.0.4119")]
     59[assembly: AssemblyBuildDate("2010/07/29 16:49:22")]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3HeuristicLab.Hive.Experiment-3.3.csproj.user
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HeuristicLab.Hive.Experiment-3.3.csproj

    r4119 r4120  
    9696  </ItemGroup>
    9797  <ItemGroup>
     98    <Compile Include="JobItemList.cs" />
     99    <Compile Include="JobItem.cs" />
    98100    <Compile Include="OptimizerJob.cs" />
    99101    <Compile Include="HeuristicLabHiveExperimentPlugin.cs" />
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/HiveExperiment.cs

    r4119 r4120  
    5454    private const int resultPollingIntervalMs = 10000;
    5555
     56    private object locker = new object();
    5657    private const int maxSnapshotRetries = 20;
    57 
    58     [Storable]
    59     private IDictionary<Guid, IOptimizer> sentOptimizers = null;
    60 
    61     private object locker = new object();
    62     private DateTime startTime;
     58    private System.Timers.Timer timer;
     59    private bool pausePending, stopPending;
     60    private DateTime lastUpdateTime;
     61
     62    [Storable]
     63    private IDictionary<Guid, IOptimizer> pendingOptimizers = new Dictionary<Guid, IOptimizer>();
     64
     65    [Storable]
     66    private JobItemList jobItems;
     67    public JobItemList JobItems {
     68      get { return jobItems; }
     69    }
     70   
    6371
    6472    [Storable]
     
    6674    public string ServerUrl {
    6775      get { return serverUrl; }
    68       set { serverUrl = value; OnServerUrlChanged(); }
     76      set {
     77        if (serverUrl != value) {
     78          serverUrl = value;
     79          OnServerUrlChanged();
     80        }
     81      }
    6982    }
    7083
     
    7386    public string ResourceIds {
    7487      get { return resourceIds; }
    75       set { resourceIds = value; OnResourceIdsChanged(); }
     88      set {
     89        if (resourceIds != value) {
     90          resourceIds = value;
     91          OnResourceIdsChanged();
     92        }
     93      }
    7694    }
    7795
     
    8098    public HeuristicLab.Optimization.Experiment Experiment {
    8199      get { return experiment; }
    82       set { experiment = value; OnExperimentChanged(); }
     100      set {
     101        if (experiment != value) {
     102          experiment = value;
     103          OnExperimentChanged();
     104        }
     105      }
     106    }
     107
     108    [Storable]
     109    private ILog log;
     110    public ILog Log {
     111      get { return log; }
    83112    }
    84113
     
    92121      this.ServerUrl = HeuristicLab.Hive.Experiment.Properties.Settings.Default.HiveServerUrl;
    93122      this.ResourceIds = HeuristicLab.Hive.Experiment.Properties.Settings.Default.ResourceIds;
     123      this.log = new Log();
     124      pausePending = stopPending = false;
     125      jobItems = new JobItemList();
     126      InitTimer();
    94127    }
    95128
    96129    public override IDeepCloneable Clone(Cloner cloner) {
     130      log.LogMessage("I am beeing cloned");
    97131      HiveExperiment clone = (HiveExperiment)base.Clone(cloner);
    98132      clone.resourceIds = this.resourceIds;
     
    101135      clone.executionState = this.executionState;
    102136      clone.executionTime = this.executionTime;
    103       clone.sentOptimizers = new Dictionary<Guid, IOptimizer>();
    104       foreach (var pair in this.sentOptimizers)
    105         clone.sentOptimizers[pair.Key] = (IOptimizer)cloner.Clone(pair.Value);
     137      clone.pendingOptimizers = new Dictionary<Guid, IOptimizer>();
     138      foreach (var pair in this.pendingOptimizers)
     139        clone.pendingOptimizers[pair.Key] = (IOptimizer)cloner.Clone(pair.Value);
     140      clone.log = (ILog)cloner.Clone(log);
     141      clone.stopPending = this.stopPending;
     142      clone.pausePending = this.pausePending;
     143      clone.jobItems = (JobItemList)cloner.Clone(jobItems);
    106144      return clone;
     145    }
     146
     147    [StorableHook(HookType.AfterDeserialization)]
     148    private void AfterDeserialization() {
     149      InitTimer();
     150      log.LogMessage("I was deserialized.");
     151    }
     152
     153    private void InitTimer() {
     154      timer = new System.Timers.Timer(100);
     155      timer.AutoReset = true;
     156      timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
     157    }
     158
     159    private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) {
     160      DateTime now = DateTime.Now;
     161      ExecutionTime += now - lastUpdateTime;
     162      lastUpdateTime = now;
    107163    }
    108164
     
    135191      get { return executionTime; }
    136192      private set {
    137         executionTime = value;
    138         OnExecutionTimeChanged();
     193        if (executionTime != value) {
     194          executionTime = value;
     195          OnExecutionTimeChanged();
     196        }
    139197      }
    140198    }
     
    145203
    146204    public void Prepare() {
    147       // [chn] needed?
    148205      if (experiment != null) {
    149206        experiment.Prepare();
     207        this.ExecutionState = Core.ExecutionState.Prepared;
    150208        OnPrepared();
    151209      }
     
    153211
    154212    public void Start() {
    155       this.startTime = DateTime.Now;
     213      OnStarted();
     214      lastUpdateTime = DateTime.Now;
    156215      this.ExecutionState = Core.ExecutionState.Started;
    157       IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(ServerUrl);
    158 
    159       sentOptimizers = new Dictionary<Guid, IOptimizer>();
    160       IEnumerable<string> groups = ResourceGroups;
    161 
    162       foreach (IOptimizer optimizer in Experiment.Optimizers) {
    163         SerializedJob serializedJob = CreateSerializedJob(optimizer);
    164         ResponseObject<JobDto> response = executionEngineFacade.AddJobWithGroupStrings(serializedJob, groups);
    165         sentOptimizers.Add(response.Obj.Id, optimizer);
    166         StartResultPollingThread(response.Obj);
    167       }
     216      Thread t = new Thread(() => {
     217        IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(ServerUrl);
     218
     219        pendingOptimizers = new Dictionary<Guid, IOptimizer>();
     220        IEnumerable<string> groups = ResourceGroups;
     221
     222        foreach (IOptimizer optimizer in GetOptimizers(false)) {
     223          SerializedJob serializedJob = CreateSerializedJob(optimizer);
     224          ResponseObject<JobDto> response = executionEngineFacade.AddJobWithGroupStrings(serializedJob, groups);
     225          pendingOptimizers.Add(response.Obj.Id, optimizer);
     226          StartResultPollingThread(response.Obj);
     227
     228          JobItem jobItem = new JobItem() {
     229            JobDto = response.Obj,
     230            LatestSnapshot = new ResponseObject<SerializedJob>() {
     231              Obj = serializedJob,
     232              StatusMessage = "Initial Snapshot",
     233              Success = true
     234            }
     235          };
     236          jobItems.Add(jobItem);
     237
     238          log.LogMessage("Sent job to server (jobId: " + response.Obj.Id + ")");
     239        }
     240      });
     241      t.Start();
     242    }
     243
     244    /// <summary>
     245    /// Returns all optimizers in the current Experiment
     246    /// </summary>
     247    /// <param name="flatout">if false only top level optimizers are returned, if true the optimizer-tree is flatted</param>
     248    /// <returns></returns>
     249    private IEnumerable<IOptimizer> GetOptimizers(bool flatout) {
     250      if (!flatout) {
     251        return experiment.Optimizers;
     252      } else {
     253        throw new NotImplementedException();
     254      }
     255    }
     256
     257    private void ReplaceOptimizer(IOptimizer originalOptimizer, IOptimizer newOptimizer) {
     258      int originalOptimizerIndex = experiment.Optimizers.IndexOf(originalOptimizer);
     259      experiment.Optimizers[originalOptimizerIndex] = newOptimizer;
    168260    }
    169261
     
    171263      // todo
    172264    }
    173 
    174     private bool abortRequested;
    175 
     265   
    176266    #endregion
    177267
     
    219309          Thread.Sleep(resultPollingIntervalMs);
    220310          lock (locker) {
    221             if (abortRequested) return;
    222 
     311            if (stopPending) return;
     312           
    223313            ResponseObject<SerializedJob> response = executionEngineFacade.GetLastSerializedResult(job.Id, false, false);
    224 
     314            log.LogMessage("Received response for job: " + response.StatusMessage + " (jobId: " + job.Id + ")");
     315           
     316           
    225317            // loop while
    226318            // 1. the user doesn't request an abort
     
    229321            // 4. the result that we get from the server is a snapshot and not the final result
    230322            if (response.Success && response.Obj != null && response.StatusMessage != ApplicationConstants.RESPONSE_JOB_RESULT_NOT_YET_HERE) {
    231 
    232               // [chn] todo: deserialization into interface is not possible! how to find out correct static type?
    233323              restoredObject = XmlParser.Deserialize<IJob>(new MemoryStream(response.Obj.SerializedJobData));
    234324            }
     
    236326        } while (restoredObject == null || restoredObject.ExecutionState != Core.ExecutionState.Stopped);
    237327
     328        log.LogMessage("Job finished (jobId: " + job.Id + ")");
    238329        // job retrieved... replace the existing optimizers with the finished one
    239         IOptimizer originalOptimizer = sentOptimizers[job.Id];
     330        IOptimizer originalOptimizer = pendingOptimizers[job.Id];
    240331        IOptimizer restoredOptimizer = ((OptimizerJob)restoredObject).Optimizer;
    241332
    242         int originalOptimizerIndex = experiment.Optimizers.IndexOf(originalOptimizer);
    243         experiment.Optimizers[originalOptimizerIndex] = restoredOptimizer;
    244         sentOptimizers.Remove(job.Id);
    245 
    246         if (sentOptimizers.Count == 0) {
     333        ReplaceOptimizer(originalOptimizer, restoredOptimizer);
     334        pendingOptimizers.Remove(job.Id);
     335
     336        if (pendingOptimizers.Count == 0) {
    247337          // finished
    248338          this.ExecutionState = Core.ExecutionState.Stopped;
     
    254344      t.Start();
    255345    }
    256 
    257 
     346   
    258347    #region Required Plugin Search
    259348    /// <summary>
     
    351440    public event EventHandler ExecutionStateChanged;
    352441    private void OnExecutionStateChanged() {
     442      log.LogMessage("ExecutionState changed to " + executionState.ToString());
    353443      EventHandler handler = ExecutionStateChanged;
    354444      if (handler != null) handler(this, EventArgs.Empty);
     
    359449    public event EventHandler Started;
    360450    private void OnStarted() {
     451      log.LogMessage("Started");
     452      timer.Start();
    361453      EventHandler handler = Started;
    362454      if (handler != null) handler(this, EventArgs.Empty);
     
    365457    public event EventHandler Stopped;
    366458    private void OnStopped() {
     459      timer.Stop();
     460      log.LogMessage("Stopped");
    367461      EventHandler handler = Stopped;
    368462      if (handler != null) handler(this, EventArgs.Empty);
     
    371465    public event EventHandler Paused;
    372466    private void OnPaused() {
     467      timer.Stop();
     468      log.LogMessage("Paused");
    373469      EventHandler handler = Paused;
    374470      if (handler != null) handler(this, EventArgs.Empty);
     
    377473    public event EventHandler Prepared;
    378474    protected virtual void OnPrepared() {
     475      log.LogMessage("Prepared");
    379476      EventHandler handler = Prepared;
    380477      if (handler != null) handler(this, EventArgs.Empty);
     
    389486    public event EventHandler ExperimentChanged;
    390487    protected virtual void OnExperimentChanged() {
     488      log.LogMessage("Experiment changed");
    391489      EventHandler handler = ExperimentChanged;
    392490      if (handler != null) handler(this, EventArgs.Empty);
     
    399497    }
    400498
    401 
    402499    #endregion
    403500  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/OptimizerJob.cs

    r4119 r4120  
    1010namespace HeuristicLab.Hive.Experiment {
    1111  [StorableClass]
    12   class OptimizerJob : IJob {
     12  public class OptimizerJob : IJob {
    1313
    1414    [Storable]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/Properties/AssemblyInfo.cs

    r4119 r4120  
    5555// You can specify all the values or you can default the Revision and Build Numbers
    5656// by using the '*' as shown below:
    57 [assembly: AssemblyVersion("3.3.0.4116")]
    58 [assembly: AssemblyFileVersion("3.3.0.4116")]
    59 [assembly: AssemblyBuildDate("2010/07/28 17:42:02")]
     57[assembly: AssemblyVersion("3.3.0.4119")]
     58[assembly: AssemblyFileVersion("3.3.0.4119")]
     59[assembly: AssemblyBuildDate("2010/07/29 16:49:01")]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Experiment/3.3/ServiceLocator.cs

    r4116 r4120  
    3131  internal class ServiceLocator {
    3232    internal static IExecutionEngineFacade CreateExecutionEngineFacade(string url) {
    33       ChannelFactory<IExecutionEngineFacade> factory =
    34         new ChannelFactory<IExecutionEngineFacade>(
     33      ChannelFactory<IExecutionEngineFacade> factory = new ChannelFactory<IExecutionEngineFacade>(
    3534          WcfSettings.GetStreamedBinding(),
    3635          new EndpointAddress(url));
    37 
    3836      return factory.CreateChannel();
    3937    }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.JobBase/3.3/HeuristicLab.Hive.JobBase-3.3.csproj

    r4111 r4120  
    9191  </PropertyGroup>
    9292  <ItemGroup>
     93    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    9394    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    9495    <Reference Include="HeuristicLab.Core-3.3">
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Console/3.3/JobDataFetcher.cs

    r4107 r4120  
    1111namespace HeuristicLab.Hive.Server.ServerConsole {
    1212  public class JobDataFetcher {
    13     public List<State> PollStates { get; set; }   
     13    private List<State> pollStates;
     14
     15    public IEnumerable<State> PollStates {
     16      get { return pollStates; }
     17    }
    1418
    1519    public event EventHandler NewDataAvailable;
    1620
    1721    private System.Timers.Timer timer;
     22
     23    private static object locker = new object();
    1824
    1925    public List<JobDto> CachedJobs { get; set; }
     
    3945
    4046    public JobDataFetcher(IEnumerable<State> states, int nrOfEntries) {
    41       PollStates = new List<State>();
     47      pollStates = new List<State>();
    4248      CachedJobs = new List<JobDto>();
    4349      NrOfEntriesOnPage = nrOfEntries;
    4450      CurrentPage = 0;
    45       PollStates.AddRange(states);
     51      pollStates.AddRange(states);
    4652      timer = new System.Timers.Timer();
    4753      timer.Interval = 5000;
     
    7076      // [chn] Exception occured here: PollStates enumeration changed!
    7177      // todo: make access to PollStates thread-safe!
    72       foreach (State stat in PollStates) {
    73         ResponseList<JobDto> resList = ServiceLocator.GetJobManager().GetAllJobsWithFilter(stat, CurrentPage * NrOfEntriesOnPage,
    74                                                             NrOfEntriesOnPage);
    75         if (resList.Success) {
    76           if (resList.List.Count == 0) {
    77             if (CurrentPage > 0) {
    78               CurrentPage--;
     78      // * added lock on locker -> didn't help
     79      // * made public property PollStates an IEnumerable to be immutable -> lets see
     80      lock (locker) {
     81        foreach (State stat in PollStates) {
     82          ResponseList<JobDto> resList = ServiceLocator.GetJobManager().GetAllJobsWithFilter(stat, CurrentPage * NrOfEntriesOnPage,
     83                                                              NrOfEntriesOnPage);
     84          if (resList.Success) {
     85            if (resList.List.Count == 0) {
     86              if (CurrentPage > 0) {
     87                CurrentPage--;
     88              }
     89            } else {
     90              CachedJobs = new List<JobDto>();
     91              CachedJobs.AddRange(resList.List);
    7992            }
    80           } else {
    81             CachedJobs = new List<JobDto>();
    82             CachedJobs.AddRange(resList.List);
    8393          }
    8494        }
     95        if (NewDataAvailable != null)
     96          NewDataAvailable(this, new EventArgs());
    8597      }
    86       if (NewDataAvailable != null)
    87         NewDataAvailable(this, new EventArgs());
    8898    }
    8999  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ExecutionEngineFacade.cs

    r4092 r4120  
    7070    }
    7171
     72    public ResponseObject<JobDto> GetJobById(Guid jobId) {
     73      using (contextFactory.GetContext()) {
     74        return jobManager.GetJobById(jobId);
     75      }
     76    }
    7277    #endregion
    7378  }
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/JobManager.cs

    r4119 r4120  
    5858    }
    5959
    60 
    6160    private void CheckForDeadJobs() {
    6261      Logger.Info("Searching for dead Jobs");
     
    231230    }
    232231
     232    // [chn] [refactor] why does this method handle 3 different cases? wouldn't 3 methods be easier?
    233233    //Requested means: there MUST be a job result which gets sent back
    234234    public ResponseObject<SerializedJob> GetLastSerializedJobResultOf(Guid jobId, bool requested, bool snapshot) {
    235       ResponseObject<SerializedJob> response =
    236         new ResponseObject<SerializedJob>();
     235      ResponseObject<SerializedJob> response = new ResponseObject<SerializedJob>();
    237236
    238237      JobDto job = DaoLocator.JobDao.FindById(jobId);
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Properties/AssemblyInfo.cs

    r4119 r4120  
    5555// by using the '*' as shown below:
    5656// [assembly: AssemblyVersion("1.0.*")]
    57 [assembly: AssemblyVersion("3.3.0.4116")]
    58 [assembly: AssemblyFileVersion("3.3.0.4116")]
    59 [assembly: AssemblyBuildDate("2010/07/28 17:42:06")]
     57[assembly: AssemblyVersion("3.3.0.4119")]
     58[assembly: AssemblyFileVersion("3.3.0.4119")]
     59[assembly: AssemblyBuildDate("2010/07/29 16:49:08")]
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.LINQDataAccess/3.3/ContextFactory.cs

    r4092 r4120  
    2323  /// </summary>
    2424  class ContextFactory : IContextFactory {
    25     private static IDictionary<object, HiveDataContext> contexts = new Dictionary<object, HiveDataContext>();
    26     private static IDictionary<object, TransactionScope> transactions = new Dictionary<object, TransactionScope>();
     25    private static object locker = new object();
     26    private static IDictionary<int, HiveDataContext> contexts = new Dictionary<int, HiveDataContext>();
     27    private static IDictionary<int, TransactionScope> transactions = new Dictionary<int, TransactionScope>();
    2728
    2829    private static IContextFactory instance = null;
     
    4243
    4344    public IDisposable GetContext(bool withTransaction) {
    44       Logger.Debug("opening transaction");
    45       object obj = Thread.CurrentThread;
     45      lock (locker) {
     46        Logger.Debug("opening transaction");
     47        int threadId = Thread.CurrentThread.ManagedThreadId;
    4648
    47       if (contexts.ContainsKey(obj)) {
    48         throw new DataAccessException("Context for this Thread already defined");
     49        if (contexts.ContainsKey(threadId)) {
     50          throw new DataAccessException("Context for this Thread already defined");
     51        }
     52
     53        Logger.Debug("creating context");
     54        DisposableHiveDataContext context = CreateContext();
     55        context.OnDisposing += new EventHandler(context_OnDisposing);
     56        contexts.Add(threadId, context);
     57
     58        if (withTransaction) {
     59          TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE });
     60          Logger.Debug("creating  transaction");
     61
     62          transactions.Add(threadId, transaction);
     63        }
     64        return context;
    4965      }
    50 
    51       Logger.Debug("creating context");
    52       DisposableHiveDataContext context = CreateContext();
    53       context.OnDisposing += new EventHandler(context_OnDisposing);
    54       contexts.Add(obj, context);
    55 
    56       if (withTransaction) {
    57         TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = ApplicationConstants.ISOLATION_LEVEL_SCOPE });
    58         Logger.Debug("creating  transaction");
    59        
    60         transactions.Add(obj, transaction);
    61       }
    62       return context;
    6366    }
    6467
     
    7477    public void RollbackTransaction() {
    7578      Logger.Debug("rolling back transaction");
    76       object obj = Thread.CurrentThread;
     79      int threadId = Thread.CurrentThread.ManagedThreadId;
    7780
    78       TransactionScope transaction = transactions[obj];
     81      TransactionScope transaction = transactions[threadId];
    7982      transaction.Dispose();
    8083    }
    8184
    8285    public void RemoveContext() {
    83       Logger.Debug("removing context");
    84       object obj = Thread.CurrentThread;
     86      lock (locker) {
     87        Logger.Debug("removing context");
     88        int threadId = Thread.CurrentThread.ManagedThreadId;
    8589
    86       contexts.Remove(obj);
    87       // context gets disposed implicitly, when it is used as IDisposable
     90        contexts.Remove(threadId);
     91        // context gets disposed implicitly, when it is used as IDisposable
     92      }
    8893    }
    8994
    9095    public void RemoveAndCompleteTransaction() {
    91       Logger.Debug("completing transaction");
    92       object obj = Thread.CurrentThread;
     96      lock (locker) {
     97        Logger.Debug("completing transaction");
     98        int threadId = Thread.CurrentThread.ManagedThreadId;
    9399
    94       // context does not always have an associated transaction
    95       if (transactions.ContainsKey(obj)) {
    96         transactions[obj].Complete();
    97         transactions[obj].Dispose();
    98         transactions.Remove(obj);
     100        // context does not always have an associated transaction
     101        if (transactions.ContainsKey(threadId)) {
     102          transactions[threadId].Complete();
     103          transactions[threadId].Dispose();
     104          transactions.Remove(threadId);
     105        }
    99106      }
    100107    }
     
    102109    public DataContext CurrentContext {
    103110      get {
    104         object obj = Thread.CurrentThread;
    105         if (contexts.ContainsKey(obj)) {
    106           return contexts[obj];
     111        int threadId = Thread.CurrentThread.ManagedThreadId;
     112        if (contexts.ContainsKey(threadId)) {
     113          return contexts[threadId];
    107114        } else {
    108115          return null;
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3

    • Property svn:ignore
      •  

        old new  
        11bin
        22obj
         3HeuristicLab.Hive-3.3.csproj.user
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/HeuristicLab.Hive-3.3.csproj

    r4119 r4120  
    4141  <PropertyGroup>
    4242    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
     43  </PropertyGroup>
     44  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     45    <PlatformTarget>x86</PlatformTarget>
     46    <OutputPath>bin\Debug\</OutputPath>
     47  </PropertyGroup>
     48  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
     49    <PlatformTarget>x86</PlatformTarget>
     50    <OutputPath>bin\x86\Release\</OutputPath>
    4351  </PropertyGroup>
    4452  <ItemGroup>
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive/3.3/Properties/AssemblyInfo.cs

    r4119 r4120  
    5151//      Revision
    5252//
    53 [assembly: AssemblyVersion("3.3.0.4116")]
    54 [assembly: AssemblyFileVersion("3.3.0.4116")]
     53[assembly: AssemblyVersion("3.3.0.4119")]
     54[assembly: AssemblyFileVersion("3.3.0.4119")]
Note: See TracChangeset for help on using the changeset viewer.