gridengine/gridengine — Issue #7: start_command for terminate_method assumes Bourne shell (or derivatives)
Author: catharsis
Created: 2011-11-04 09:39:43+00:00
State: open

Not sure if this is a lack of documentation or a bug, but here goes.

When terminate_method is set as an executable path, it is executed in start_command (https://github.com/gridengine/gridengine/blob/master/source/daemons/shepherd/builtin_starter.c#L1304) with the assumption that the shell should be a Bourne shell derivative by adding "-c" (which tells the shell to read commands from its operand as opposed to the default behaviour of reading them from stdin) to the arguments list to execvp (https://github.com/gridengine/gridengine/blob/master/source/daemons/shepherd/builtin_starter.c#L1419). This causes issues when the interpreting shell for the job has been changed with the -S parameter to qsub. In my case, I had it set to Python (2.7) in which -c specifies the command to execute.

To sum up, the argv array to execvp (in my case) basically ends up like:

char *args[4];
args[0] = "/path/to/terminate.py"
args[1] = "-c"
args[2] = "/path/to/terminate.py"
args[3] = NULL

and the Python interpreter says the following:
File "", line 1
/path/to/terminate.py
^
SyntaxError: invalid syntax