private void runExperimentSeries( ScenarioInstance scenarioInstance, Map<MeasurementSpecification, List<ExperimentSeriesDefinition>> experimentSeries) { boolean mecAcquired = false; try { experimentController.acquireMEController(); mecAcquired = true; for (MeasurementSpecification measSpec : experimentSeries.keySet()) { experimentController.initialize( EngineTools.getConstantParameterValues(measSpec.getInitializationAssignemts()), scenarioInstance.getScenarioDefinition().getMeasurementEnvironmentDefinition()); for (ExperimentSeriesDefinition esd : experimentSeries.get(measSpec)) { ExperimentSeries series = scenarioInstance.getExperimentSeries(esd.getName()); if (series == null) { series = EntityFactory.createExperimentSeries(esd); scenarioInstance.getExperimentSeriesList().add(series); series.setScenarioInstance(scenarioInstance); persistenceProvider.store(series); } experimentSeriesManager.runExperimentSeries(series); } } } catch (Exception e) { throw new RuntimeException("Failed executing experiments!", e); } finally { if (mecAcquired) { experimentController.releaseMEController(); } } }
private ScenarioInstance createNewScenarioInstance(ScenarioDefinition scenarioDefinition) { ScenarioInstance scenarioInstance = EntityFactory.createScenarioInstance( scenarioDefinition, getConfiguration().getMeasurementControllerURIAsStr()); persistenceProvider.store(scenarioInstance); LOGGER.debug("Created new ScenarioInstance {}", scenarioInstance); return scenarioInstance; }