def CreatePods(pod_name, yaml_file):
"""Creates 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 come up for a long time.
"""
command = [_KUBECTL, 'create', '--filename=%s' % yaml_file]
logging.info('Creating pods: %s', subprocess.list2cmdline(command))
subprocess.check_call(command)
if not _WaitUntil(100, _GetPodNames, pod_name):
raise TimeoutError(
'Timed out waiting for %s pod to come up.' % pod_name)
评论列表
文章目录