public void executeExperimentation(String jsonExperimentSeries, IExecutorPlugin executorPlugin) { if (jsonExperimentSeries == null) { throw new ArgumentException("Argument 'jsonExperimentSeries' must " + "be a not null string object."); } if (executorPlugin == null) { throw new ArgumentException("Argument 'executorPlugin' must be a not null."); } if (!this.jparser.getJsonValidator().isSyntacticalValid(jsonExperimentSeries)) { throw new ArgumentException("Argument 'jsonExperimentSeries' must " + "be a syntactically valid JSON string."); } if (!this.jparser.getJsonValidator().isSemanticalValid(jsonExperimentSeries)) { throw new ArgumentException("Argument 'jsonExperimentSeries' must " + "be a semantically valid JSON string."); } IExperimentSeries eSeries = (IExperimentSeries)this.jparser.parse(jsonExperimentSeries); this.jbuilder.reset(); this.obuilder.reset(); executorPlugin.execute(eSeries); }
// starts an task, which read, validate and execute experiment definitions public Task startExperimentation(String jsonExperimentSeries, String dockerImage, String executionPath) { if (jsonExperimentSeries == null) { throw new ArgumentException("Argument 'jsonExperimentSeries' must " + "be a not null string object."); } if (dockerImage == null) { throw new ArgumentException("Argument 'dockerImage' must " + "be a not null string object."); } if (executionPath == null) { throw new ArgumentException("Argument 'executionPath' must " + "be a not null string object."); } if (!this.isSyntacticalValidJson(jsonExperimentSeries)) { throw new FormatException("Argument 'jsonExperimentSeries' must " + "be a syntactically valid JSON string."); } if (!this.isSemanticalValidJson(jsonExperimentSeries)) { throw new ApplicationException("Argument 'jsonExperimentSeries' must " + "be a semantically valid JSON string."); } IExperimentSeries eSeries = (IExperimentSeries)this.jparser.parse(jsonExperimentSeries); this.jbuilder.reset(); this.obuilder.reset(); return(this.distributor.distributeExperimentSeries(eSeries, dockerImage, executionPath)); }
private object parse(String parseObject) { this.jreader.initialize(parseObject); this.jreader.readNextToken(); TokenType type = this.jreader.getCurrentTokenType(); bool isOk = (type == TokenType.StartObject); if (isOk) { IExperimentSeries expSer = this.parseExperimentSeries(this.jreader); jreader.readNextToken(); this.builder.setId(expSer.getId()); this.builder.setName(expSer.getName()); this.builder.setDescription(expSer.getDescription()); this.builder.addRange(expSer.getExperiments()); this.builder.setSoftwareName(expSer.getExperimentSoftware()); } else { throw new ArgumentException("Argument 'type' must be a " + "TokenType with option of StartObject."); } object result = this.builder.build(); this.builder.reset(); return(result); }
public async Task distributeExperimentSeries(IExperimentSeries eSeries, String dockerImage, String executionPath) { bool isOk = ((eSeries != null) && (dockerImage != null) && (executionPath != null)); if (isOk) { IList <Task <KeyValuePair <String, String> > > tasks = new List <Task <KeyValuePair <String, String> > >(); Console.WriteLine("Investigator: Start distributing experiment tasks of " + "series of experiment with id " + eSeries.getId()); foreach (IExperiment experiment in eSeries.getExperiments()) { tasks.Add(this.distributeExperimentAsync(eSeries.getId(), eSeries.getName(), eSeries.getDescription(), eSeries.getExperimentSoftware(), experiment, dockerImage, executionPath)); } await startRemovePolling(tasks.Select(x => x.Result).ToList()); Console.WriteLine("Investigator: Experiment tasks of the series of experiment " + "with id " + eSeries.getId() + " were finished"); } else { throw new ArgumentException("Arguments 'eSeries','dockerImage' and " + "'executionPath' must be not null."); } }
// starts an task per given experiment, which create an experiment service in each case public async Task distributeExperimentSeries(IExperimentSeries eSeries, String dockerImage, String executionPath) { bool isOk = ((eSeries != null) && (dockerImage != null) && (executionPath != null)); if (isOk) { IList <KeyValuePair <String, Task <KeyValuePair <String, String> > > > tasks = new List <KeyValuePair <String, Task <KeyValuePair <String, String> > > >(); IList <IExperiment> experiments = eSeries.getExperiments().ToList(); Console.WriteLine("Investigator: Start distributing experiment tasks of " + "series of experiment with id " + eSeries.getId()); // create task per experiment foreach (IExperiment experiment in experiments) { // wait 10 seconds until to the next task creation Task.Delay(10000).Wait(); // create task tasks.Add(new KeyValuePair <string, Task <KeyValuePair <string, string> > >( eSeries.getId() + ":::" + experiment.getId(), this.distributeExperimentAsync(eSeries.getId(), eSeries.getName(), eSeries.getDescription(), eSeries.getExperimentSoftware(), experiment, dockerImage, executionPath))); } // check if an created task faulted tasks.Where(x => x.Value.IsFaulted).ToList().ForEach(x => { String error = "Investigator: Task\n\t " + x.Key + "\n\t is faulted because:\n" + x.Value.Exception.Message; Console.WriteLine(error); }); // watch for state of experiment services: // remove, if faulted or finished successful - and display a message await startRemovePolling(tasks.Select(x => x.Value.Result).ToList()); Console.WriteLine("Investigator: Experiment tasks of the series of experiment " + "with id " + eSeries.getId() + " were finished"); } else { throw new ArgumentException("Arguments 'eSeries','dockerImage' and " + "'executionPath' must be not null."); } }
public void execute(IExperimentSeries experimentSeries) { var experiment = (IParameterList)experimentSeries.getExperiments(); for (uint i = 0; i < experiment.count(); i++) { var parameter = experiment.get(i); if (parameter.getValue().isPrimitive()) { } else { for (int j = 0; j < ((IParameterList)parameter).count(); j++) { } } } }
public void execute(IExperimentSeries experimentSeries) { this.executorPlugin.execute(experimentSeries); }
public async Task distributeExperimentSeries(IExperimentSeries eSeries, String dockerImage, String executionPath) { bool isOk = ((eSeries != null) && (dockerImage != null) && (executionPath != null)); if (isOk) { IList <KeyValuePair <String, Task <KeyValuePair <String, String> > > > tasks = new List <KeyValuePair <String, Task <KeyValuePair <String, String> > > >(); IList <IExperiment> experiments = eSeries.getExperiments().ToList(); Console.WriteLine("Investigator: Start distributing experiment tasks of " + "series of experiment with id " + eSeries.getId()); //while(experiments.Count > 0) //{ foreach (IExperiment experiment in experiments) { tasks.Add(new KeyValuePair <string, Task <KeyValuePair <string, string> > >( eSeries.getId() + ":::" + experiment.getId(), this.distributeExperimentAsync(eSeries.getId(), eSeries.getName(), eSeries.getDescription(), eSeries.getExperimentSoftware(), experiment, dockerImage, executionPath))); } //Task.Delay(3000).Wait(); tasks.Where(x => x.Value.IsFaulted).ToList().ForEach(x => { String error = "Investigator: Task\n\t " + x.Key + "\n\t is faulted because:\n" + x.Value.Exception.Message; Console.WriteLine(error); }); // IList<String> faultedTasks = tasks.Where(x => x.Value.IsFaulted) // .Select(x => x.Key).ToList(); // experiments = experiments.Where(x => // { // bool isSelected = false; // String identifier = eSeries.getId() + ":::" + x.getId(); // foreach(String brokenIdentifier in faultedTasks) { // if (String.Compare(identifier, brokenIdentifier) == 0) // isSelected = true; // } // return isSelected; // }).ToList(); //} // foreach(IExperiment experiment in eSeries.getExperiments()) // { // tasks.Add(this.distributeExperimentAsync(eSeries.getId(), // eSeries.getName(), // eSeries.getDescription(), // eSeries.getExperimentSoftware(), // experiment, dockerImage, executionPath)); // } await startRemovePolling(tasks.Select(x => x.Value.Result).ToList()); Console.WriteLine("Investigator: Experiment tasks of the series of experiment " + "with id " + eSeries.getId() + " were finished"); } else { throw new ArgumentException("Arguments 'eSeries','dockerImage' and " + "'executionPath' must be not null."); } }