I have an AWS EC2 Ubuntu 20.04 instance, accessed via puTTY SSH. Running a Python process via OpenMPI through the following command on non root:
nohup mpirun python3 job.py
When the shell is open it runs normally. Even though using ps
and job
doesn't show the process I can see via the nohup.out and the changing file system that it's working even hours after it runs.
When I close the shell the nohup process ends. I should probably also note that when I run the nohup command above I cannot enter any more input (the cursor becomes blank). So when I ran ps
and job
above I had to open a second shell. I never used nohup before and assume this is abnormal.
I investigated the nohup.out file for errors and found nothing written.
So TLDR:
Closing the SSH instance (puTTY) ends the nohup process
ps and job don't list the nohup process even though I know it's running
I can answer any more questions if needed
job.py
? if yes, you can run it in background, close stdin, stdout and stderr (altough I never did it on ec2 instance), then you can close ssh connection.sys.stdin.close()
(and stdout and stderr) before callingpid=os.fork()
exit when pid > 0. be sure to check that mpi layer do not use standard I/O (that wasn't obvious inmpirun
man page.