Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/16/08 16:47:43 (16 years ago)
Author:
kgrading
Message:

Implemented the Execution Engine, modified some parts of the JobBase (#358)

Location:
trunk/sources/HeuristicLab.Hive.Client.Core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Core/Core.cs

    r749 r768  
    2424using System.Linq;
    2525using System.Text;
     26using HeuristicLab.Hive.Client.ExecutionEngine;
    2627using HeuristicLab.Hive.Client.Common;
     28using System.Threading;
     29
    2730
    2831namespace HeuristicLab.Hive.Client.Core {
    2932  public class Core {
     33
     34    Dictionary<long, Executor> engines = new Dictionary<long, Executor>();
     35   
    3036    public void Start() {
    3137      Logging.getInstance().Info(this.ToString(), "Info Message");
    32       Logging.getInstance().Error(this.ToString(), "Error Message");
    33       Logging.getInstance().Error(this.ToString(), "Exception Message", new Exception("Exception"));     
     38      //Logging.getInstance().Error(this.ToString(), "Error Message");
     39      //Logging.getInstance().Error(this.ToString(), "Exception Message", new Exception("Exception"));     
    3440
    3541      Heartbeat beat = new Heartbeat();
    36       beat.Interval = 1000;
     42      beat.Interval = 5000;
    3743      beat.StartHeartbeat();
    38       ConfigurationManager.GetInstance().Connect(Guid.Empty);
    39       TestJob job = new TestJob();
    40       job.Start();
    41          
     44
    4245      MessageQueue queue = MessageQueue.GetInstance();
     46     
     47      JobBase job = new TestJob();
     48     
     49      ExecutionEngine.Executor engine = new ExecutionEngine.Executor();
     50      engine.Job = job;
     51      engine.JobId = 1L;
     52      engine.Queue = queue;     
     53      engine.Start();
     54      engines.Add(engine.JobId, engine);
    4355
     56      Thread.Sleep(15000);
     57      engine.RequestSnapshot();
    4458      while (true) {
    4559        MessageContainer container = queue.GetMessage();
    46         Console.WriteLine(container.Message.ToString());
     60        Logging.getInstance().Info(this.ToString(), container.Message.ToString());
     61        DetermineAction(container);
     62
     63       
    4764      }
    4865    }
     66
     67    private void DetermineAction(MessageContainer container) {
     68      if(container.Message == MessageContainer.MessageType.AbortJob)
     69        engines[container.JobId].Abort();
     70      else if (container.Message == MessageContainer.MessageType.JobAborted)
     71        //kill appdomain
     72        Console.WriteLine("tmp");
     73      else if (container.Message == MessageContainer.MessageType.RequestSnapshot)
     74        engines[container.JobId].RequestSnapshot();
     75      else if (container.Message == MessageContainer.MessageType.SnapshotReady)
     76        // must be async!
     77        engines[container.JobId].GetSnapshot();
     78    }       
    4979  }
    5080}
  • trunk/sources/HeuristicLab.Hive.Client.Core/Heartbeat.cs

    r739 r768  
    6161    void heartbeatTimer_Elapsed(object sender, ElapsedEventArgs e) {
    6262      Console.WriteLine("tick");
    63       MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.FetchJob);
     63      //MessageQueue.GetInstance().AddMessage(MessageContainer.MessageType.FetchJob);
    6464    }
    6565
  • trunk/sources/HeuristicLab.Hive.Client.Core/HeuristicLab.Hive.Client.Core.csproj

    r742 r768  
    8686      <Name>HeuristicLab.Hive.Client.Common</Name>
    8787    </ProjectReference>
     88    <ProjectReference Include="..\HeuristicLab.Hive.Client.ExecutionEngine\HeuristicLab.Hive.Client.ExecutionEngine.csproj">
     89      <Project>{1605256A-1CB3-44AB-AAFF-577093EE5789}</Project>
     90      <Name>HeuristicLab.Hive.Client.ExecutionEngine</Name>
     91    </ProjectReference>
    8892    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
    8993      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
Note: See TracChangeset for help on using the changeset viewer.