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

Re: [Condor-users] <Keyword>_HOOK_PREPARE_JOB usage



On Tuesday, 19 June, 2012 at 4:58 PM, Kunal Rao wrote:
Hello,

How to use the <Keyword>_HOOK_PREPARE_JOB mentioned on this page : http://research.cs.wisc.edu/condor/manual/v7.4/4_4Job_Hooks.html

to setup job environment before it is run ?

I'd like to use this hook to setup some environment variables before the job starts execution. How do I set it up ? Any sample configuration settings would be helpful.
This won't work for environment variable setup. From the documentation:

The condor_starter waits until this hook returns before attempting to execute the job. If the hook returns a non-zero exit status, the condor_starter will assume an error was reached while attempting to set up the job environment and abort the job.

The process exits, returns control to the parent process (condor_starter) before a new sub-process is spawned to run your actual job. So any environment changes made by the hook script won't be seen by then job.

Instead of a job hook, take a look at using a user job wrapper: http://research.cs.wisc.edu/condor/manual/v7.6/3_3Configuration.html#19134 

This will be the parent process of the job so any environment changes it makes will be seen by the job.

Regards,
- Ian



---
Ian Chesal

Cycle Computing, LLC
Leader in Open Compute Solutions for Clouds, Servers, and Desktops
Enterprise Condor Support and Management Tools

http://www.cyclecomputing.com
http://www.cyclecloud.com
http://twitter.com/cyclecomputing