Lee Ning Jie Leon
10/18/2023, 9:58 AMLee Ning Jie Leon
10/18/2023, 10:02 AMkubectl logs pod_name
on the cluster and expecting to see the logs on runtime but im not till the task ends
@task
def print_task():
print("Starting")
duration = 5 * 60
interval = 30
iterations = duration // interval
for _ in range(iterations):
print("Print")
time.sleep(interval)
Bernhard Stadlbauer
10/18/2023, 12:52 PMprint("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()
decoratorKetan (kumare3)
Lee Ning Jie Leon
10/19/2023, 6:05 AMflush=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.Lee Ning Jie Leon
10/19/2023, 6:12 AMPYTHONUNBUFFERED=1
for the ShellTask and they print as expected now. Thanks alot!