Changeset 9227 for branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
- Timestamp:
- 02/19/13 08:46:01 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
r9215 r9227 6 6 using HeuristicLab.Services.Optimization.ControllerService.Interfaces; 7 7 using HeuristicLab.Services.Optimization.ControllerService.Model; 8 using HeuristicLab.Services.Optimization.ControllerService.General; 8 9 9 10 namespace HeuristicLab.Services.Optimization.ControllerService { … … 120 121 121 122 122 public bool SaveExperiment(User user, Experiment experiment) { 123 return hiveManager.SaveExperiment(user, experiment); 123 public bool SaveExperiment(User user, Experiment experiment) { 124 // make sure all algorithms store their choices aswell 125 var scenarioMap = new Dictionary<string, OptimizationScenario>(); 126 var algos = new Stack<Algorithm>(); 127 foreach (var algo in experiment.Algorithm) algos.Push(algo); 128 129 130 131 while (algos.Count > 0) { 132 var algo = algos.Pop(); 133 if (algo.ChildAlgorithms != null) 134 foreach (var child in algo.ChildAlgorithms) algos.Push(child); 135 136 if (AlgorithmHelper.HasToBeUpdated(algo)) { 137 OptimizationScenario scenario; 138 if (!scenarioMap.TryGetValue(algo.Name, out scenario)) { 139 scenario = GetOptimizationScenarioByName(algo.Name); 140 scenarioMap[algo.Name] = scenario; 141 } 142 143 AlgorithmHelper.Update(algo, scenario); 144 } 145 } 146 147 // finally store the experiment 148 var success = hiveManager.SaveExperiment(user, experiment); 149 // if it has been stored, and jobdetails are present, run the job! 150 if (success && experiment.JobDetails != null) { 151 return ScheduleExperiment(user, experiment.Name, experiment.JobDetails); 152 } 153 return success; 124 154 } 125 155 … … 142 172 return hiveManager.GetTaskData(u, jobId, taskId); 143 173 } 174 175 176 public Experiment GetExperimentByName(User user, string scenario) { 177 return hiveManager.GetExperimentByName(user, scenario); 178 } 179 180 181 public bool ScheduleExperiment(User user, string experiment, JobExecutionDetails details) { 182 var exp = hiveManager.GetExperimentByName(user, experiment); 183 return hiveManager.DispatchExperiment(user, exp, details); 184 } 144 185 } 145 186 }
Note: See TracChangeset
for help on using the changeset viewer.