Question, does the logging from Flyte task only be...
# ask-the-community
l
Question, does the logging from Flyte task only become available at a terminal state? Are there ways to get the live logs beside writing the logs to a provider?
im running the below and running
kubectl logs pod_name
on the cluster and expecting to see the logs on runtime but im not till the task ends
Copy code
@task
def print_task():
    print("Starting")
    duration = 5 * 60 
    interval = 30
    iterations = duration // interval

    for _ in range(iterations):
        print("Print")
        time.sleep(interval)
b
Hey Lee! This seems unrelated to Flyte, but could be related to when Python flushes lines. Would you mind changing your print statement to:
Copy code
print("Print", flush=True)
and set
PYTHONUNBUFFERED=1
as an environment variable to check whether that helps? You should be able to set the environment variable using the
environment
keyword in the
task()
decorator
k
Or in pyflyte run
l
thanks! i tried using
flush=true
works, setting
PYTHONUNBUFFERED
wasn't required. Was trying to figure out why were all the ShellTask logging unresponsive and its probably due to this print without the flush too.
In anycase i took a read and tried setting
PYTHONUNBUFFERED=1
for the ShellTask and they print as expected now. Thanks alot!