[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] getenv in submit file has no effect



On 10/20/2010 05:15 AM, Alexander Dietz wrote:
Hi,

I have a problem with the getenv command in a submit file. I am using
the following submit file:

universe = vanilla
executable = ./printenv
arguments =
environment =
getenv = True
log = logs/test.log
error = logs/test-$(cluster).err
output = logs/test-$(cluster).out
notification = never
queue 1


in which getenv is set to true, so, according to the documentation [1],
"the job will therefore execute with the same set of environment
variables that the user had at submit time.".

The executable printenv is just a simple python script to print out the
content of the environment variable PFILES while this script is running:

#!/usr/bin/python
import os
print os.getenv('PFILES')

This variable does not get passed to the condor environment. Here are
the steps I have made:

1. print the environment variable on the bash directly:
 > echo $PFILES
/archive/home/dietz/pfiles;/archive/home/gcolclou/heasoft6.9/heasoft-6.9/x86_64-unknown-linux-gnu-libc2.5/syspfiles

2. Try the python script:
 > ./printenv
/archive/home/dietz/pfiles;/archive/home/gcolclou/heasoft6.9/heasoft-6.9/x86_64-unknown-linux-gnu-libc2.5/syspfiles

3. Start the condor submit file in condor, and check the output file:
 > condor_submit test.sub
Submitting job(s).
Logging submit event(s).
1 job(s) submitted to cluster 78937623.
 > cat test.out
None

The 'None' indicates that the variable 'PFILES' is not set within the
condor environment. I am using the following version of condor:

$CondorVersion: 7.4.2 Mar 29 2010 BuildID: 227044 $
$CondorPlatform: X86_64-LINUX_RHEL5 $

Is this behavior a feature or a bug? According to the documentation of
condor_submit I expect a different behavior of this test. Can someone
clarify this issue, and how I can make sure the environment variables I
have set at the time I call condor_submit will be used on the node that
runs the executable?


Thanks
   Alex


[1] <http://www.cs.wisc.edu/condor/manual/v6.6/condor_submit.html>

I just tested on 7.4.4, and it works as expected.

$ export A=HI
$ echo $A
HI
$ echo "cmd=/bin/env\noutput=env.out\nlog=env.log\nqueue" | condor_submit ; condor_wait env.log
Submitting job(s).
Logging submit event(s).
1 job(s) submitted to cluster 10019.
All jobs done.
$ grep ^A env.out
$ echo "cmd=/bin/env\noutput=env.out\nlog=env.log\ngetenv=true\nqueue" | condor_submit ; condor_wait env.log
Submitting job(s).
Logging submit event(s).
1 job(s) submitted to cluster 10020.
All jobs done.
$ grep ^A env.out
A=HI

I notice you have your output going to logs/test-$(cluster).out, but you are cat'ing test.out in your local directory.

In fact,

$ cat env.py
#!/usr/bin/python
import os
print os.getenv('A')
$ echo "cmd=env.py\noutput=env.out\nlog=env.log\ngetenv=true\nqueue" | condor_submit ; condor_wait env.log
Submitting job(s).
Logging submit event(s).
1 job(s) submitted to cluster 10021.
All jobs done.
$ cat env.out
HI
$ echo "cmd=env.py\noutput=env.out\nlog=env.log\nqueue" | condor_submit ; condor_wait env.log
Submitting job(s).
Logging submit event(s).
1 job(s) submitted to cluster 10022.
All jobs done.
$ cat env.out
None

Best,


matt