use of com.airbnb.airpal.api.event.JobUpdateEvent in project airpal by airbnb.
the class Execution method updateJobInfo.
protected void updateJobInfo(Set<Table> usedTables, List<Column> columns, QueryStats queryStats, JobState state, QueryError error, List<List<Object>> outputPreview, boolean postUpdate) {
if ((usedTables != null) && (usedTables.size() > 0)) {
job.getTablesUsed().addAll(usedTables);
}
if ((columns != null) && (columns.size() > 0)) {
job.setColumns(columns);
}
if (queryStats != null) {
job.setQueryStats(queryStats);
}
if ((state != null) && (job.getState() != JobState.FINISHED) && (job.getState() != JobState.FAILED)) {
job.setState(state);
}
if (error != null) {
FailureInfo failureInfo = new FailureInfo(error.getFailureInfo().getType(), error.getFailureInfo().getMessage(), null, Collections.<FailureInfo>emptyList(), Collections.<String>emptyList(), error.getFailureInfo().getErrorLocation());
QueryError queryError = new QueryError(error.getMessage(), error.getSqlState(), error.getErrorCode(), error.getErrorName(), error.getErrorType(), error.getErrorLocation(), failureInfo);
job.setError(queryError);
}
if (postUpdate) {
eventBus.post(new JobUpdateEvent(job, outputPreview));
}
}
Aggregations