def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[(State, V1Pod, Optional[str])]:
    '\n        Monitors a pod and returns the final state, pod and xcom result\n\n        :param pod: pod spec that will be monitored\n        :param get_logs: whether to read the logs locally\n        :return:  Tuple[State, Optional[str]]\n        '
    if get_logs:
        read_logs_since_sec = None
        last_log_time = None
        while True:
            logs = self.read_pod_logs(pod, timestamps=True, since_seconds=read_logs_since_sec)
            for line in logs:
                (timestamp, message) = self.parse_log_line(line.decode('utf-8'))
                last_log_time = pendulum.parse(timestamp)
                self.log.info(message)
            time.sleep(1)
            if (not self.base_container_is_running(pod)):
                break
            self.log.warning('Pod %s log read interrupted', pod.metadata.name)
            if last_log_time:
                delta = (pendulum.now() - last_log_time)
                read_logs_since_sec = math.ceil(delta.total_seconds())
    result = None
    if self.extract_xcom:
        while self.base_container_is_running(pod):
            self.log.info('Container %s has state %s', pod.metadata.name, State.RUNNING)
            time.sleep(2)
        result = self._extract_xcom(pod)
        self.log.info(result)
        result = json.loads(result)
    while self.pod_is_running(pod):
        self.log.info('Pod %s has state %s', pod.metadata.name, State.RUNNING)
        time.sleep(2)
    remote_pod = self.read_pod(pod)
    return (self._task_status(remote_pod), remote_pod, result)
Monitors a pod and returns the final state, pod and xcom result

:param pod: pod spec that will be monitored
:param get_logs: whether to read the logs locally
:return:  Tuple[State, Optional[str]]
def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[(State, V1Pod, Optional[str])]:
    '\n        Monitors a pod and returns the final state, pod and xcom result\n\n        :param pod: pod spec that will be monitored\n        :param get_logs: whether to read the logs locally\n        :return:  Tuple[State, Optional[str]]\n        '
    if get_logs:
        read_logs_since_sec = None
        last_log_time = None
        while True:
            logs = self.read_pod_logs(pod, timestamps=True, since_seconds=read_logs_since_sec)
            for line in logs:
                (timestamp, message) = self.parse_log_line(line.decode('utf-8'))
                last_log_time = pendulum.parse(timestamp)
                self.log.info(message)
            time.sleep(1)
            if (not self.base_container_is_running(pod)):
                break
            self.log.warning('Pod %s log read interrupted', pod.metadata.name)
            if last_log_time:
                delta = (pendulum.now() - last_log_time)
                read_logs_since_sec = math.ceil(delta.total_seconds())
    result = None
    if self.extract_xcom:
        while self.base_container_is_running(pod):
            self.log.info('Container %s has state %s', pod.metadata.name, State.RUNNING)
            time.sleep(2)
        result = self._extract_xcom(pod)
        self.log.info(result)
        result = json.loads(result)
    while self.pod_is_running(pod):
        self.log.info('Pod %s has state %s', pod.metadata.name, State.RUNNING)
        time.sleep(2)
    remote_pod = self.read_pod(pod)
    return (self._task_status(remote_pod), remote_pod, result)