-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KubernetesPodOperator truncates logs #10586
Comments
Looking on previous K8S related PRs I would like to ask @kaxil for help 🙂 |
tagging in @dimberman if you have any idea about this |
👋 I've been running into this issue and we've created a modified copy of k8spodoperator as a workaround. I'd be interested in making a PR to expose the tail_lines property to the user in the k8sPodOperator since this would allow us to get back onto the official version of the operator in future releases. If its alright with you, you can assign this issue to me and I can get a PR up hopefully sometime this week? |
@SamWheating assigned :). Could you please make sure that this issue is persistent in 1.10.12? |
Yup, I'm just updating our clusters to 1.10.12 and then I'll try to replicate the error case (a pod producing a lot of logs quickly and then shutting down). |
Replicated the issue in Airflow 1.10.12 like so: Created a DAG to really quickly log a bunch of stuff in a k8s pod: from datetime import timedelta
from airflow import models
from airflow import utils
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
dag = models.DAG(
'data-infrastructure-examples.sam-k8s-fast-logging',
start_date=utils.dates.days_ago(1),
max_active_runs=1,
dagrun_timeout=timedelta(minutes=1),
schedule_interval=None
)
hello_world_pod = KubernetesPodOperator(namespace='data-infrastructure-examples',
image="busybox",
name="count-to-10000",
in_cluster=True,
task_id="count-to-10000",
get_logs=True,
dag=dag,
is_delete_operator_pod=False,
cmds=['seq', '10000']
) Running the DAG then only provides the last 10 lines of the log in the airflow UI:
While checking the logs on the completed pod show the entire count:
|
The fix should be applied also for KubernetesExecutor 🙂 |
Sounds good. From the kubernetes python client source:
Is there a reason users would ever want truncate lines? Maybe its just easier to not set this value and retrieve all logs in all cases. |
@SamWheating I'd say retrieve all logs in all cases. The fact that these are truncated is a bug. Glad to help whenever you have a PR ready! |
Would love to see a fix to this! |
Fixed in #11325 |
Apache Airflow version: 1.10.10
Kubernetes version (if you are using kubernetes) (use
kubectl version
): v1.15.11KubernetesPodOperator truncates logs when container produces more than 10 lines of logs before execution of
read_pod_logs
function. Is there any reason to make 10 as default value fortail_lines
argument ?The text was updated successfully, but these errors were encountered: