TheRoddyWMS / BatchEuphoria

A library to access different kinds of cluster backends
MIT License
3 stars 5 forks source link

PBS: queryExtendedJobStateById fails for unknown jobs #106

Open askask opened 6 years ago

askask commented 6 years ago

If you pass an unknown job id to PBSJobManager.queryExtendedJobStateById, it should return a map without information about that job, but instead it throws an exception. This is caused by qstat returning an error if you pass an unknown job id:

# existing job: information printed to stdout
> qstat -x -f  -u otptest 15841124 
<Data><Job>…</Job></Data>
> qstat -x -f  -u otptest 15841124 2> /dev/null
<Data><Job>…</Job></Data>
> qstat -x -f  -u otptest 15841124 1> /dev/null
> echo $?
0

# non-existing job: error printed to  stderr, exit code not 0
> qstat -x -f  -u otptest 15963928 
qstat: Unknown Job Id Error 15963928.tbi-pbs-ng.inet.dkfz-heidelberg.de
> qstat -x -f  -u otptest 15963928 2> /dev/null
> qstat -x -f  -u otptest 15963928 1> /dev/null
qstat: Unknown Job Id Error 15963928.tbi-pbs-ng.inet.dkfz-heidelberg.de
> echo $?
153

# both: information printed to stdout, error printed to  stderr, exit code not 0
> qstat -x -f  -u otptest 15963928 15841124 
<Data><Job>…</Job></Data>
qstat: Unknown Job Id Error 15963928.tbi-pbs-ng.inet.dkfz-heidelberg.de
> qstat -x -f  -u otptest 15963928 15841124 2> /dev/null
<Data><Job>…</Job></Data>
> qstat -x -f  -u otptest 15963928 15841124 1> /dev/null
qstat: Unknown Job Id Error 15963928.tbi-pbs-ng.inet.dkfz-heidelberg.de
> echo $?
153

To simplify solving this problem, it would make sense to store stdout and stderr separately in ExecutionResult.

askask commented 6 years ago

LSF also return an non-zero exit code with unknown jobs, but doesn't write anything to stderr if you use the -json option.