(Supported) Predefined Functions¶
Warning
Not all functions mentioned below are supported yet. However, all of the listed functions will be supported in the future.
-
classad.
eval
(expression: Any) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]¶ Evaluates
expression
as a string and then returns the result of evaluating the contents of the string as aClassAd
expression.
-
classad.
unparse
(attribute: classad._base_expression.Expression) → str¶ This function looks up the value of the provided
attribute
and returns the unparsed version as astr
. The attribute’s value is not evaluated. If the attribute’s value isx + 3
, then the function would return the string"x + 3"
. If the provided attribute cannot be found, an empty string is returned.This function returns
Error
if other than exactly1
argument is given or the argument is not an attribute reference.
-
classad.
ifThenElse
(if_expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], then_expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], else_expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]¶ A conditional expression is described by
if_expression
. The following defines the return values, whenif_expression
evaluates toTrue
- evaluate and return the value as given bythen_expression
False
- evaluate and return the value as given byelse_expression
Undefined
- return the valueUndefined
Error
- return the valueError
0.0
- evaluate and return the value as given byelse_expression
non-
0.0
float values - evaluate and return the value as given bythen_expression
If
if_expression`
evaluates to give a value of typestr
, the function returns the valueError
. The implementation uses lazy evaluation, so expressions are only evaluated as defined.This function returns
Error
if other than exactly3
arguments are given.
-
classad.
isUndefined
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
, ifexpression
evaluates toUndefined
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
isError
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
ifexpression
evaluates toError
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
isString
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
ifexpression
evaluates to astr
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
isInteger
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
ifexpression
evaluates to anint
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
isReal
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
ifexpression
evaluates to afloat
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
isBoolean
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
ifexpression
evaluates to abool
. ReturnsFalse
in all other cases.This function returns
Error
if other than exactly1
argument is given.
-
classad.
int
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the integer value defined by
expression
. If the type of the evaluatedexpression
isfloat
, the value is truncated (round towards zero) to anint
. If the type of the evaluatedexpression
isstr
, the string is converted to anint
. If this result is not an integer,Error
is returned. If the evaluatedexpression
isError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
real
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCFloat, classad._primitives.Error]¶ Returns the
float
value defined byexpression
. If the type of the evaluatedexpression
isint
, the return value is the converted integer. If the type of the evaluatedexpression
isstr
, the string is converted to afloat
value. If this result is not a float,Error
is returned. If the evaluatedexpression
isError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
string
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ Returns the string that results from evaluating
expression
. A non-string value is converted to a string. If the evaluatedexpression
isError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
floor
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the integer that results from evaluating
expression
, if the type of the evaluatedexpression
isint
. If the type of the evaluatedexpression
is not integer, functionreal()
is called. Its return value is then used to return the largest magnitude integer that is not larger than the returned value. If functionreal()
returnsError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
ceiling
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the integer that results from evaluating
expression
, if the type of the evaluatedexpression
isint
. If the type of the evaluatedexpression
is not integer, functionreal()
is called. Its return value is then used to return the smallest magnitude integer that is not less than the returned value. If functionreal()
returnsError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
pow
(base: classad._primitives.HTCInt, exponent: classad._primitives.HTCInt) → classad._primitives.HTCInt¶ -
classad.
pow
(base: classad._primitives.HTCInt, exponent: classad._primitives.HTCInt) → classad._primitives.HTCFloat -
classad.
pow
(base: classad._primitives.HTCFloat, exponent: classad._primitives.HTCFloat) → classad._primitives.HTCFloat Calculates
base
raised to the power ofexponent
. Ifexponent
is an integer value greater than or equal to0
, andbase
is an integer, then an integer value is returned. Ifexponent
is an integer value less than0
, or if eitherbase
orexponent
is a float, then a float value is returned. An invocation withexponent=0
orexponent=0.0
, for any value ofbase
, including0
or0.0``returns the value ``1
or1.0
, type appropriate.
-
classad.
quantize
(a: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], b: classad._primitives.HTCInt) → classad._primitives.HTCInt¶ -
classad.
quantize
(a: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], b: classad._primitives.HTCFloat) → classad._primitives.HTCFloat -
classad.
quantize
(a: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], b: List[Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]]) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error] quantize()
computes the quotient ofa/b
, in order to further computeceiling(quotient) * b
. This computes and returns an integral multiple ofb
that is at least as large asa
. So, whenb >= a
, the return value will beb
. The return type is the same as that ofb
, whereb
is anint
orfloat
.When
b
is alist
,quantize()
returns the first value in the list that is greater than or equal toa
. When no value in the list is greater than or equal toa
, this computes and returns an integral multiple of the last member in the list that is at least as large asa
.This function returns
Error()
ifa
orb
, or a member of the list that must be considered is not an int or float.Here are examples:
8 = quantize(3, 8) 4 = quantize(3, 2) 0 = quantize(0, 4) 6.8 = quantize(1.5, 6.8) 7.2 = quantize(6.8, 1.2) 10.2 = quantize(10, 5.1) 4 = quantize(0, {4}) 2 = quantize(2, {1, 2, "A"}) 3.0 = quantize(3, {1, 2, 0.5}) 3.0 = quantize(2.7, {1, 2, 0.5}) ERROR = quantize(3, {1, 2, "A"})
-
classad.
round
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the integer that results from the evaluation of
expression
, if the type of the evaluatedexpression
isint
. If the type of the evaluatedexpression
is notint
, functionreal()
is called. Its return value is then used to return the integer that results from a round-to-nearest rounding method. The nearest integer value to the return value is returned, except in the case of the value at the exact midpoint between two integer values. In this case, the even valued integer is returned. Ifreal(expression)
returnsError
orUndefined
, or the integer value does not fit into 32 bits,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
random
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error] = 1.0) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.Error]¶ If the optional argument
expression
evaluates to typeint
orfloat
calledx
, the return value is the integer or floatr
randomly chosen from the interval0 <= r < x
. With no argument, the return value is chosen withrandom(1.0)
. ReturnsError
in all other cases.This function returns
Error
if greater than1
argument is given.
-
classad.
strcat
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], *args: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ Returns the string which is the concatenation of all arguments, where all arguments are converted to type
str
by functionstring()
. ReturnsError
if any argument evaluates toUndefined
orError
.
-
classad.
join
(seperator: classad._primitives.HTCStr, *args: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ -
classad.
join
(seperator: classad._primitives.HTCStr, arguments: classad._primitives.HTCList) → Union[classad._primitives.HTCStr, classad._primitives.Error] -
classad.
join
(arguments: classad._primitives.HTCList) → Union[classad._primitives.HTCStr, classad._primitives.Error] Returns the string which is the concatenation of all arguments after the first one. The first argument is the separator, and it is inserted between each of the other arguments during concatenation. All arguments are converted to type
string
bystring()
before concatenation. If there are exactly two arguments and the second argument is alist
, all members of the list are converted to strings and then joined using the separator. If there is only one argument, and the argument is a list, all members of the list are converted to strings and then concatenated.Returns
Error
if any argument evaluates toUndefined
orError
.For example:
"a, b, c" = join(", ", "a", "b", "c") "abc" = join(split("a b c")) "a;b;c" = join(";", split("a b c"))
-
classad.
substr
(s: classad._primitives.HTCStr, offset: classad._primitives.HTCInt, length: Optional[classad._primitives.HTCInt] = None) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ Returns the substring of
s
, from the position indicated byoffset
, with (optional)length
characters. The first character withins
is at offset0
. If the optionallength
argument is not present, the substring extends to the end of the string. Ifoffset
is negative, the value(length - offset)
is used for the offset. Iflength
is negative, an initial substring is computed, from the offset to the end of the string. Then, the absolute value oflength
characters are deleted from the right end of the initial substring. Further, where characters of this resulting substring lie outside the original string, the part that lies within the original string is returned. If the substring lies completely outside the original string, the null string is returned.This function returns
Error
if greater than3
or less than2
arguments are given.
-
classad.
strcmp
(a: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], b: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Both arguments are converted to
str
by functionstring()
. The return value is an integer that will beless than 0, if
a
is lexicographically less thanb
equal to 0, if
a
is lexicographically equal tob
greater than 0, if
a
is lexicographically greater thanb
If either argument evaluates to
Error
orUndefined
,Error
is returned.This function returns
Error
if other than2
arguments are given.See also
Case is significant in comparison. Refer to
stricmp()
for case insignificant comparison.
-
classad.
stricmp
(a: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error], b: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ This function is the same as
strcmp()
, except that letter case is not significant.See also
Refer to
strcmp()
for case significant comparison.
-
classad.
toUpper
(s: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ The single argument
s
is converted to typestr
by functionstring()
. The return value is this string, with all lower case letters converted to upper case. If the argument evaluates toError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
toLower
(s: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ The single argument
s
is converted to typestr
by functionstring()
. The return value is this string, with all upper case letters converted to lower case. If the argument evaluates toError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
size
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the number of characters in the string, after calling function
string()
. If the argument evaluates toError
orUndefined
,Error
is returned.This function returns
Error
if other than exactly1
argument is given.
-
classad.
split
(s: classad._primitives.HTCStr, tokens: Optional[classad._primitives.HTCStr] = None) → List[classad._primitives.HTCStr]¶ Returns a list of the substrings of
s
that have been split up by using any of the characters within stringtokens
. Iftokens
is not specified, then all white space characters are used to delimit the string.
-
classad.
splitUserName
(name: classad._primitives.HTCStr) → List[classad._primitives.HTCStr]¶ Returns a list of two strings. Where
name
includes an@
character, the first string in the list will be the substring that comes before the@
character, and the second string in the list will be the substring that comes after. Thus, ifname
is"user@domain"
, then the returned list will be{"user", "domain"}
. If there is no@
character inname
, then the first string in the list will bename
, and the second string in the list will be the empty string. Thus, ifname
isusername
, then the returned list will be{"username", ""}
.
-
classad.
splitSlotName
(name: classad._primitives.HTCStr) → List[classad._primitives.HTCStr]¶ Returns a list of two strings. Where
name
includes an@
character, the first string in the list will be the substring that comes before the@
character, and the second string in the list will be the substring that comes after. Thus, ifname
is"slot1@machine"
, then the returned list will be{"slot1", "machine"}
. If there is no@
character inname
, then the first string in the list will be the empty string, and the second string in the list will bename
. Thus, ifname
is"machinename"
, then the returned list will be{"machinename"}
.
-
classad.
time
() → classad._primitives.HTCInt¶ Returns the current coordinated universal time. This is the time, in seconds, since midnight of January 1, 1970.
-
classad.
formatTime
(time: Optional[classad._primitives.HTCInt], format: Optional[classad._primitives.HTCStr]) → classad._primitives.HTCStr¶ Returns a formatted string that is a representation of
time
. The argumenttime
is interpreted as coordinated universal time in seconds, since midnight of January 1, 1970. If not specified,time
will default to the current time.The argument
format
is interpreted similarly to the format argument of the ANSI C strftime function. It consists of arbitrary text plus placeholders for elements of the time. These placeholders are percent signs (%) followed by a single letter. To have a percent sign in the output, use a double percent sign (%%). Ifformat
is not specified, it defaults to%c
.Because the implementation uses strftime() to implement this, and some versions implement extra, non-ANSI C options, the exact options available to an implementation may vary. An implementation is only required to implement the ANSI C options which are:
%a
abbreviated weekday name
%A
full weekday name
%b
abbreviated month name
%B
full month name
%c
local date and time representation
%d
day of the month (01-31)
%H
hour in the 24-hour clock (0-23)
%I
hour in the 12-hour clock (01-12)
%j
day of the year (001-366)
%m
month (01-12)
%M
minute (00-59)
%p
local equivalent of AM or PM
%S
second (00-59)
%U
week number of the year (Sunday as first day of week) (00-53)
%w
weekday (0-6, Sunday is 0)
%W
week number of the year (Monday as first day of week) (00-53)
%x
local date representation
%X
local time representation
%y
year without century (00-99)
%Y
year with century
%Z
time zone name, if any
-
classad.
interval
(seconds: classad._primitives.HTCInt) → classad._primitives.HTCStr¶ Uses
seconds
to return a string of the formdays+hh:mm:ss
. This represents an interval of time. Leading values that are zero are omitted from the string. For example,seconds
of 67 becomes"1:07"
. A second example,seconds
of1472523 = 17*24*60*60 + 1*60*60 + 3
, results in the string"17+1:02:03"
.
-
classad.
debug
(expression: Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.HTCStr, classad._primitives.HTCBool, classad._primitives.Undefined, classad._primitives.Error]¶ This function evaluates its argument, and it returns the result. Thus, it is a no-operation. However, a side-effect of the function is that information about the evaluation is logged to the evaluating program’s log file, at the
D_FULLDEBUG
debug level. This is useful for determining why a given ClassAd expression is evaluating the way it does. For example, if a condor_startdSTART
expression is unexpectedly evaluating toUndefined
, then wrapping the expression in thisdebug()
function will log information about each component of the expression to the log file, making it easier to understand the expression.
-
classad.
envV1ToV2
(old_env: classad._primitives.HTCStr) → classad._primitives.HTCStr¶ This function converts a set of environment variables from the old HTCondor syntax to the new syntax. The single argument should evaluate to a string that represents a set of environment variables using the old HTCondor syntax (usually stored in the job ClassAd attribute
Env
). The result is the same set of environment variables using the new HTCondor syntax (usually stored in the job ClassAd attributeEnvironment
). If the argument evaluates toUndefined
, then the result is alsoUndefined
.
-
classad.
mergeEnvironment
(env: classad._primitives.HTCStr, *args: classad._primitives.HTCStr) → classad._primitives.HTCStr¶ This function merges multiple sets of environment variables into a single set. If multiple arguments include the same variable, the one that appears last in the argument list is used. Each argument should evaluate to a string which represents a set of environment variables using the new HTCondor syntax or
Undefined
, which is treated like an empty string. The result is a string that represents the merged set of environment variables using the new HTCondor syntax (suitable for use as the value of the job ClassAd attributeEnvironment
).
-
classad.
stringListSize
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr]) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns the number of elements in the string
string_list
, as delimited by the optionaldelimiter
string. ReturnsError
if either argument is not astr
.This function returns
Error
if other than1
or2
arguments are given.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListSum
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = 'None') → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ -
classad.
stringListSum
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = 'None') → Union[classad._primitives.HTCFloat, classad._primitives.Error] Sums and returns the sum of all items in the string
string_list
, as delimited by the optionaldelimiter
string. If all items in the list are integers, the return value isint
. If any item in the list is a float value (non-integer), the return value isfloat
. If any item does not represent an integer or float value, the return value isError
.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListAvg
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → classad._primitives.HTCFloat¶ Sums and returns the float-valued average of all items in the string
string_list
, as delimited by the optionaldelimiter
string. If any item does not represent an integer or float value, the return value isError
. A list with0
items (the empty list) returns the value 0.0.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListMin
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.Error, classad._primitives.Undefined]¶ Finds and returns the minimum value from all items in the string
string_list
, as delimited by the optionaldelimiter
string. If all items in the list are integers, the return value isint
. If any item in the list is a float value (non-integer), the return valuefloat
. If any item does not represent an integer or float value, the return value isError
. A list with0
items (the empty list) returns the valueUndefined
.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListMax
(string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCFloat, classad._primitives.HTCInt, classad._primitives.Error, classad._primitives.Undefined]¶ Finds and returns the maximum value from all items in the string
string_list
, as delimited by the optionaldelimiter
string. If all items in the list are integers, the return value isint
. If any item in the list is a float value (noninteger), the return valuefloat
. If any item does not represent an integer or float value, the return value isError
. A list with0
items (the empty list) returns the valueUndefined
.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListMember
(x: classad._primitives.HTCStr, string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Returns
True
if itemx
is in the stringstring_list
, as delimited by the optionaldelimiter
string. ReturnsFalse
if itemx
is not in the stringstring_list
. Comparison is done withstrcmp()
. The return value isError
, if any of the arguments are not strings.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListIMember
(x: classad._primitives.HTCStr, string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Same as
stringListMember()
, but comparison is done withstricmp()
, so letter case is not relevant.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
stringListsIntersect
(list_a: classad._primitives.HTCStr, list_b: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCInt, classad._primitives.Error]¶ Returns
True
if the lists contain any matching elements, and returnsFalse
if the lists do not contain any matching elements. ReturnsError
if either argument is not astr
or if an incorrect number of arguments are given.Note
The default delimiter contains the comma and space characters. A string within the
string_list
is ended (delimited) by one or more characters within thedelimiter
string.
-
classad.
regexp
(pattern: classad._primitives.HTCStr, target: classad._primitives.HTCStr, options: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Uses the description of a regular expression given by string
pattern
to scan through the stringtarget
. ReturnsTrue
when target is a regular expression given bypattern
. ReturnsFalse
otherwise. If any argument is not astr
, or ifpattern
does not describe a valid regular expression, returnsError
.The
options
argument is a string of special characters that modify the use of the regular expressions. Inclusion of characters other than these as options are ignored.I
ori
Ignore letter case.
M
orm
Modifies the interpretation of the caret (^) and dollar sign ($) characters. The caret character matches the start of a string, as well as after each newline character. The dollar sign character matches before a newline character.
S
ors
The period matches any character, including the newline character.
-
classad.
regexps
(pattern: classad._primitives.HTCStr, target: classad._primitives.HTCStr, substitute: classad._primitives.HTCStr, options: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCStr, classad._primitives.Error]¶ Uses the description of a regular expression given by string
pattern
to scan through the stringtarget
. Iftarget
is a regular expression as described bypattern
, the string substitute is returned, with backslash expansion performed. If any argument is not astr
, returnsError
.The
options
argument is a string of special characters that modify the use of the regular expressions. Inclusion of characters other than these as options are ignored.I
ori
Ignore letter case.
M
orm
Modifies the interpretation of the caret (^) and dollar sign ($) characters. The caret character matches the start of a string, as well as after each newline character. The dollar sign character matches before a newline character.
S
ors
The period matches any character, including the newline character.
-
classad.
stringList_regexpMember
(pattern: classad._primitives.HTCStr, string_list: classad._primitives.HTCStr, delimiter: Optional[classad._primitives.HTCStr] = None, options: Optional[classad._primitives.HTCStr] = None) → Union[classad._primitives.HTCBool, classad._primitives.Error]¶ Uses the description of a regular expression given by string
pattern
to scan through the list of strings instring_list
. ReturnsTrue
when one of the strings instring_list
is a regular expression as described bypattern
. The optionaldelimiter
describes how the list is delimited, and stringoptions
modifies how the match is performed. ReturnsFalse
ifpattern
does not match any entries instring_list
. The return value isError
, if any of the arguments are notstr
, or ifpattern
is not a valid regular expression.The
options
argument is a string of special characters that modify the use of the regular expressions. Inclusion of characters other than these as options are ignored.I
ori
Ignore letter case.
M
orm
Modifies the interpretation of the caret (^) and dollar sign ($) characters. The caret character matches the start of a string, as well as after each newline character. The dollar sign character matches before a newline character.
S
ors
The period matches any character, including the newline character.
-
classad.
userHome
(userName: classad._primitives.HTCStr, default: Optional[classad._primitives.HTCStr] = None) → classad._primitives.HTCStr¶ Returns the home directory of the given user as configured on the current system (determined using the getpwdnam() call). (Returns
default
if thedefault
argument is passed and the home directory of the user is not defined.)
-
classad.
userMap
(mapSetName: classad._primitives.HTCStr, userName: classad._primitives.HTCStr) → classad._primitives.HTCList¶ -
classad.
userMap
(mapSetName: classad._primitives.HTCStr, userName: classad._primitives.HTCStr, preferredGroup: classad._primitives.HTCStr) → Union[classad._primitives.HTCStr, classad._primitives.Undefined] -
classad.
userMap
(mapSetName: classad._primitives.HTCStr, userName: classad._primitives.HTCStr, preferredGroup: classad._primitives.HTCStr, defaultGroup: classad._primitives.HTCStr) → classad._primitives.HTCStr The maps for the
userMap()
function are defined by the following configuration macros:<SUBSYS>_CLASSAD_USER_MAP_NAMES
,CLASSAD_USER_MAPFILE_<name>
andCLASSAD_USER_MAPDATA_<name>
(see the HTCondor-wide Configuration File Entries section).