hi, when submitting this job to slurm, the python code does not write in stdout redirected file as expected. slurm file: #!/bin/bash #SBATCH --output=ABSOLUTE_PATH_%J.o #SBATCH --error=ABSOLUTE_PATH_%J.e #SBATCH --tasks-per-node=1 #SBATCH --cpus-per-task=1 #SBATCH --mem=12M #SBATCH --time=00:03:00 python test.py python file test.py content: import time if __name__ == "__main__": print('looping!') i = 0 while True: print(f'looping {i}') i += 1 time.sleep(1) - results: * the redirected file contains everything that comes from bash. * all prints from python file fails to be logged into the redirected file. after several trials, it turns out the reason for python to fail to log in the expected redirected file is the line "time.sleep(x)". when that line is removed, slurm successfully writes what python is printing. this is not an expected behavior. any idea why this happens? thanks
p.s. in addition, when changing python code to the following, the issue happens again. python does not write anything to the redirected file. somehow, the loop without any print in it does not trigger flushing the text to the redirected file. also, slurm does not flush text even after the job is done. content of test.py: import time if __name__ == "__main__": print('looping!') i = 0 while True: i = 1 thanks