def DeletePods(pod_name, yaml_file):
"""Deletes pods based on the given kubernetes config.
Args:
pod_name: 'name-prefix' selector for the pods.
yaml_file: kubernetes yaml config.
Raises:
TimeoutError: if jobs didn't terminate for a long time.
"""
command = [_KUBECTL, 'delete', '--filename=%s' % yaml_file]
logging.info('Deleting pods: %s', ' '.join(command))
subprocess.call(command)
def CheckPodsAreTerminated():
return not _GetPodNames(pod_name)
if not _WaitUntil(100, CheckPodsAreTerminated):
raise TimeoutError(
'Timed out waiting for %s pod to terminate.' % pod_name)
评论列表
文章目录