Hi,
Setup:
qube 6.2.0 on dispatch/worker
qube 5.5 on qmanager
First Problem:
Our environment uses exported functions (environment modules in particular but its more a generic thing) - when submitting a job with the export_environment flag these are not carried forward producing syntax errors to stderr
with a clean shell:
# qbsub --flags export_environment env
32769
# cat 32769_0.err
#
# foo() { echo "bar"; }
# export -f foo
# qbsub --flags export_environment env
32770
# cat 32770_0.err
-sh: foo: line 1: syntax error: unexpected end of file
-sh: error importing function definition for `foo'
If your jobs shell is /bin/bash it sources /etc/profile.d/modules.sh and configures the environment for it everything will continue to work as it should for us at least but still get the stderr messages as it tries to set the function - however doing this spawns (an existing problem)...
The Second Problem:
Environment variables set in ones .bashrc override the variables set in the job. This one causes us a few more problems.
~/.bashrc contains:
export NUKE_VER=6.2.4
# ./qbsub --hosts lon3dwks12 --flags export_environment,elite --shell /bin/bash env
Job's Properties shows env: {...,'NUKE_VER': '6.2.4',....}
stdout includes NUKE_VER=6.2.4
correct - continuing
# export NUKE_VER=5.2.3
# ./qbsub --hosts lon3dwks12 --flags export_environment,elite --shell /bin/bash env
Job's Properties shows env: {...,'NUKE_VER': '5.2.3',....}
correct
stdout includes NUKE_VER=6.2.4
incorrect, it has been overridden by .bashrc.
using --shell /bin/sh naturally avoids this problem by not sourcing bashrc, but without that, the module functions don't work (first problem).
The only work around i can think of currently is if the first problem is fixed, then we can continue to use /bin/sh instead (which is actually still bash) and then we wont encounter the 2nd problem.
Another is asking all our wrappers around software (written in bash) to source the module functions so they can be used - somewhat less ideal but a workable solution!
If anyone can think of any work arounds/fixes, that would be rather useful.
Without more digging (will be tomorrow morning) I am currently assuming it only sets environment variables that aren't already set after spawning the shell (so its more a case of dispatch environment variables not overriding existing environment variables after the shell)
so:
Dispatch: MAYA_VER=2012
Destination: no MAYA_VER
Result: MAYA_VER=2012
Dispatch: MAYA_VER=2012
Destination: MAYA_VER=2011
Result: MAYA_VER=2011
This isn't really ideal, but makes sense in the case of HOSTNAME (which also follows the above behaviour)..
Thoughts ?
Thanks,
Martin