- Timestamp:
- 09/08/11 16:38:28 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/Tasks
- Files:
-
- 1 added
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs
r6717 r6725 7 7 namespace HeuristicLab.Clients.Hive { 8 8 [StorableClass] 9 public class Engine Job : ItemJob{9 public class EngineTask : ItemTask { 10 10 [Storable] 11 11 protected IOperation initialOperation; … … 29 29 30 30 #region constructors and cloning 31 public Engine Job() { }32 public Engine Job(IOperation initialOperation, IEngine engine) {31 public EngineTask() { } 32 public EngineTask(IOperation initialOperation, IEngine engine) { 33 33 this.initialOperation = initialOperation; 34 34 this.Item = engine; … … 36 36 37 37 [StorableConstructor] 38 protected Engine Job(bool deserializing) : base(deserializing) { }39 protected Engine Job(EngineJoboriginal, Cloner cloner)38 protected EngineTask(bool deserializing) : base(deserializing) { } 39 protected EngineTask(EngineTask original, Cloner cloner) 40 40 : base(original, cloner) { 41 41 this.initialOperation = cloner.Clone(original.initialOperation); 42 42 } 43 43 public override IDeepCloneable Clone(Cloner cloner) { 44 return new Engine Job(this, cloner);44 return new EngineTask(this, cloner); 45 45 } 46 46 #endregion … … 56 56 Item.Start(); 57 57 } 58 58 59 59 public override void Pause() { 60 60 Item.Pause(); … … 86 86 87 87 private void engine_ExceptionOccurred(object sender, EventArgs<Exception> e) { 88 On JobFailed(e);88 OnTaskFailed(e); 89 89 } 90 90 91 91 private void engine_Stopped(object sender, EventArgs e) { 92 On JobStopped();92 OnTaskStopped(); 93 93 } 94 94 95 95 private void Item_Paused(object sender, EventArgs e) { 96 On JobPaused();96 OnTaskPaused(); 97 97 } 98 98 … … 106 106 107 107 private void Item_Started(object sender, EventArgs e) { 108 On JobStarted();108 OnTaskStarted(); 109 109 } 110 110 … … 134 134 get { return HeuristicLab.Common.Resources.VSImageLibrary.Operator; } 135 135 } 136 136 137 137 public override string ItemName { 138 get { return "Engine Job"; }138 get { return "EngineTask"; } 139 139 } 140 140 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/Tasks/ItemTask.cs
r6721 r6725 28 28 29 29 namespace HeuristicLab.Clients.Hive { 30 [Item("Item Task", "Represents a executable hive jobwhich contains a HeuristicLab Item.")]30 [Item("Item Task", "Represents a executable hive task which contains a HeuristicLab Item.")] 31 31 [StorableClass] 32 public abstract class Item Job : NamedItem, IJob{32 public abstract class ItemTask : NamedItem, ITask { 33 33 public virtual bool IsParallelizable { 34 34 get { return true; } … … 62 62 63 63 #region Constructors and Cloning 64 public Item Job() { }64 public ItemTask() { } 65 65 66 66 [StorableConstructor] 67 protected Item Job(bool deserializing) { }68 protected Item Job(ItemJoboriginal, Cloner cloner)67 protected ItemTask(bool deserializing) { } 68 protected ItemTask(ItemTask original, Cloner cloner) 69 69 : base(original, cloner) { 70 70 this.ComputeInParallel = original.ComputeInParallel; … … 98 98 #endregion 99 99 100 #region I JobMembers100 #region ITask Members 101 101 102 102 public abstract ExecutionState ExecutionState { get; } … … 112 112 public abstract void Stop(); 113 113 114 public event EventHandler JobStarted;115 protected virtual void On JobStarted() {116 EventHandler handler = JobStarted;117 if (handler != null) handler(this, EventArgs.Empty); 118 } 119 120 public event EventHandler JobStopped;121 protected virtual void On JobStopped() {122 EventHandler handler = JobStopped;123 if (handler != null) handler(this, EventArgs.Empty); 124 } 125 126 public event EventHandler JobPaused;127 protected virtual void On JobPaused() {128 EventHandler handler = JobPaused;129 if (handler != null) handler(this, EventArgs.Empty); 130 } 131 132 public event EventHandler JobFailed;133 protected virtual void On JobFailed(EventArgs<Exception> e) {134 EventHandler handler = JobFailed;114 public event EventHandler TaskStarted; 115 protected virtual void OnTaskStarted() { 116 EventHandler handler = TaskStarted; 117 if (handler != null) handler(this, EventArgs.Empty); 118 } 119 120 public event EventHandler TaskStopped; 121 protected virtual void OnTaskStopped() { 122 EventHandler handler = TaskStopped; 123 if (handler != null) handler(this, EventArgs.Empty); 124 } 125 126 public event EventHandler TaskPaused; 127 protected virtual void OnTaskPaused() { 128 EventHandler handler = TaskPaused; 129 if (handler != null) handler(this, EventArgs.Empty); 130 } 131 132 public event EventHandler TaskFailed; 133 protected virtual void OnTaskFailed(EventArgs<Exception> e) { 134 EventHandler handler = TaskFailed; 135 135 if (handler != null) handler(this, e); 136 136 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs
r6721 r6725 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; 26 using HeuristicLab.Hive;27 25 using HeuristicLab.Optimization; 28 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 31 29 [Item("Optimizer Task", "Represents Task which executes a IOptimizer object.")] 32 30 [StorableClass] 33 public class Optimizer Job : ItemJob{31 public class OptimizerTask : ItemTask { 34 32 public override bool IsParallelizable { 35 33 get { return this.Item is Experiment || this.Item is BatchRun; } … … 48 46 } 49 47 50 public Optimizer Job() : base() { }51 public Optimizer Job(IOptimizer optimizer)48 public OptimizerTask() : base() { } 49 public OptimizerTask(IOptimizer optimizer) 52 50 : this() { 53 51 this.Item = optimizer; … … 62 60 } 63 61 [StorableConstructor] 64 protected Optimizer Job(bool deserializing) { }65 protected Optimizer Job(OptimizerJoboriginal, Cloner cloner)62 protected OptimizerTask(bool deserializing) { } 63 protected OptimizerTask(OptimizerTask original, Cloner cloner) 66 64 : base(original, cloner) { 67 65 this.IndexInParentOptimizerList = original.IndexInParentOptimizerList; 68 66 } 69 67 public override IDeepCloneable Clone(Cloner cloner) { 70 return new Optimizer Job(this, cloner);68 return new OptimizerTask(this, cloner); 71 69 } 72 70 … … 85 83 } 86 84 87 #region I JobMembers85 #region ITask Members 88 86 public override ExecutionState ExecutionState { 89 87 get { return Item.ExecutionState; } … … 101 99 if ((Item is Experiment && OptimizerAsExperiment.Optimizers.Count == 0) || // experiment would not fire OnStopped if it has 0 optimizers 102 100 (Item is BatchRun && OptimizerAsBatchRun.Optimizer == null)) { // batchrun would not fire OnStopped if algorithm == null 103 On JobStopped();101 OnTaskStopped(); 104 102 } else { 105 103 Item.Start(); … … 156 154 157 155 protected virtual void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) { 158 On JobFailed(e);156 OnTaskFailed(e); 159 157 } 160 158 161 159 protected virtual void optimizer_Started(object sender, EventArgs e) { 162 On JobStarted();160 OnTaskStarted(); 163 161 } 164 162 165 163 protected virtual void optimizer_Stopped(object sender, EventArgs e) { 166 On JobStopped();164 OnTaskStopped(); 167 165 } 168 166 169 167 protected virtual void optimizer_Paused(object sender, EventArgs e) { 170 On JobPaused();168 OnTaskPaused(); 171 169 } 172 170
Note: See TracChangeset
for help on using the changeset viewer.