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

Re: [Condor-users] Setting environment variable to hold remote working dir

On Thu, Aug 09, 2012 at 12:49:00PM +0200, Tomas Lid�n wrote:
> > So if you want to pass this information to a sub-process of your job,
> > it's already in that job's environment.  Of course, the job could just
> > do a "pwd"
> > to find out what directory it is running in.
> > 
> Well, that would need to be in the first program - which I do not have
> control over (it's a testing framework).

Maybe the test framework already passes through all environment variables it
receives to the child?  You must have believed this to be true, otherwise
your first attempt of setting

    environment = "FOO=BAR"

would never have achieved anything in the first place. So I'd start by
trying that.

Also, maybe the test framework leaves the working directory unchanged when
it runs the sub-process. In that case problem is solved too.

If neither of those are true, then I think you'll need to run a small
wrapper script for the job:

    run_the_framework myprog --pass-some-args="TESTDIR=$_CONDOR_JOB_IWD"

(or equivalent .bat file if you are using Windows).

If the framework *doesn't* pass any environment variables and *doesn't* keep
the working directory the same, and *doesn't* accept command-line args like
I showed above to pass to the program under test, then you have a problem.

You could stick the info in a file with a fixed location:

    echo "$_CONDOR_JOB_IWD" >/tmp/condor_iwd
    run_the_framework myprog    # myprog knows to read /tmp/condor_iwd

But then you couldn't have multiple instances of myprog running on the
same execute node, as there's no way to distinguish between them.