Ignore errors when cancelling dataproc jobs (#3123)

<!-- This change is generated by MagicModules. -->
/cc @rileykarson
This commit is contained in:
The Magician 2019-02-26 10:46:45 -08:00 committed by Riley Karson
parent 3d36a173f3
commit c94c35f437

View File

@ -323,13 +323,11 @@ func resourceDataprocJobDelete(d *schema.ResourceData, meta interface{}) error {
if forceDelete {
log.Printf("[DEBUG] Attempting to first cancel Dataproc job %s if it's still running ...", d.Id())
if _, err := config.clientDataproc.Projects.Regions.Jobs.Cancel(
project, region, d.Id(), &dataproc.CancelJobRequest{}).Do(); err != nil {
return fmt.Errorf("Error canceling job: %v", err)
}
// ignore error if we get one - job may be finished already and not need to
// be cancelled. We do however wait for the state to be one that is
// at least not active
_, _ = config.clientDataproc.Projects.Regions.Jobs.Cancel(project, region, d.Id(), &dataproc.CancelJobRequest{}).Do()
waitErr := dataprocJobOperationWait(config, region, project, d.Id(),
"Cancelling Dataproc job", timeoutInMinutes, 1)
if waitErr != nil {