Setting environment variables for a job
To set specific environment variables for a job, you can add them as list to your submission script. I.e.,
environment = "myenvvar=foo anothervar=baz"
if you want to evaluate a current environment variable into a job's environment, you can expand it with
$ENV(YOURVARIABLE)
for example, if you want to expand your current working directory into a new variable for your jobs environment
environment = "mysubmittorspwd=$ENV(PWD)"
(see also the environment section in 'man condor_submit' for more details on the syntax)
forwarding the whole environment
To forward all your current shell's environment variable to a job (except for the shared library paths LD_LIBRARY_PATH), you can include
getenv = True
in your submission script
But beware: assuming all your environment variables to be valid and working on some remote system is prone for pitfalls!
Use it only when you know, what you are doing! Else set environment variables explicitly as above!
forwarding the shared library path as well
Also this does not apply to the LD_LIBRARY_PATH that can not be transfered into the job environment unless it's an interactive job.
DO NOT ASSUME, THAT SHARED LIBRARY ARE CONSISTENT IN ANY WAY BETWEEN YOUR DESKTOP AND A BATCH NODE!
Everything following might work, but more probably can cause trouble.
If you really want to put the LD_LIBRARY_PATH into your environment consider the following 'trick':
In the submit file:
environment = "LD_LIBRARY_PATH_STORED=/usr/bin:/usr/local/bin:/usr/foo"
In the job script before running the executale:
export LD_LIBRARY_PATH_STORED=$LD_LIBRARY_PATH_STORED
If you want to reference output files of the job from inside your job you usually need the $PROCESS and $CLUSTER ID that are not by default in your job environment, to source them put into your submit file:
environment = "CLUSTER=$(Cluster) PROCESS=$(Process)"