How To Use Config Script To Indicate Pre Installed Software

Known to work with version 8.2

If you want each machine that has the special software installed to advertise its availability in its machine ClassAd ; and you want to detect availability in your configuration, you can do this with a config script in HTCondor 8.2 and later. (prior to 8.2 you must use STARTD Cron)

Lets say you want to use the attribute HAS_PYTHON in to indicate that the machine has python installed. Then you could use the following configuration

STARTD_ATTRS = HAS_PYTHON $(STARTD_ATTRS)
include command : $(LIBEXEC)/check_for_python.cmd

With tools The current directory can vary so the path to the script must be absolute. (you can avoid running the script for tools by using the alternate configuration at the bottom of this page)

The script must write lines in config syntax to stdout, so in bash check_for_python.cmd it might be written as

#!/bin/sh
# check for my python, and write config statements if we find it.
if [ -e /usr/bin/python ]; then echo HAS_PYTHON=true; fi

In Windows batch language the check_for_python.cmd script might be

@echo off
REM check the registry for python, and write config statements if we find it.
reg query HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve 2>NUL 1>NUL && echo HAS_PYTHON=true

Because the check_for_python.cmd script will be executed each time any HTCondor daemon starts or is reconfigured, and any time a HTCondor tool such as condor_status is run, you may want to configure the script to run only in the STARTD.

You can do this by wrapping the above configuration statements in an if block like this. use this configuration instead

if $(IsStartd)
  STARTD_ATTRS = HAS_PYTHON $(STARTD_ATTRS)
  include command : $(LIBEXEC)/check_for_python.cmd
endif

You should be aware, if you use the above configuration with if/endif. Then the script will not execute when you run condor_config_val unless you pass it the -subsystem startd argument.