Why can't I set a negative exit code for my jobs?


Question:  Why can I not set a negative exit code for my jobs when Torque is able to do so?

Answer:  The exit codes come from the job scripts themselves in most circumstances.  There's a limitation with POSIX where it's only got 8 bits it can use for the exit code, which allows you to use values of 0 to 255.  If you try to set the exit code to a negative number or a number greater than 255, the operating system will change the exit code you define to an unsigned 8 bit value.

Torque has it's own exit codes it can assign jobs from -1 to -12.  You can find a list of what these exit codes mean here:
http://docs.adaptivecomputing.com/torque/6-0-2/adminGuide/help.htm#topics/torque/2-jobs/jobExitStatus.htm

In these cases, Torque overrides the exit code it gets from the script and associates it's own exit code with the job. If you look at the exit code of the actual job script that failed it would have a different positive value.  Torque uses a negative exit code for these jobs because it knows these numbers can't be confused with anything coming from the jobs directly.

Tags: code, exit, negative, return
Last update:
2016-12-09 16:27
Author:
Ben Roberts
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags