ClassAd Class
- class classad2.ClassAd(input=None)
The ClassAd language defines a ClassAd as a mapping from attribute names to expressions. A
ClassAdis acollections.abc.MutableMappingfromstring keys toExprTreevalues. Expressions are always evaluated before being returned, and unless you calllookup(), converted into the corresponding Python type.A ClassAd expression may evaluate to (but is returned by
ClassAdas):undefined (
classad2.Value.Undefined)a boolean (
bool)an integer (
int)a float (
float)a string (
str)an absolute time value (
datetime.datetime)a relative time value (
float)a list (
list)a ClassAd (
ClassAd)error (
classad2.Value.Error)
When setting a value, the reverse is true. Additionally,
Noneis converted toclassad2.Value.Undefinedanddicts are converted toClassAds.- Parameters
input (
Union[str,dict,None]) –If
None, create an empty ClassAd.If a
str, parse theParserType.Newformat string and create the corresponding ClassAd.If a
dict, convert the dictionary to a ClassAd.
- eval(attr)
Evaluate the attribute named by attr in the context of this ClassAd.
- Parameters
attr (
str) – The attribute to evaluate.
- externalRefs(expr)
Returns the list of attributes referenced by the expression expr which are not defined by this ClassAd.
- flatten(expr)
Partially evaluate the expression in the context of this ad. Attributes referenced by the expression which are not defined by this ClassAd are not evaluated, but other attributes and subexpressions are. Thus,
RequestMemory * 1024 * 1024will evaluate to the amount of requested memory in bytes if this ClassAd defines theRequestMemoryattribute, and toRequestMemory * 1048576otherwise.
- internalRefs(expr)
Returns the list of attributes referenced by the expression expr which are defined by this ClassAd.
- matches(ad)
Evaluate the
requirementsattribute of the given ad in the context of this one.