Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/09 13:17:44 (15 years ago)
Author:
gkronber
Message:

Worked on hive engine. #545 (Engine which can be executed in the Hive)

Location:
trunk/sources/HeuristicLab.Hive.Engine
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Engine/HeuristicLab.Hive.Engine.csproj

    r1432 r1440  
    3131    <WarningLevel>4</WarningLevel>
    3232  </PropertyGroup>
     33  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     34    <DebugSymbols>true</DebugSymbols>
     35    <OutputPath>bin\x86\Debug\</OutputPath>
     36    <DefineConstants>DEBUG;TRACE</DefineConstants>
     37    <DebugType>full</DebugType>
     38    <PlatformTarget>x86</PlatformTarget>
     39    <ErrorReport>prompt</ErrorReport>
     40  </PropertyGroup>
     41  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     42    <OutputPath>bin\x86\Release\</OutputPath>
     43    <DefineConstants>TRACE</DefineConstants>
     44    <Optimize>true</Optimize>
     45    <DebugType>pdbonly</DebugType>
     46    <PlatformTarget>x86</PlatformTarget>
     47    <ErrorReport>prompt</ErrorReport>
     48  </PropertyGroup>
    3349  <ItemGroup>
    3450    <Reference Include="System" />
     
    3753    </Reference>
    3854    <Reference Include="System.Drawing" />
     55    <Reference Include="System.ServiceModel">
     56      <RequiredTargetFramework>3.0</RequiredTargetFramework>
     57    </Reference>
    3958    <Reference Include="System.Windows.Forms" />
    4059    <Reference Include="System.Xml.Linq">
     
    4867  </ItemGroup>
    4968  <ItemGroup>
     69    <Compile Include="Job.cs" />
    5070    <Compile Include="HeuristicLabHiveEnginePlugin.cs" />
    5171    <Compile Include="HiveEngine.cs" />
    5272    <Compile Include="HiveEngineEditor.cs">
     73      <SubType>UserControl</SubType>
    5374    </Compile>
    5475    <Compile Include="HiveEngineEditor.Designer.cs">
    5576      <DependentUpon>HiveEngineEditor.cs</DependentUpon>
    5677    </Compile>
     78    <Compile Include="Properties\AssemblyInfo.cs" />
     79    <Compile Include="ServiceLocator.cs" />
    5780  </ItemGroup>
    5881  <ItemGroup>
     
    6083      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
    6184      <Name>HeuristicLab.Core</Name>
     85    </ProjectReference>
     86    <ProjectReference Include="..\HeuristicLab.DataAccess\HeuristicLab.DataAccess.csproj">
     87      <Project>{9076697B-C151-46CD-95BC-1D059492B478}</Project>
     88      <Name>HeuristicLab.DataAccess</Name>
     89    </ProjectReference>
     90    <ProjectReference Include="..\HeuristicLab.Hive.Contracts\HeuristicLab.Hive.Contracts.csproj">
     91      <Project>{134F93D7-E7C8-4ECD-9923-7F63259A60D8}</Project>
     92      <Name>HeuristicLab.Hive.Contracts</Name>
    6293    </ProjectReference>
    6394    <ProjectReference Include="..\HeuristicLab.Hive.JobBase\HeuristicLab.Hive.JobBase.csproj">
     
    6899      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    69100      <Name>HeuristicLab.PluginInfrastructure</Name>
     101    </ProjectReference>
     102    <ProjectReference Include="..\HeuristicLab.SequentialEngine\HeuristicLab.SequentialEngine.csproj">
     103      <Project>{B4BE8E53-BA06-4237-9A01-24255F880201}</Project>
     104      <Name>HeuristicLab.SequentialEngine</Name>
    70105    </ProjectReference>
    71106  </ItemGroup>
     
    86121  </Target>
    87122  -->
     123  <PropertyGroup>
     124    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     125set ProjectDir=$(ProjectDir)
     126set SolutionDir=$(SolutionDir)
     127set Outdir=$(Outdir)
     128
     129call PreBuildEvent.cmd</PreBuildEvent>
     130  </PropertyGroup>
    88131</Project>
  • trunk/sources/HeuristicLab.Hive.Engine/HiveEngine.cs

    r1432 r1440  
    2525using HeuristicLab.Core;
    2626using System.Threading;
     27using HeuristicLab.Hive.JobBase;
     28using HeuristicLab.Hive.Contracts.Interfaces;
    2729
    2830namespace HeuristicLab.Hive.Engine {
     
    3133  /// in parallel.
    3234  /// </summary>
    33   public class HiveEngine : EngineBase, IEditable {
    34     private IOperator currentOperator;
     35  public class HiveEngine : ItemBase, IEngine, IEditable {
     36    private Job job;
     37    public string HiveServerUrl { get; set; }
    3538
    36     /// <summary>
    37     /// Creates a new instance of <see cref="HiveEngineEditor"/>.
    38     /// </summary>
    39     /// <returns>The created view as <see cref="HiveEngineEditor"/>.</returns>
     39    public HiveEngine() {
     40      job = new Job();
     41    }
     42
     43
     44    #region IEngine Members
     45
     46    public IOperatorGraph OperatorGraph {
     47      get { return job.Engine.OperatorGraph; }
     48    }
     49
     50    public IScope GlobalScope {
     51      get { return job.Engine.GlobalScope; }
     52    }
     53
     54    public TimeSpan ExecutionTime {
     55      get { return job.Engine.ExecutionTime; }
     56    }
     57
     58    public bool Running {
     59      get { return job.Engine.Running; }
     60    }
     61
     62    public bool Canceled {
     63      get { return job.Engine.Canceled; }
     64    }
     65
     66    public bool Terminated {
     67      get { return job.Engine.Terminated; }
     68    }
     69
     70    public void Execute() {
     71      IExecutionEngineFacade executionEngineFacade = ServiceLocator.CreateExecutionEngineFacade(HiveServerUrl);
     72      HeuristicLab.Hive.Contracts.BusinessObjects.Job jobObj = new HeuristicLab.Hive.Contracts.BusinessObjects.Job();
     73      jobObj.SerializedJob = PersistenceManager.SaveToGZip(job);
     74      executionEngineFacade.AddJob(jobObj);
     75    }
     76
     77    public void ExecuteStep() {
     78      throw new NotSupportedException();
     79    }
     80
     81    public void ExecuteSteps(int steps) {
     82      throw new NotSupportedException();
     83    }
     84
     85    public void Abort() {
     86      throw new NotImplementedException();
     87    }
     88
     89    public void Reset() {
     90      throw new NotImplementedException();
     91    }
     92
     93    public event EventHandler Initialized;
     94
     95    public event EventHandler<OperationEventArgs> OperationExecuted;
     96
     97    public event EventHandler<ExceptionEventArgs> ExceptionOccurred;
     98
     99    public event EventHandler ExecutionTimeChanged;
     100
     101    public event EventHandler Finished;
     102
     103    #endregion
     104
     105    public void RequestSnapshot() {
     106      throw new NotImplementedException();
     107    }
     108
    40109    public override IView CreateView() {
    41110      return new HiveEngineEditor(this);
    42111    }
    43112
    44     /// <summary>
    45     /// Creates a new instance of <see cref="HiveEngineEditor"/>.
    46     /// </summary>
    47     /// <returns>The created editor as <see cref="HiveEngineEditor"/>.</returns>
    48     public virtual IEditor CreateEditor() {
     113    #region IEditable Members
     114
     115    public IEditor CreateEditor() {
    49116      return new HiveEngineEditor(this);
    50117    }
    51 
    52     /// <summary>
    53     /// Aborts the current operator.
    54     /// </summary>
    55     /// <remarks>Calls <see cref="EngineBase.Abort"/> of base class <see cref="EngineBase"/> and
    56     /// <see cref="IOperator.Abort"/> of the current <see cref="IOperator"/>.</remarks>
    57     public override void Abort() {
    58       base.Abort();
    59       if (currentOperator != null)
    60         currentOperator.Abort();
    61     }
    62 
    63     /// <summary>
    64     /// Deals with the next operation, if it is an <see cref="AtomicOperation"/> it is executed,
    65     /// if it is a <see cref="CompositeOperation"/> its single operations are pushed on the execution stack.
    66     /// </summary>
    67     /// <remarks>If an error occurs during the execution the operation is aborted and the operation
    68     /// is pushed on the stack again.<br/>
    69     /// If the execution was successful <see cref="EngineBase.OnOperationExecuted"/> is called.</remarks>
    70     protected override void ProcessNextOperation() {
    71       IOperation operation = myExecutionStack.Pop();
    72       if (operation is AtomicOperation) {
    73         AtomicOperation atomicOperation = (AtomicOperation)operation;
    74         IOperation next = null;
    75         try {
    76           currentOperator = atomicOperation.Operator;
    77           next = atomicOperation.Operator.Execute(atomicOperation.Scope);
    78         }
    79         catch (Exception ex) {
    80           // push operation on stack again
    81           myExecutionStack.Push(atomicOperation);
    82           Abort();
    83           ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex);});
    84         }
    85         if (next != null)
    86           myExecutionStack.Push(next);
    87         OnOperationExecuted(atomicOperation);
    88         if (atomicOperation.Operator.Breakpoint) Abort();
    89       } else if (operation is CompositeOperation) {
    90         CompositeOperation compositeOperation = (CompositeOperation)operation;
    91         for (int i = compositeOperation.Operations.Count - 1; i >= 0; i--)
    92           myExecutionStack.Push(compositeOperation.Operations[i]);
    93       }
    94     }
     118    #endregion
    95119  }
    96120}
  • trunk/sources/HeuristicLab.Hive.Engine/HiveEngineEditor.cs

    r1432 r1440  
    4141    public HiveEngine HiveEngine {
    4242      get { return (HiveEngine)Engine; }
    43       set { base.Engine = value; }
     43      set {
     44        base.Engine = value;
     45        SetDataBinding();
     46      }
    4447    }
    4548
     
    5962      HiveEngine = hiveEngine;
    6063    }
     64
     65    private void SetDataBinding() {
     66      urlTextBox.DataBindings.Add("Text", HiveEngine, "HiveServerUrl");
     67    }
    6168  }
    6269}
Note: See TracChangeset for help on using the changeset viewer.