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

Re: [Condor-users] Using a machine ad value in a deferral_time line?



On Feb 20, 2008, at 5:41 PM, Ian Chesal wrote:

I have, on every machine in my pool, an integer attribute pair that
defines a "preemption window":

	ALTERA_EARLY_PREEMPTION_TIME = 300

I'd like some of my jobs to wait for this preemption window to close
before they start actually doing any work. The deferral_time setting in
a submit ticket looks like a nice, generic way to pause the start of a
job until the premption window closes. I could just add:

	deferral_time = (CurrentTime + 300)

But I like to use the attributes whenever possible. Assuming I'm
advertising ALTERA_EARLY_PREEMPTION_TIME in the machine's classad by
adding it to STARTD_EXPRS, can I use TARGET in this setting to reference
the machine's ALTERA_EARLY_PREEMPTION_TIME value? So:

	deferral_time = (CurrentTime +
TARGET.ALTERA_EARLY_PREEMPTION_TIME + 1)


Sadly, the machine ad isn't considered when the job deferral attributes are evaluated. It appears we didn't consider a user wanting to do this.

Here's a hack to do what you want, though:
deferral_time = (CurrentTime + int("$$(ALTERA_EARLY_PREEMPTION_TIME)") + 1)

The $$(...) gets substituted with the appropriate machine ad attribute value at match time, but it can only be used inside strings. So we use the int() function to convert the string into an integer for use in the expression.

Thanks and regards,
Jaime Frey
UW-Madison Condor Team