pankajkoti commented on issue #37534:
URL: https://github.com/apache/airflow/issues/37534#issuecomment-1953016838

   > "Container logs was not available earlier regularly"
   > 
   > That's wrong, the kpo with get_logs , get the container logs regularly
   
   @raphaelauv It was not possible to get logs from within the container 
previously in `deferrable` mode while the **pod was still running**. They only 
appear after the pod completes it's execution. I think we're not on the same 
page when we say "container logs"
   
   with 8.0.0RC3 you might want to try below example task in your DAG
   ```
   create_k8s_pod = KubernetesPodOperator(
           task_id="create_k8s_pod",
           namespace=namespace,
           in_cluster=in_cluster,
           config_file=config_file,
           name="k8s_test_pod",
           deferrable=True,
           logging_interval=10,
           # startup_timeout_seconds=60,
           image="ubuntu",
           cmds=[
               "bash",
               "-cx",
               (
                   "i=0; "
                   "while [ $i -ne 150 ]; "
                   "do i=$(($i+1)); "
                   "echo $i; "
                   "sleep 1; "
                   "done; "
                   "mkdir -p /airflow/xcom/; "
                   'echo \'{"message": "good afternoon!"}\' > 
/airflow/xcom/return.json'
               ),
           ],
           do_xcom_push=True,
       )
   ```
   
   and you can try to run the same task without the `logging_interval` 
parameter with 7.14.0 (as 7.14.0 did not have this param).
   
   You will observe that you won't see logs from the echo command above 
periodically in 7.14.0 while the pod is running. You will only see them at the 
end.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to