Skip to content

Instantly share code, notes, and snippets.

@pdk
Last active May 3, 2018 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdk/d68b4538b2dc48052d899e0558fce469 to your computer and use it in GitHub Desktop.
Save pdk/d68b4538b2dc48052d899e0558fce469 to your computer and use it in GitHub Desktop.
translated java to go
func isJobReady(dataSource DataSource, batchDate time.Date, params map[string]string) (bool, error) {
alphaBatchId, ok := params["batchId"]
if !ok {
return false, fmt.Errorf("batchId value required in params")
}
client := blorp.LookupClient(dataSource)
response, err := client.status(alphaBatchId)
if err != nil {
log.Printf("Unable to obtain batch status from alpha due to %s", err)
// communication error is not a serious problem. we'll just try again later.
return false, nil
}
if IsBatchFailureStatus[response.Status] {
log.Printf("Batch job status from Blorp Core indicates job failure, status=%s",
response.status)
return false, fmt.Errorf("Blorp failed to complete batch job. status from core was: %s",
response.status)
}
ready := strings.ToLower(response.Status) == "completed"
log.Printf("alpha batchId=%s, status=%s, ready=%s", alphaBatchId, response.status, ready)
return ready, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment