def _wait_for_k8s_job(self, pod_name, yaml_spec, timeout):
    ' _wait_for_k8s_job waits for the job to complete '
    status = 'running'
    start_time = datetime.now()
    while (status in ['pending', 'running']):
        try:
            api_response = self._corev1.read_namespaced_pod(pod_name, yaml_spec['metadata']['namespace'])
            status = api_response.status.phase.lower()
            time.sleep(5)
            elapsed_time = (datetime.now() - start_time).seconds
            logging.info('{} seconds: waiting for job to complete'.format(elapsed_time))
            if (elapsed_time > timeout):
                logging.info('Kubernetes job timeout')
                return False
        except k8s_client.rest.ApiException as e:
            logging.exception('Exception when calling CoreV1Api->read_namespaced_pod: {}\n'.format(str(e)))
            return False
    return (status == 'succeeded')
_wait_for_k8s_job waits for the job to complete
def _wait_for_k8s_job(self, pod_name, yaml_spec, timeout):
    '  '
    status = 'running'
    start_time = datetime.now()
    while (status in ['pending', 'running']):
        try:
            api_response = self._corev1.read_namespaced_pod(pod_name, yaml_spec['metadata']['namespace'])
            status = api_response.status.phase.lower()
            time.sleep(5)
            elapsed_time = (datetime.now() - start_time).seconds
            logging.info('{} seconds: waiting for job to complete'.format(elapsed_time))
            if (elapsed_time > timeout):
                logging.info('Kubernetes job timeout')
                return False
        except k8s_client.rest.ApiException as e:
            logging.exception('Exception when calling CoreV1Api->read_namespaced_pod: {}\n'.format(str(e)))
            return False
    return (status == 'succeeded')