HTCondor Project List Archives



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

[Condor-devel] What is the purpose of the string() ClassAd function?



What is the purpose of the string() ClassAd function?

Quoting from the Condor 6.8 manual:

	String string(AnyType Expr)
	    Returns the string that results from the evaluation of
	    Expr.  Converts a non-string value to a string. Where the
	    evaluated Expr is ERROR or UNDEFINED, ERROR is returned.

	    This function returns ERROR if other than exactly 1
	    argument is given.


So I test this:

With a string:

$ condor_status sparky	-format "%d\t" 'isError(string(Name))' \
			-format "%s\n" Name
0	sparky.lmcg.wisc.edu


With a boolean:

$ condor_status sparky	-format "%d\t" 'isError(string(HasAFS))' \
			-format "%s\n" HasAFS
1	TRUE


With an integer:

$ condor_status sparky	-format "%d\t" 'isError(string(Mips))' \
			-format "%s\n" Mips
1	1058


With a real:

$ condor_status sparky	-format "%d\t" 'isError(string(CurrentRank))' \
			-format "%s\n" CurrentRank
1	0.000000


With an expression:

$ condor_status sparky	-format "%d\t" 'isError(string(Rank))' \
			-format "%s\n" Rank
1	(Group =?= "lmcg") * (1000 + Tier)


Only in the case where the argument to string() is already a string
does it not return an error.  By contrast, the "%s" format character
correctly processes any argument as a string.

What is up?

In condor_classad/ast.C in FunctionString() I see the comment:

	// NOTE: ALL ARGUMENTS HAVE BEEN CONVERTED INTO STRING TYPES
	// BEFORE THIS FUNCTION WAS INVOKED.

This is obviously not true and it makes the function useless.

-- 
Daniel K. Forrest	Laboratory for Molecular and
forrest@xxxxxxxxxxxxx	Computational Genomics
(608) 262 - 9479	University of Wisconsin, Madison