File: classad_eval.rst

package info (click to toggle)
condor 23.9.6%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 60,012 kB
  • sloc: cpp: 528,272; perl: 87,066; python: 42,650; ansic: 29,558; sh: 11,271; javascript: 3,479; ada: 2,319; java: 619; makefile: 615; xml: 613; awk: 268; yacc: 78; fortran: 54; csh: 24
file content (131 lines) | stat: -rw-r--r-- 3,746 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.. _classad_eval:

*classad_eval*
======================

Evaluate the given ClassAd expression(s) in the context of the given
ClassAd attributes, and prints the result in ClassAd format.

:index:`classad_eval<single: classad_eval; HTCondor commands>`
:index:`classad_eval command`

Synopsis
--------

**classad_eval** **-help**

**classad_eval**
[**-[ad]-file** <*file-name*>]
[**-target-file** <*file-name*>]
<*ad* | *assignment* | *expression* | **-quiet**>\+

Description
-----------

**classad_eval** is designed to help you understand and debug ClassAd
expressions.  You can supply a ClassAd on the command-line, or via a
file, as context for evaluating the expression.  You may also construct
a ClassAd one argument at a time, with assignments.

By default, **classad_eval** will print the ClassAd context used to evaluate
the expression before printing the result of the first expression, and for
every expression with a new ClassAd thereafter.  You may suppress this
behavior with the ``-quiet`` flag, which replaces an ad, assignment,
or expression, and quiets every expression after it on the command line.

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``.

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

Note that **classad_eval** uses the ``new`` ClassAd syntax: ClassAds
specified in a file must be surrounded by square brackets and
attribute-value pairs must be separated by semicolons.  For compability
with ``condor_q -long:new`` and ``condor_status -long:new``, `classad_eval`
will use only the first ClassAd if passed a ClassAd list of them.

Examples
--------

Almost every ad, assignment, or expression will require you to single
quote them.  There are some exceptions; for instance, the following two
commands are equivalent:

.. code-block:: console

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

You can specify attributes for the context ad in three ways:

.. code-block:: console

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

You need not supply an empty ad for expressions that don't reference attributes:

.. code-block:: console

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

If you want to evaluate an expression in the context of the job ad, first
store the job ad in a file:

.. code-block:: console

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

You can extract a machine ad in a similar way:

.. code-block:: console

    $ condor_status -l:new slot1@exec-17 > machine.ad
    $ classad_eval -quiet -file machine.ad 'Rank'

You may evaluate an expression in order to check a match by using the
``-target-file`` option:

.. code-block:: console

    $ condor_q -l:new 1227.2 > job.ad
    $ condor_status -l:new exec-17 > machine.ad
    $ classad_eval -quiet -my-file job.ad -target-ad machine.ad 'MY.requirements' 'TARGET.requirements'

Assignments (including whole ClassAds) are all merged into the context ad:

.. code-block:: console

    $ 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


You can suppress printing the context ad partway through:

.. code-block:: console

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

Exit Status
-----------

Returns 0 on success.

Author
------

Center for High Throughput Computing, University of Wisconsin-Madison