relleums / qstat

parse Grid Engine qstat job info list into a list of python dicts
GNU General Public License v3.0
12 stars 3 forks source link

Sleep before qstat() #2

Open varduefr opened 5 years ago

varduefr commented 5 years ago

Hi, Really like the package! Good work! Only one tip...I'm calling the qsub using popen but if I'm calling qstat() right after, the package throws an exception as Grid Engine is still doing his job. I needed to add a sleep(2) in between. I guess I need to check the popen until finished.

gold_auto_call = 'qsub -t 1-4 gold_auto.sh ' process = Popen(shlex.split(gold_auto_call), stdout=PIPE) (output, err) = process.communicate() exit_code = process.wait() time.sleep(2) queue_info, job_info = qstat() all_jobs = queue_info + job_info

relleums commented 4 years ago

From my experience the qsub call is blocking until the job is in the queue. What qsub flavor do you use? sun-grid-engine? As you said, I think waiting until the qsub call returns should prevent you from this race condition.

What exception is raised here?