@Override public Object doOperation(final AddElementsFromFile op, final Context context, final Store store) throws OperationException { final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); if (null != op.getParallelism()) { env.setParallelism(op.getParallelism()); } final FlatMapOperator<String, Element> builder = env.readTextFile(op.getFilename()) .flatMap(new GafferMapFunction(String.class, op.getElementGenerator())); if (Boolean.parseBoolean(op.getOption(FlinkConstants.SKIP_REBALANCING))) { builder.output(new GafferOutput(op, store)); } else { builder.rebalance().output(new GafferOutput(op, store)); } try { env.execute(op.getClass().getSimpleName() + "-" + op.getFilename()); } catch (final Exception e) { throw new OperationException("Failed to add elements from file: " + op.getFilename(), e); } return null; } }