How to insert custom ClassAd attributes into a machine ad

Known to work with HTCondor version: 7.0

In the following exapmles, a custom ClassAd attribute named MachineOwner is created with the value "chemistry". You can use whatever attribute name you want, but avoid conflicting with attribute names used by HTCondor. See the manual or run

condor_status -long
on a machine to see the attributes that are there.

How to insert custom ClassAd attributes in a machine ad via the config file

Using the config file to insert a custom machine attribute is particularly appropriate for static attribute values that do not change often - if your attribute value is dynamic, see below.

MachineOwner = "chemistry"
STARTD_ATTRS = $(STARTD_ATTRS) MachineOwner

If you want different values for different slots within the same machine, do this:

SLOT1_MachineOwner = "chemistry"
SLOT2_MachineOwner = "physics"

STARTD_ATTRS = $(STARTD_ATTRS) MachineOwner

Alternate. If you are using HTCondor 8.3.8 or later, you can set different attributes in different slot types. This makes configuration simpler when the number of slots (and thus the slot id's) is not fixed, but varies based on some other configuration value such as NUM_CPUS

NUM_SLOTS_TYPE_1 = 2
NUM_SLOTS_TYPE_2 = $(NUM_CPUS) - $(NUM_SLOTS_TYPE_1)

STARTD_ATTRS = MachineOwner $(STARTD_ATTRS)

SLOT_TYPE_1_MachineOwner = "chemistry"
SLOT_TYPE_2_MachineOwner = "physics"

How to insert custom ClassAd attributes in a machine ad via a script

You can insert dynamic attributes that are periodically updated from a script. Here's an example of what you put in the HTCondor configuration file to periodically call a script:

STARTD_CRON_JOBLIST = kernel
STARTD_CRON_kernel_PREFIX = kernel_
STARTD_CRON_kernel_EXECUTABLE = /path/to/kernel
STARTD_CRON_kernel_PERIOD = 1h
STARTD_CRON_kernel_MODE = periodic
STARTD_CRON_kernel_RECONFIG = false
STARTD_CRON_kernel_KILL = true
STARTD_CRON_kernel_ARGS =

The script named 'kernel' could add some attributes that give information about the system kernel. For example, it could output something like the following:

version = "2.6.9-55.0.12.ELsmp"
bigmem = FALSE
hugemem = FALSE

Given the configuration above, this would result in ClassAd attributes being added to the machine ClassAd with the following names: kernel_version, kernel_bigmem, and kernel_hugemem.

How to insert a custom ClassAd attribute into a machine ad from the Windows registry

New in 7.5.6: A list of windows registry keys may be specified in the configuration file to be published in the machine ClassAd. Example:

STARTD_PUBLISH_WINREG = \
 Perl_BinDir = HKLM\Software\Perl\BinDir; \
 Kerberos_Version = HKLM\SOFTWARE\MIT\Kerberos\Client\CurrentVersion\VersionString