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

Re: [HTCondor-users] hooks (machine attributes)



From: John G Heim <jheim@xxxxxxxxxxxxx>
Date: 06/14/2016 12:30 PM
 
> On the cluster I admin, there is a software package that is installed on
> all of the machines but is licensed on only some. I wrote a bash script
> that exits with an error code if the machine is not licensed. The script
> exits with an exit code of zero if the machine is licensed. When an end
> user tries to run the software on an unlicensed machine, it runs this
> script first and then prints instructions if the machine is unlicensed.
> Else it just runs the software.
>
> For condor users, I would like to make a variable available that they
> can put in their requirements. I'm unclear on how to do that. The
> documentation for hooks has an example that seems to be similar to what
> I want. But I can't find any clear howtos on this.
> -- -- John G. Heim; jheim@xxxxxxxxxxxxx; sip://jheim@xxxxxxxxxxxxxxxx

John, what you're looking for here isn't actually a hook, but a
"machine attribute."

It may be possible to write a "startd_cron" job to run a script to probe
the machine to see if it has a license for the software, but in your
case it may be simpler to define it in the configuration instead. Suppose
you had the software licensed for machines A, B, and D, but not C:

HasLicensedSoftware = ( \
        Machine == "machine_a.math.wisc.edu" || \
        Machine == "machine_b.math.wisc.edu" || \
       Machine == "machine_d.math.wisc.edu" )

STARTD_ATTRS = $(STARTD_ATTRS) HasLicensedSoftware

To get the exact machine name you'll need to use, run this command:
        condor_status machine_a -af Machine

With the above, on these three machines, the "HasLicensedSoftware"
attribute will be True, but on machine_c, it will be False.

Your users will then put the following in the requirements:

        requirements = HasLicensedSoftware

With this, the jobs will only match to machines where they're actually
allowed to run.

I used exactly this idea for an application which uses hardware
license cards, in fact. In that case, I wrote a OneShot startd_cron
job that would run "lspci" and if it detected the card it would set
the appropriate attribute to True, and then the job submissions
would look for that attribute.

        -Michael Pelletier.
_