Known to work with HTCondor version: 7.0 -If you simply need to insert an environment variable, you can do that by putting the following in your configuration file on the execute machine: +One suggestion to have information from the machine be passed to the job's arguments or the job environment is to publish the information in the machine {quote: ClassAd} and leave it up to the user to insert it into the job's environment via the $$() mechanism, which substitutes in values from the target {quote: ClassAd}. Example machine configuration: {code} -STARTER_JOB_ENVIRONMENT = "APP1_PATH=/opt/app1 APP2_PATH=/opt/app2" -{endcode} - -If you need to dynamically modify an environment variable, you can do that in a wrapper script around the job. Here is what you would put in the configuration file: - -{code} -USER_JOB_WRAPPER=/path/to/condor_job_wrapper +APP1_PATH = "/opt/app1" +APP2_PATH = "/opt/app2" +STARTD_ATTRS = $(STARTD_ATTRS) APP1_PATH APP2_PATH {endcode} -Then you would create a file named condor_job_wrapper (or whatever name you choose), make it executable, and put in something like the following: +Then the user can insert this information into the job environment by putting the following in the job submit file, for example: {code} -#!/bin/sh - -# insert /s/std/bin into the PATH -export PATH=/s/std/bin:$PATH - -exec "$@" +environment = "APP1_PATH=$$(APP1_PATH) APP2_PATH=$$(APP2_PATH)" {endcode} - -Another way for information from the machine to enter the job environment is to publish the information in the machine {quote: ClassAd} and leave it up to the user to insert it into the job's environment via the $$() mechanism, which substitutes in values from the target {quote: ClassAd}. Example machine configuration: +and/or into job arguments: {code} -APP1_PATH = "/opt/app1" -APP2_PATH = "/opt/app2" -STARTD_ATTRS = $(STARTD_ATTRS) APP1_PATH APP2_PATH +arguments = "--app1=$$(APP1_PATH) --app2=$$(APP2_PATH)" {endcode} -Then the user can insert this information into the job environment by putting the following in the job submit file: - -{code} -environment = "APP1_PATH=$$(APP1_PATH) APP2_PATH=$$(APP2_PATH)" -{endcode} If it is expected that the job may run on machines where these attributes of the machine {quote: ClassAd} are not defined, a default value should be specified like this. For example, if it should just be empty when undefined, use this: {code}APP1_PATH=$$(APP1_PATH:){endcode}