Skip to content

Instantly share code, notes, and snippets.

@pdk
Last active May 3, 2018 20:23
Show Gist options
  • Select an option

  • Save pdk/12e6d5f3b11db1a4d7f707ab46448547 to your computer and use it in GitHub Desktop.

Select an option

Save pdk/12e6d5f3b11db1a4d7f707ab46448547 to your computer and use it in GitHub Desktop.
exceptional failure
public boolean isJobReady(DataSource dataSource, DateTime batchDate, Map<String, String> params)
throws BatchJobFailureException {
String alphaBatchId = params.get("batchId");
checkNotNull(alphaBatchId, "batchId is required to check status of a Blorp batch");
boolean ready = false;
BlorpAlphaClient client = lookupClient(dataSource);
try {
BatchResponse response = client.status(alphaBatchId);
if (BATCH_FAILURE_STATUSES.contains(response.status)) {
log.info("Batch job status from Blorp Core indicates job failure, status={}",
response.status);
throw new BatchJobFailureException(
"Blorp failed to complete batch job. status from core was: " + response.status);
}
ready = response.status.equalsIgnoreCase("completed");
log.info("alpha batchId={}, status={}, ready={}", alphaBatchId, response.status, ready);
} catch (Exception e) {
log.exception("Unable to obtain batch status from alpha due to {}", e, e.getMessage());
}
return ready;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment