Search in sources :

Example 1 with PartialExecutionException

use of org.embulk.exec.PartialExecutionException in project embulk by embulk.

the class EmbulkEmbed method run.

public ExecutionResult run(ConfigSource config) {
    this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
    ExecSession exec = newExecSession(config);
    try {
        return bulkLoader.run(exec, config);
    } catch (PartialExecutionException partial) {
        try {
            bulkLoader.cleanup(config, partial.getResumeState());
        } catch (Throwable ex) {
            partial.addSuppressed(ex);
        }
        throw partial;
    } finally {
        try {
            exec.cleanup();
        } catch (Exception ex) {
            // TODO add this exception to ExecutionResult.getIgnoredExceptions
            // or partial.addSuppressed
            ex.printStackTrace(System.err);
        }
    }
}
Also used : PartialExecutionException(org.embulk.exec.PartialExecutionException) ExecSession(org.embulk.spi.ExecSession) PartialExecutionException(org.embulk.exec.PartialExecutionException)

Example 2 with PartialExecutionException

use of org.embulk.exec.PartialExecutionException in project embulk by embulk.

the class EmbulkEmbed method runResumable.

public ResumableResult runResumable(ConfigSource config) {
    this.logger.info("Started Embulk v" + EmbulkVersion.VERSION);
    ExecSession exec = newExecSession(config);
    try {
        ExecutionResult result;
        try {
            result = bulkLoader.run(exec, config);
        } catch (PartialExecutionException partial) {
            return new ResumableResult(partial);
        }
        return new ResumableResult(result);
    } finally {
        try {
            exec.cleanup();
        } catch (Exception ex) {
            // TODO add this exception to ExecutionResult.getIgnoredExceptions
            // or partial.addSuppressed
            ex.printStackTrace(System.err);
        }
    }
}
Also used : PartialExecutionException(org.embulk.exec.PartialExecutionException) ExecutionResult(org.embulk.exec.ExecutionResult) ExecSession(org.embulk.spi.ExecSession) PartialExecutionException(org.embulk.exec.PartialExecutionException)

Aggregations

PartialExecutionException (org.embulk.exec.PartialExecutionException)2 ExecSession (org.embulk.spi.ExecSession)2 ExecutionResult (org.embulk.exec.ExecutionResult)1