def Run(self, args): dataproc = dp.Dataproc(self.ReleaseTrack()) job_ref = util.ParseJob(args.id, dataproc) request = dataproc.messages.DataprocProjectsRegionsJobsDeleteRequest( projectId=job_ref.projectId, region=job_ref.region, jobId=job_ref.jobId) console_io.PromptContinue( message="The job '{0}' will be deleted.".format(args.id), cancel_on_no=True, cancel_string='Deletion aborted by user.') dataproc.client.projects_regions_jobs.Delete(request) def _GetJob(job_ref): return dataproc.client.projects_regions_jobs.Get( dataproc.messages.DataprocProjectsRegionsJobsGetRequest( projectId=job_ref.projectId, region=job_ref.region, jobId=job_ref.jobId)) util.WaitForResourceDeletion(_GetJob, job_ref, message='Waiting for job deletion') log.DeletedResource(job_ref)
def Run(self, args): client = self.context['dataproc_client'] messages = self.context['dataproc_messages'] job_ref = util.ParseJob(args.id, self.context) request = messages.DataprocProjectsRegionsJobsDeleteRequest( projectId=job_ref.projectId, region=job_ref.region, jobId=job_ref.jobId) if not console_io.PromptContinue( message="The job '{0}' will be deleted.".format(args.id)): raise exceptions.ToolException('Deletion aborted by user.') client.projects_regions_jobs.Delete(request) def _GetJob(job_ref): return client.projects_regions_jobs.Get( messages.DataprocProjectsRegionsJobsGetRequest( projectId=job_ref.projectId, region=job_ref.region, jobId=job_ref.jobId)) util.WaitForResourceDeletion(_GetJob, job_ref, message='Waiting for job deletion') log.DeletedResource(job_ref)
def Run(self, args): dataproc = dp.Dataproc(base.ReleaseTrack.GA) messages = dataproc.messages batch_id = args.CONCEPTS.batch.Parse() request = messages.DataprocProjectsLocationsBatchesDeleteRequest( name=batch_id.RelativeName()) console_io.PromptContinue( message="The batch '{}' will be deleted.".format(batch_id.Name()), cancel_on_no=True, cancel_string='Deletion aborted by user.') dataproc.client.projects_locations_batches.Delete(request) if args.async_: log.status.Print("Deleting batch '{}'.".format(batch_id.Name())) return def _GetJob(job_ref): return dataproc.client.projects_locations_batches.Get( dataproc.messages.DataprocProjectsLocationsBatchesGetRequest( name=job_ref)) util.WaitForResourceDeletion(_GetJob, batch_id.RelativeName(), message='Waiting for batch deletion') log.DeletedResource(batch_id.RelativeName())