/** {@inheritDoc} */ @Override public Metric execute(final TaskDefinition taskDefinition) { Assertion.checkNotNull(taskDefinition); // ----- final int joinCount = taskDefinition.getRequest().toUpperCase().split("JOIN").length - 1; final int fromCount = taskDefinition.getRequest().toUpperCase().split("FROM ").length - 1; return new MetricBuilder() .withTitle("Nombre de jointures") .withValue(joinCount + fromCount) .build(); }
private Metric doExecute(final TaskDefinition taskDefinition) { // System.out.println(">>>>" + currentTask.getEngineClass().getCanonicalName()); if (TaskEngineSelect.class.isAssignableFrom(taskDefinition.getTaskEngineClass()) && !hasNotNullOutParams(taskDefinition)) { // System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>" + // currentTask.getEngineClass().getCanonicalName()); final TaskPopulator taskPopulator = new TaskPopulator(taskDefinition); final Task task = taskPopulator.populateTask(); final long startTime = System.currentTimeMillis(); /*TaskResult result =*/ taskManager.execute(task); // on n'utilise pas le resultat final long endTime = System.currentTimeMillis(); final long executionTime = endTime - startTime; return buildPerformanceMetric(Status.Executed, executionTime, null); } // Le test n'a pas de sens. return buildPerformanceMetric(Status.Rejected, null, null); }
private static boolean hasNotNullOutParams(final TaskDefinition taskDefinition) { return taskDefinition.getOutAttributeOption().isDefined() && taskDefinition.getOutAttributeOption().get().isNotNull(); }