public ExecutionResult run(final ConfigSource config) {
        logger.info("Started Embulk v" + EmbulkVersion.VERSION);

        final ExecSessionInternal exec = this.newExecSessionInternal(config.deepCopy().getNestedOrGetEmpty("exec"));
        try {
            return this.bulkLoader.run(exec, config);
        } catch (final PartialExecutionException partial) {
            final ExecSessionInternal cleanupExec =
                    this.newExecSessionInternal(partial.getResumeState().getExecSessionConfigSource());
            try {
                this.bulkLoader.cleanup(cleanupExec, config, partial.getResumeState());
            } catch (final Throwable ex) {
                partial.addSuppressed(ex);
            }
            throw partial;
        } finally {
            try {
                exec.cleanup();
            } catch (final Exception ex) {
                // TODO add this exception to ExecutionResult.getIgnoredExceptions
                // or partial.addSuppressed
                ex.printStackTrace(System.err);
            }
        }
    }
Sets an alternative {@code BulkLoader} instance mainly for testing-purpose.
embulk-core/src/main/java/org/embulk/EmbulkEmbed.java