Scroll to navigation

CLASSAD_EVAL(1) HTCondor Manual CLASSAD_EVAL(1)

NAME

classad_eval - HTCondor Manual

Evaluate ClassAd expression(s) in the context of the provided ClassAd attributes.

SYNOPSIS

classad_eval [-help]

classad_eval [options] <ad|expr|assignment> [<ad|expr|assignment> ...]

DESCRIPTION

classad_eval tests and/or debugs ClassAd expressions provided via the command line when evaluated in a specific contexts of source and target ClassAds.

OPTIONS

Display tool usage.
Disable printing of context ClassAds before evaluation results.
Enable tool debugging.
-[my-]file path
A file containing the source ClassAd context.

Warning:

This option overrides any previous ClassAd context.


A file containing the target ClassAd context.
<ad|expr|assignment>
A ClassAd context modification (inline ad '[ foo = 5; bar = False ]' or assignment 'foo = 10') or expression to be evaluated ('foo * 100').

GENERAL REMARKS

Options, flags, and arguments may be freely intermixed, and take effect in left to right order.

Attributes specified on the command line, including those specified as part of a complete ad, replace attributes in the context ad, which starts empty. You can't remove attributes from the context ad, but you can set them to undefined.

Use single quotes to denote chunks of ClassAd assignments and expressions to prevent issues between shell quoting and ClassAd quoting.

By default, the full ClassAd context will be printed out before evaluating an expression. This behavior can be disabled by specifying -quiet.

This tool will only digests the first ClassAd in a list of ClassAds provided via a file.

Note:

This tool uses the new ClassAd syntax denoted by semicolon delimited attribute-value pairs contained in square brackets: [ foo = 1; bar = False ].


EXIT STATUS

0 - Success

1 - ClassAd context update failure

255 - Invalid command line option provided

EXAMPLES

Specifying a single attribute assignment for evaluation:

$ classad_eval 'a = 2' 'a * 2'


Specifying a single attribute assignment for evaluation without whitespace quoting:

$ classad_eval a=2 a*2


Specifying multiple attributes for evaluation:

$ classad_eval 'a = 2' 'b = 2' 'a + b'


Specifying inline ClassAd from evaluation:

$ classad_eval '[ a = 2; b = 2 ]' 'a + b'


Evaluating a ClassAd expression that requires no context ClassAds:

$ classad_eval 'strcat("foo", "bar")'


Evaluating an expression multiple times while changing the context:

$ classad_eval 'x = y' 'x' 'y = 7' 'x' '[ x = 6; z = "foo"; ]' 'x'
[ x = y ]
undefined
[ y = 7; x = y ]
7
[ z = "foo"; x = 6; y = 7 ]
6


Disabling the evaluation context ad echoing part way through evaluations:

$ classad_eval 'x = y' 'x' -quiet 'y = 7' 'x' '[ x = 6; z = "foo"; ]' 'x'
[ x = y ]
undefined
7
6


Evaluating an expression from a saved job ad:

$ condor_q -l:new 1234.5 > job.ad
$ classad_eval -quiet -file job.ad 'JobUniverse'


Evaluating an expression from a saved slot ad:

$ condor_status slot1@ep.host.name -l:new > slot.ad
$ classad_eval -quiet -file slot.ad 'Rank'


Evaluating an expression from a saved job ad and saved slot ad:

$ condor_q -l:new 1234.5 > job.ad
$ condor_status slot1@ep.host.name -l:new > slot.ad
$ classad_eval -quiet -my-file job.ad -target-file slot.ad 'MY.requirements' 'TARGET.requirements'


SEE ALSO

classads

AVAILABILITY

Linux, MacOS, Windows

Author

HTCondor Team

Copyright

1990-2026, Center for High Throughput Computing, Computer Sciences Department, University of Wisconsin-Madison, Madison, WI, US. Licensed under the Apache License, Version 2.0.

August 21, 2026