File: convert-multi-q-statements.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 (170 lines) | stat: -rw-r--r-- 3,815 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
Example: Convert Multi-Queue Statements into One
================================================

The old method of setting multiple :subcom:`queue` statements into a
single submit description to create variance between submitted jobs is
deprecated. However, the ability to easily submit multiple jobs with
variance is still possible with a single queue statement. The following
examples will show how one can convert the older syntax to the improved
single queue statement.

.. note::

    The following example submit files are not designed to be useable but rather
    a demonstration of how the old syntax can be converted.

A Job Per File
--------------

The following example shows a submit file using multiple queue statements to
submit jobs with differing input files which can easily be done with a single
queue statement. This example assumes the working directory contains the files
``example1.in`` and ``example2.in``.

.. code-block:: condor-submit

    executable = /bin/cat
    arguments  = $(filename)

    transfer_input_files = $(filename)

    #==========Replace=========
    # Old Syntax
    filename = example1.in
    queue

    filename = example2.in
    queue
    #==========================

.. code-block:: condor-submit

    # Converted Syntax
    # Submit one job per file matching *.in
    queue filename matching files *.in

Jobs with multiple variables
----------------------------

.. sidebar:: External Item Data

    The queue statement can also have the per job item data
    stored in an external file that is referenced such as
    the following ``external.dat`` contents:

    .. code-block:: text

        3, 1, 10
        2, 8, 4

    .. code-block:: condor-submit

        queue A,B,C from external.dat

The following two examples show how multiple variables can be given
variance in a single queue statement.

.. code-block:: condor-submit

    executable = quadratic.sh
    arguments  = "$(A) $(B) $(C)"

    #==========Replace=========
    # Old Syntax
    A = 3
    B = 1
    C = 10
    queue

    A = 2
    B = 8
    C = 4
    queue
    #==========================

.. code-block:: condor-submit

    # Converted Syntax
    # Submit one job for each row of data
    queue A,B,C from (
        3, 1, 10
        2, 8, 4
    )

Shared Variance
^^^^^^^^^^^^^^^

In this example the ``tolerance`` variable is the same for two jobs
and different for the last. Despite only having two values in the set
of jobs, the ``tolerance`` must be set for each job in the converted
syntax unlike the old.

.. code-block:: condor-submit

    executable = word_count.py
    arguments  = "$(filename) $(tolerance)"

    transfer_input_files = $(filename)

    #==========Replace=========
    # Old Syntax
    tolerance = 50
    filename = first.txt
    queue

    filename = second.txt
    queue

    tolerance = 25
    filename = third.txt
    queue
    #==========================

.. code-block:: condor-submit

    # Converted Syntax
    # Submit one job per each row of data
    # Note: Each row needs each variable data defined
    queue tolerance, filename from (
        50, first.txt
        50, second.txt
        25, third.txt
    )

Variable Cadence
^^^^^^^^^^^^^^^^

In the following example, the ``capacity`` variable uses each assigned value for
two jobs with a varying ``type`` variable.

.. code-block:: condor-submit

    executable = science.py
    arguments  = "$(capacity) $(type)"

    #==========Replace=========
    # Old Syntax
    capacity = 100
    type = "soft"
    queue

    type = "hard"
    queue

    capacity = 42
    type = "soft"
    queue

    type = "hard"
    queue
    #==========================

.. code-block:: condor-submit

    # Converted Syntax
    type = $CHOICE(STEP,"soft","hard")
    queue 2 capacity from (
        100
        42
    )