- Timestamp:
- 01/15/13 15:50:53 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Controller
- Files:
-
- 5 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Azure/DAL.cs
r8958 r9166 6 6 using Microsoft.WindowsAzure; 7 7 using Microsoft.WindowsAzure.StorageClient; 8 using Microsoft.WindowsAzure.ServiceRuntime; 9 using System.Diagnostics; 8 10 9 11 namespace HeuristicLab.Services.Optimization.ControllerService.Azure { … … 98 100 get { 99 101 if (storageAccount == null) { 100 storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(AzureConstants.CLOUD_SETTINGS_KEY)); 102 try { 103 storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(AzureConstants.CLOUD_SETTINGS_KEY)); 104 } 105 catch (Exception ex) { 106 Trace.WriteLine(ex.Message); 107 storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=optimizationstorage1;AccountKey=n7Leom8ZFWkof/VQ2a4aRSvwOlX+Gwr3uojQF9CFJw1osmGCV0WwaNC8s7nkZ+qteLduAgW2l75WFpbXrkvG4Q=="); 108 } 101 109 } 102 110 return storageAccount; -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HLMapper.cs
r8958 r9166 11 11 namespace HeuristicLab.Services.Optimization.ControllerService { 12 12 public interface IScenarioMapper { 13 void MapScenario(OptimizationScenario scenario, IAlgorithm algorithm);13 void MapScenario(OptimizationScenario scenario, out IAlgorithm algorithm); 14 14 } 15 15 … … 18 18 var dv = parameter.Value as DecimalValue; 19 19 return new DoubleValue(dv.Value); 20 } 21 22 public static T Create<T>(Parameter typeParameter) { 23 var type = Type.GetType((typeParameter.Value as TypeValue).Value); 24 return (T)Activator.CreateInstance(type, null); 20 25 } 21 26 -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveMapper.cs
r8958 r9166 7 7 namespace HeuristicLab.Services.Optimization.ControllerService.Model { 8 8 public static class HiveMapper { 9 public static double FindDoubleValue(this InputParameters ip, string what) {9 public static double FindDoubleValue(this ProblemParameters ip, string what) { 10 10 foreach (var param in ip.Items) { 11 11 if (param.Value.Name == what) { -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs
r9062 r9166 20 20 using HeuristicLab.Services.Optimization.ControllerService.Azure; 21 21 using System.Data; 22 using HeuristicLab.Services.Optimization.ControllerService.General; 22 23 23 24 namespace HeuristicLab.Services.Optimization.ControllerService { … … 43 44 private static object lockable; 44 45 private Dictionary<string, IScenarioMapper> mappers = new Dictionary<string, IScenarioMapper>(); 45 private IDataAccessLayer dal = new AzureDataAccessLayer();46 private IDataAccessLayer dal = DataAccessLayerProvider.GetLayer(); 46 47 47 48 public static readonly string SCENARIO_TABLE = "Scenario"; … … 51 52 } 52 53 53 public void DispatchScenario(Model.User user, Model.OptimizationScenario scenario ) {54 Experiment experiment = new Experiment();55 var problem = new TravelingSalesmanProblem();56 var algo = new GeneticAlgorithm();57 algo.Problem = problem;54 public void DispatchScenario(Model.User user, Model.OptimizationScenario scenario, JobExecutionDetails details) { 55 // Experiment experiment = new Experiment(); 56 // var problem = new TravelingSalesmanProblem(); 57 // var algo = new GeneticAlgorithm(); 58 // algo.Problem = problem; 58 59 59 60 IScenarioMapper mapper = GetMapper(scenario); 60 mapper.MapScenario(scenario, algo); 61 62 //experiment.Optimizers.Add(algo); 63 SendExperimentToHive(user, algo); 61 IAlgorithm algo; 62 mapper.MapScenario(scenario, out algo); 63 if (details.Repititions > 1) { 64 BatchRun br = new BatchRun(); 65 //br.Name = details.JobTitle; 66 br.Optimizer = algo; 67 br.Repetitions = details.Repititions; 68 SendExperimentToHive(user, br, details); 69 } 70 else { 71 SendExperimentToHive(user, algo, details); 72 } 64 73 } 65 74 … … 73 82 } 74 83 75 p rivateIScenarioMapper CompileMapper(string scenarioMapper) {84 public static IScenarioMapper CompileMapper(string scenarioMapper) { 76 85 // http://stackoverflow.com/questions/3188882/compile-and-run-dynamic-code-without-generating-exe 77 86 using (var csCodeProvider = new Microsoft.CSharp.CSharpCodeProvider()) { … … 105 114 106 115 private IScenarioMapper GetMapper(Model.OptimizationScenario scenario) { 107 if (!mappers.ContainsKey(scenario.Name)) { 116 var id = scenario.Id; 117 if (!mappers.ContainsKey(id)) { 108 118 lock (lockable) { 109 if (mappers.ContainsKey( scenario.Name))110 return mappers[ scenario.Name];119 if (mappers.ContainsKey(id)) 120 return mappers[id]; 111 121 112 var mapperString = GetMapperFromBlobStore( scenario.Name);122 var mapperString = GetMapperFromBlobStore(id); 113 123 var mapper = CompileMapper(mapperString); 114 124 115 mappers[ scenario.Name] = mapper;125 mappers[id] = mapper; 116 126 return mapper; 117 127 } // lock … … 120 130 } 121 131 122 private void MapExperiment(Model.OptimizationScenario scenario, IAlgorithm algorithm) {132 private void MapExperiment(Model.OptimizationScenario scenario, out IAlgorithm algorithm) { 123 133 IScenarioMapper mapper = GetMapper(scenario); 124 mapper.MapScenario(scenario, algorithm); 125 } 126 127 private void SendExperimentToHive(Model.User user, IAlgorithm exp) { 134 mapper.MapScenario(scenario, out algorithm); 135 } 136 137 private void ConfigureHive(Model.User user) { 138 HiveServiceLocator.Instance.Username = user.Username; 139 HiveServiceLocator.Instance.Password = user.Password; 140 HiveServiceLocator.Instance.EndpointConfigurationName = Configuration.HiveEndpointName; 141 } 142 143 private void SendExperimentToHive(Model.User user, IOptimizer exp, JobExecutionDetails details) { 128 144 var job = new RefreshableJob(); 129 145 job.IsAllowedPrivileged = true; 130 job.Job.Name = "Web Scheduled Traveling Salesman Job"; 131 job.Job.ResourceNames = "TESTGROUP"; 132 job.RefreshAutomatically = false; 146 job.Job.Name = details.JobTitle; 147 job.Job.ResourceNames = details.Group; 148 job.RefreshAutomatically = false; 149 if (exp.ExecutionState != ExecutionState.Prepared) { 150 exp.Prepare(); 151 } 133 152 job.HiveTasks.Add(new OptimizerHiveTask(exp)); 134 HiveServiceLocator.Instance.Username = user.Username; 135 HiveServiceLocator.Instance.Password = user.Password; 136 HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService"; 153 ConfigureHive(user); 137 154 138 155 HiveClient.StartJob((ex) => { … … 145 162 146 163 public IList<Model.Job> GetJobs(User user) { 147 HiveServiceLocator.Instance.Username = user.Username; 148 HiveServiceLocator.Instance.Password = user.Password; 149 HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService"; 164 ConfigureHive(user); 150 165 var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.Job>>(s => s.GetJobs()); 151 166 IList<Model.Job> jobs = new List<Model.Job>(); 152 167 153 168 foreach (var job in jobsLoaded) { 154 169 jobs.Add(ConvertJob(user, job)); … … 163 178 if (job.CalculatingCount > 0) 164 179 state = JobState.Calculating; 165 else if (job.JobCount == job.FinishedCount)180 else if (job.JobCount > 0 && job.JobCount == job.FinishedCount) 166 181 state = JobState.Finished; 167 182 else 168 183 state = JobState.Waiting; 169 /*var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(job.Id));170 171 foreach (var task in jobTasks) {172 switch (task.State) {173 case TaskState.Aborted:174 state = JobState.Aborted;175 break;176 case TaskState.Failed:177 state = JobState.Failed;178 break;179 }180 }181 if (!state.HasValue) {182 if (job.CalculatingCount > 0)183 state = JobState.Calculating;184 else if (waitingJobs > 0)185 state = JobState.Waiting;186 else187 state = JobState.Finished;188 }*/189 184 return new Model.Job() { Id = job.Id.ToString(), Name = job.Name, Resource = job.ResourceNames, State = state.Value, DateCreated = job.DateCreated }; 190 185 } … … 192 187 193 188 public Model.Job GetJob(User user, string id) { 194 HiveServiceLocator.Instance.Username = user.Username; 195 HiveServiceLocator.Instance.Password = user.Password; 196 HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService"; 189 ConfigureHive(user); 197 190 var guid = Guid.Parse(id); 198 191 return ConvertJob(user, HiveServiceLocator.Instance.CallHiveService<HeuristicLab.Clients.Hive.Job>(s => s.GetJob(guid))); … … 201 194 202 195 public void DeleteJob(User user, string id) { 203 HiveServiceLocator.Instance.Username = user.Username; 204 HiveServiceLocator.Instance.Password = user.Password; 205 HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService"; 196 ConfigureHive(user); 206 197 var guid = Guid.Parse(id); 207 198 HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(guid)); … … 209 200 210 201 public IList<Model.Run> GetJobResults(User user, string id) { 211 HiveServiceLocator.Instance.Username = user.Username; 212 HiveServiceLocator.Instance.Password = user.Password; 213 HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService"; 202 ConfigureHive(user); 214 203 var guid = Guid.Parse(id); 215 204 var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(guid)); -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/ScenarioParser.cs
r8958 r9166 9 9 using HeuristicLab.Services.Optimization.ControllerService.Azure; 10 10 using HeuristicLab.Services.Optimization.ControllerService.Interfaces; 11 using System.Diagnostics; 11 12 12 13 namespace HeuristicLab.Services.Optimization.ControllerService { … … 15 16 private static object lockable = new object(); 16 17 17 private IDataAccessLayer dal = new AzureDataAccessLayer();18 private IDataAccessLayer dal = DataAccessLayerProvider.GetLayer(); 18 19 19 20 public IList<Model.OptimizationScenario> Scenarios { … … 32 33 public Model.OptimizationScenario GetByName(string name) { 33 34 foreach (var scen in Scenarios) { 34 if (scen. Name== name) {35 if (scen.Id == name) { 35 36 return scen; 36 37 } … … 115 116 } */ 116 117 118 private Model.Problem ParseProblem(XmlReader reader) { 119 var problem = new Model.Problem(); 120 while (reader.Read()) { 121 if (reader.NodeType == XmlNodeType.EndElement) 122 break; 123 if (reader.Name == "parameters") 124 problem.Parameters.Items = ParseParameters(reader); 125 } 126 return problem; 127 } 128 129 private void ParseAlgorithms(out IList<Model.Algorithm> algos, XmlReader reader) { 130 algos = new List<Model.Algorithm>(); 131 var depth = reader.Depth; 132 do { 133 if (reader.Name == "algorithm" && reader.Depth == depth) { 134 var innerAlg = new Model.Algorithm(); 135 algos.Add(innerAlg); 136 137 innerAlg.Mapper = reader.GetAttribute("mapper"); 138 reader.Read(); 139 for (;;) { 140 if (reader.Name == "algorithm" && reader.NodeType == XmlNodeType.EndElement) 141 break; 142 143 if (reader.Name == "parameters" && reader.NodeType == XmlNodeType.Element) { 144 innerAlg.Parameters.Items = ParseParameters(reader); 145 continue; 146 } 147 else if (reader.Name == "problem" && reader.NodeType == XmlNodeType.Element) { 148 innerAlg.Problem = ParseProblem(reader); 149 continue; 150 } 151 else if (reader.Name == "algorithm" && reader.NodeType == XmlNodeType.Element) { 152 IList<Model.Algorithm> childAlgos; 153 ParseAlgorithms(out childAlgos, reader); 154 innerAlg.ChildAlgorithms = childAlgos; 155 //TODO: Test with child algorithms 156 continue; 157 } 158 reader.Read(); 159 } 160 } 161 } while (reader.Read() && reader.Depth >= depth); 162 } 163 164 private Model.OptimizationScenario ParseScenarioElement(XmlReader reader) { 165 var scenario = new Model.OptimizationScenario(); 166 var depth = reader.Depth; 167 while (reader.Depth >= depth) { 168 if (reader.Name == "scenario" && reader.NodeType == XmlNodeType.EndElement) 169 break; 170 171 if (reader.Name == "name") { 172 scenario.Id = reader.ReadElementContentAsString(); 173 continue; 174 } 175 else if (reader.Name == "algorithm") { 176 IList<Model.Algorithm> algos; 177 ParseAlgorithms(out algos, reader); 178 scenario.Algorithm = algos; 179 continue; 180 } 181 reader.Read(); 182 } 183 return scenario; 184 } 185 117 186 private Model.OptimizationScenario ParseScenario(StringReader str) { 118 187 // Set the validation settings. … … 120 189 var settings = GetSettings(); 121 190 settings.ValidationEventHandler += (sender, args) => { 122 Console.WriteLine(args.Message);191 Trace.WriteLine(args.Message); 123 192 isErrorPresent = true; 124 193 }; 125 Model.OptimizationScenario scenario = null; 194 Model.OptimizationScenario scenario = null; 126 195 using (var reader = XmlReader.Create(str, settings)) { 127 while (! isErrorPresent && !reader.EOF) {196 while (!reader.EOF) { 128 197 if (reader.Name == "scenario" && reader.NodeType == XmlNodeType.Element) { 129 scenario = new Model.OptimizationScenario(); 130 scenario.ProblemType = reader.GetAttribute("mapper"); 131 scenario.ProblemType = reader.GetAttribute("algorithmType"); 132 scenario.ProblemType = reader.GetAttribute("problemType"); 133 } 134 else if (reader.Name == "name") { 135 scenario.Name = reader.ReadElementContentAsString(); 136 continue; 137 } 138 else if (reader.Name == "problemParameters") { 139 IList<Model.Parameter> problemParameters = ParseParameters(reader); 140 foreach (var param in problemParameters) 141 scenario.InputParameters.Items.Add(param); 142 } 143 else if (reader.Name == "algorithmParameters") { 144 IList<Model.Parameter> algoParameters = ParseParameters(reader); 145 foreach (var param in algoParameters) 146 scenario.AlgorithmParameters.Items.Add(param); 198 scenario = ParseScenarioElement(reader); 147 199 } 148 200 reader.Read(); … … 185 237 IList<Model.Parameter> parameters = new List<Model.Parameter>(); 186 238 while (reader.Read()) { 187 if (reader.Name .EndsWith("Parameters"))239 if (reader.Name == "parameters" && reader.NodeType == XmlNodeType.EndElement) 188 240 break; 189 241 // parse parameter 190 if (reader. Depth == 2 && reader.Name == "param" && reader.NodeType == XmlNodeType.Element) {242 if (reader.Name == "param" && reader.NodeType == XmlNodeType.Element) { 191 243 var param = new Model.Parameter(); 192 244 var typeAtt = reader.GetAttribute("type"); -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj
r9062 r9166 36 36 <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath> 37 37 </Reference> 38 <Reference Include="HeuristicLab.ALGLIB-3.5.0"> 39 <HintPath>..\bin\HeuristicLab.ALGLIB-3.5.0.dll</HintPath> 40 </Reference> 41 <Reference Include="HeuristicLab.Algorithms.Benchmarks-3.3"> 42 <HintPath>..\bin\HeuristicLab.Algorithms.Benchmarks-3.3.dll</HintPath> 43 </Reference> 38 44 <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3"> 39 45 <HintPath>..\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath> … … 92 98 <HintPath>..\bin\HeuristicLab.Operators-3.3.dll</HintPath> 93 99 </Reference> 100 <Reference Include="HeuristicLab.Operators.Views.GraphVisualization-3.3"> 101 <HintPath>..\bin\HeuristicLab.Operators.Views.GraphVisualization-3.3.dll</HintPath> 102 </Reference> 94 103 <Reference Include="HeuristicLab.Optimization-3.3"> 95 104 <HintPath>..\HeuristicLab.Optimization\3.3\obj\Debug\HeuristicLab.Optimization-3.3.dll</HintPath> … … 129 138 <SpecificVersion>False</SpecificVersion> 130 139 <HintPath>..\bin\HeuristicLab.Selection-3.3.dll</HintPath> 140 </Reference> 141 <Reference Include="HeuristicLab.SequentialEngine-3.3"> 142 <HintPath>..\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath> 131 143 </Reference> 132 144 <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> … … 153 165 <ItemGroup> 154 166 <Compile Include="Azure\DAL.cs" /> 155 <Compile Include=" HL\HiveScenarioManagerOld.cs" />167 <Compile Include="General\Configuration.cs" /> 156 168 <Compile Include="HL\HiveMapper.cs" /> 157 169 <Compile Include="HL\HiveScenarioManager.cs" /> … … 161 173 <Compile Include="Interfaces\IScenarioManager.cs" /> 162 174 <Compile Include="Interfaces\Model\ControllerModel.cs" /> 175 <Compile Include="Mockup\MockupDAL.cs" /> 176 <Compile Include="Mockup\MockupScenarioManager.cs" /> 163 177 <Compile Include="PlaceholderControllerService.cs" /> 164 178 <Compile Include="Properties\AssemblyInfo.cs" /> … … 172 186 <None Include="packages.config" /> 173 187 </ItemGroup> 188 <ItemGroup /> 174 189 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 175 190 <PropertyGroup> -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs
r8958 r9166 27 27 IBlobDao CreateBlobDao(); 28 28 } 29 30 public static class DataAccessLayerProvider { 31 private static IDataAccessLayer layer = new Azure.AzureDataAccessLayer(); 32 //private static IDataAccessLayer layer = new Mockup.MockupDataAccessLayer(); 33 34 public static IDataAccessLayer GetLayer() { 35 return layer; 36 } 37 } 29 38 } 30 39 -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs
r8958 r9166 20 20 21 21 [OperationContract] 22 void ScheduleOptimizationScenario(User user, OptimizationScenario scenario );22 void ScheduleOptimizationScenario(User user, OptimizationScenario scenario, JobExecutionDetails details); 23 23 24 24 [OperationContract] -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs
r8958 r9166 7 7 namespace HeuristicLab.Services.Optimization.ControllerService.Interfaces { 8 8 public interface IScenarioManager { 9 void DispatchScenario(User user, OptimizationScenario scenario );9 void DispatchScenario(User user, OptimizationScenario scenario, JobExecutionDetails details); 10 10 IList<Job> GetJobs(User user); 11 11 Job GetJob(User user, string id); -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs
r9062 r9166 45 45 public string[] RowNames { get; set; } 46 46 47 public void CopyRow(int index) { 48 var newData = new double[Value.Length + 1][]; 49 var copyRow = new double[Value[index].Length]; 50 for (var i = 0; i < copyRow.Length; i++) { 51 copyRow[i] = Value[index][i]; 52 } 53 for (var i = 0; i < newData.Length; i++) { 54 if (i < index) { 55 newData[i] = Value[i]; 56 } 57 else if (i == index) { 58 newData[i] = copyRow; 59 } 60 else if (i > index) { 61 newData[i] = Value[i - 1]; 62 } 63 } 64 Value = newData; 65 } 66 67 public void DeleteRow(int index) { 68 if (Value.Length == 1) 69 return; 70 71 var newData = new double[Value.Length - 1][]; 72 for (var i = 0; i < Value.Length; i++) { 73 if (i < index) { 74 newData[i] = Value[i]; 75 } 76 else if (i > index) { 77 newData[i - 1] = Value[i]; 78 } 79 } 80 Value = newData; 81 } 82 47 83 public override bool TrySetFromString(string input) { 48 84 var splitted = input.Split(':'); … … 61 97 return false; 62 98 // very, very buggy 63 if (i >= Value.Length || j >= Value[0].Length ) {99 /*if (i >= Value.Length || j >= Value[0].Length ) { 64 100 double[][] valueArr = new double[i >= Value.GetLength(0) ? i : Value.GetLength(0)][]; 65 101 for (int k = 0; k < Value.Length; k++) { … … 70 106 } 71 107 Value = valueArr; 72 } 108 }*/ 73 109 74 110 Value[i][j] = value; … … 186 222 187 223 [DataContract] 188 public class InputParameters {224 public class ProblemParameters { 189 225 private IList<Parameter> items = new List<Parameter>(); 190 226 … … 226 262 227 263 [DataContract] 264 public class Problem { 265 public Problem() { Parameters = new ProblemParameters(); } 266 267 [DataMember] 268 public ProblemParameters Parameters { get; set; } 269 270 [DataMember] 271 public string Class { get; set; } 272 } 273 274 [DataContract] 275 public class Algorithm { 276 public Algorithm() { Parameters = new AlgorithmParameters(); } 277 278 [DataMember] 279 public AlgorithmParameters Parameters { get; set; } 280 281 [DataMember] 282 public Problem Problem{ get; set; } 283 284 [DataMember] 285 public IList<Algorithm> ChildAlgorithms { get; set; } 286 287 [DataMember] 288 public string Class { get; set; } 289 290 [DataMember] 291 public string Mapper { get; set; } 292 } 293 294 [DataContract] 228 295 public class OptimizationScenario { 229 296 [DataMember] 297 public string Id { get; set; } 298 299 [DataMember] 300 public IList<Algorithm> Algorithm { get; set; } 301 302 public Algorithm FirstAlgorithm { get { return Algorithm.FirstOrDefault(); } } 303 } 304 305 [DataContract] 306 public class Experiment { 307 [DataMember] 308 public IList<OptimizationScenario> Scenarios { get; set; } 309 310 public Experiment() { 311 Scenarios = new List<OptimizationScenario>(); 312 } 313 } 314 315 [DataContract] 316 public enum JobState { 317 [EnumMember] 318 Waiting, 319 [EnumMember] 320 Calculating, 321 [EnumMember] 322 Aborted, 323 [EnumMember] 324 Failed, 325 [EnumMember] 326 Finished 327 } 328 329 [DataContract] 330 public class JobExecutionDetails { 331 [DataMember] 332 public int Repititions { get; set; } 333 334 [DataMember] 335 public string JobTitle { get; set; } 336 337 [DataMember] 338 public string Group { get; set; } 339 } 340 341 [DataContract] 342 public class Job { 343 [DataMember] 344 public string Id { get; set; } 345 346 [DataMember] 347 public JobState State { get; set; } 348 349 [DataMember] 230 350 public string Name { get; set; } 231 351 232 352 [DataMember] 233 public string ProblemType { get; set; } 234 235 [DataMember] 236 public string AlgorithmType { get; set; } 237 238 [DataMember] 239 public string MapperType { get; set; } 240 241 private InputParameters inputParams = new InputParameters(); 242 243 [DataMember] 244 public InputParameters InputParameters { 245 get { return inputParams; } 246 set { inputParams = value; } 247 } 248 249 250 private AlgorithmParameters algorithmParameters = new AlgorithmParameters(); 251 252 [DataMember] 253 public AlgorithmParameters AlgorithmParameters { 254 get { return algorithmParameters; } 255 set { algorithmParameters = value; } 256 } 257 } 258 259 [DataContract] 260 public enum JobState { 261 [EnumMember] 262 Waiting, 263 [EnumMember] 264 Calculating, 265 [EnumMember] 266 Aborted, 267 [EnumMember] 268 Failed, 269 [EnumMember] 270 Finished 271 } 272 273 [DataContract] 274 public class Job { 353 public string Resource { get; set; } 354 355 [DataMember] 356 public DateTime DateCreated { get; set; } 357 } 358 359 [DataContract] 360 public class Run { 275 361 [DataMember] 276 362 public string Id { get; set; } 277 363 278 364 [DataMember] 279 public JobState State { get; set; }280 281 [DataMember]282 365 public string Name { get; set; } 283 366 284 367 [DataMember] 285 public string Resource { get; set; }286 287 [DataMember]288 public DateTime DateCreated { get; set; }289 }290 291 [DataContract]292 public class Run {293 [DataMember]294 public string Id { get; set; }295 296 [DataMember]297 public string Name { get; set; }298 299 [DataMember]300 368 public IList<Parameter> Results { get; set; } 301 369 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs
r8958 r9166 51 51 this.scenarios = new List<Model.OptimizationScenario>() { tsp };*/ 52 52 //hiveManager.DispatchScenario(tsp); 53 //hiveManager = new MockupScenarioManager(); 53 54 hiveManager = new HiveScenarioManager(); 54 55 scenarios = parser.Scenarios; … … 63 64 public Model.OptimizationScenario GetOptimizationScenarioByName(string name) { 64 65 var scen = (from e in scenarios 65 where e. Name== name66 where e.Id == name 66 67 select e).FirstOrDefault(); 67 68 return scen; 68 69 } 69 70 70 public void ScheduleOptimizationScenario(Model.User user, Model.OptimizationScenario scenario ) {71 hiveManager.DispatchScenario(user, scenario );71 public void ScheduleOptimizationScenario(Model.User user, Model.OptimizationScenario scenario, JobExecutionDetails details) { 72 hiveManager.DispatchScenario(user, scenario, details); 72 73 } 73 74 … … 97 98 return false; 98 99 } 99 var added = hiveManager.AddScenario(user, scenario. Name, scenarioXml, scenarioMapper);100 var added = hiveManager.AddScenario(user, scenario.Id, scenarioXml, scenarioMapper); 100 101 if (added) 101 102 scenarios.Add(scenario); … … 114 115 public IEnumerable<string> GetOptimizationScenarioNames() { 115 116 return (from e in scenarios 116 select e. Name).AsEnumerable();117 select e.Id).AsEnumerable(); 117 118 } 118 119 }
Note: See TracChangeset
for help on using the changeset viewer.