I have a bunch of jobs to submit to a PBS queue and the output is supposed to be post-processed locally afterwards. As the jobs are similar (and I don't want to manually change it that often), I wrote myself a bash script that locally generates a PBS job script and then submits the job. My question is the following: How can I make my bash script wait until the PBS job has finished and then start post-processing? (Constantly checking the status of the job is not an option.) What possibilities do I have to do this?
Thank you very much to all hints, tips or solutions!
Edit: As indicated in the comment (thanks), some edits:
- PBS = Portable Batch System
- Documentation is available here: http://resources.altair.com/pbs/documentation/support/PBSProUserGuide12.1.pdf
- I thought about possible solutions and came up with the following one that won't work, though: I could my bash script wait for the amount of time that is requested as wall clock time of the job. However, there are two complications: firstly, the job might not need that much time and terminate earlier, hence having the bash script wait too long; secondly, the job might be queued and not immediately executed, hence having the bash script likely wait too little.
Edit 2: As I am not sure if I can always run interactively as suggested below, I thought about the following: I have the PBS job script create an (empty) file just before finishing. My bash script checks every couple minutes (say) whether that file exists (using a while loop). If it exists, I know that the job terminated and can start post-processing by deleting the just created (empty) file. This way, I only have a delay of a couple of minutes maximum and don't really need any resources. It is definitely not ideal, but kind of a workaround. Any ideas that are more practical are highly appreciated.
Any thought is appreciated even if not directly related to PBS.
Cari