Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Hive.Engine/HiveEngine.cs @ 1454

Last change on this file since 1454 was 1440, checked in by gkronber, 15 years ago

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

File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using HeuristicLab.Core;
26using System.Threading;
27using HeuristicLab.Hive.JobBase;
28using HeuristicLab.Hive.Contracts.Interfaces;
29
30namespace HeuristicLab.Hive.Engine {
31  /// <summary>
32  /// Represents an engine that executes its operator-graph on the hive.
33  /// in parallel.
34  /// </summary>
35  public class HiveEngine : ItemBase, IEngine, IEditable {
36    private Job job;
37    public string HiveServerUrl { get; set; }
38
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
109    public override IView CreateView() {
110      return new HiveEngineEditor(this);
111    }
112
113    #region IEditable Members
114
115    public IEditor CreateEditor() {
116      return new HiveEngineEditor(this);
117    }
118    #endregion
119  }
120}
Note: See TracBrowser for help on using the repository browser.