Application descriptor » History » Version 2
Herve Caumont, 2013-09-09 16:39
| 1 | 1 | Herve Caumont | h1. Application Descriptor File |
|---|---|---|---|
| 2 | |||
| 3 | {{>toc}} |
||
| 4 | |||
| 5 | h2. Purpose |
||
| 6 | |||
| 7 | The application descriptor file contains the definition of the application in terms of: |
||
| 8 | * job templates including: |
||
| 9 | ** streaming executable |
||
| 10 | 2 | Herve Caumont | ** default parameters |
| 11 | 1 | Herve Caumont | ** job default configuration |
| 12 | * workflow including the workflow nodes defined with |
||
| 13 | ** the source for the inputs (e.g. a previous node, a catalogue series, a local file) |
||
| 14 | ** their parameter values to override the default parameters (defined in the job template above) |
||
| 15 | |||
| 16 | h2. Type |
||
| 17 | |||
| 18 | The application descriptor is an XML file available in $_CIOP_APPLICATION_PATH/application.xml |
||
| 19 | |||
| 20 | > Note: the value $_CIOP_APPLICATION_PATH is /application |
||
| 21 | |||
| 22 | h2. Format |
||
| 23 | |||
| 24 | The application descriptor file structure is available below: |
||
| 25 | |||
| 26 | |_.Level |_.Tag name |_.Descendants |_.Tag Contents |_.Cardinality |_.Attribute name |_.Attribute value | |
||
| 27 | |> | application | All |- |1..1 |- |- | |
||
| 28 | |1 | jobTemplates | jobTemplate |- |1..1 |- |- | |
||
| 29 | |2 | jobTemplate | streamingExecutable, defaultParameters, defaultJobconf |- |1..* |id |job template name | |
||
| 30 | |3 | streamingExecutable | none |path to streaming executable |1..1 |- |- | |
||
| 31 | |3 | defaultParameters | parameter |- |0..1 |- |- | |
||
| 32 | |4 | parameter | - |parameter default value |0..* |id |parameter name | |
||
| 33 | |3 | defaultJobconf | - |- |0..1 |- |- | |
||
| 34 | |4 | property | - |property value |0..* |id |property value | |
||
| 35 | |1 | workflow | workflowVersion,node |- |1..1 |id |workflow name | |
||
| 36 | |2 | workflowVersion | - |workflow version |1..1 |- |- | |
||
| 37 | |2 | node | job, sources, parameters |- |1..* |id |node name | |
||
| 38 | |3 | job | - |- |1..1 |id |job template name | |
||
| 39 | |3 | sources | source |- |1..1 |- |- | |
||
| 40 | |4 | source | - |source value |1..* |refid |file:urls, wf:node, cas:serie | |
||
| 41 | |3 | parameters | parameter |- |0..* |- |- | |
||
| 42 | |4 | parameter | - |parameter value (overrides the parameter default value)|0..* |id |parameter name | |
||
| 43 | |||
| 44 | > Tip: check your application descriptor file with the *ciop-appcheck* utility described here: [[ciop-appcheck]] |
||
| 45 | |||
| 46 | h2. Application descriptor values and properties |
||
| 47 | |||
| 48 | h3. source refid values |
||
| 49 | |||
| 50 | h4. Local inputs - local files will use the file:// protocol and are defined in the workflow as follows: |
||
| 51 | |||
| 52 | <pre><code class="xml"> |
||
| 53 | <workflow id="somename"> |
||
| 54 | <workflowVersion>1.0</workflowVersion> |
||
| 55 | <node id="somenodeid"> |
||
| 56 | <job id="ceda-collect"></job> |
||
| 57 | <sources> |
||
| 58 | <source refid="file:urls" >/application/input.urls</source> |
||
| 59 | </sources> |
||
| 60 | </node> |
||
| 61 | </workflow> |
||
| 62 | </code></pre> |
||
| 63 | |||
| 64 | and the file _input.urls_ contains the references to the local files: |
||
| 65 | |||
| 66 | <pre><code class="ruby"> |
||
| 67 | [ user@sb ~] cat /application/input.urls |
||
| 68 | file:///tmp/somefile1 |
||
| 69 | file:///tmp/somefile2 |
||
| 70 | file:///tmp/somefile3 |
||
| 71 | </code></pre> |
||
| 72 | |||
| 73 | Then the job executable can use ciop-copy to copy the files if needed. |
||
| 74 | |||
| 75 | <pre><code class="c"> |
||
| 76 | while read inputfile |
||
| 77 | do |
||
| 78 | echo $inputfile | ciop-copy -o ./ - |
||
| 79 | done |
||
| 80 | </code></pre> |
||
| 81 | |||
| 82 | h4. Values |
||
| 83 | |||
| 84 | Passing values to a job follows the same approach as above. |
||
| 85 | |||
| 86 | <pre><code class="xml"> |
||
| 87 | <workflow id="somename"> |
||
| 88 | <workflowVersion>1.0</workflowVersion> |
||
| 89 | <node id="somenodeid"> |
||
| 90 | <job id="ceda-collect"></job> |
||
| 91 | <sources> |
||
| 92 | <source refid="file:urls" >/application/inputparams</source> |
||
| 93 | </sources> |
||
| 94 | </node> |
||
| 95 | </workflow> |
||
| 96 | </code></pre> |
||
| 97 | |||
| 98 | and the file _inputparams_ contains the list of values: |
||
| 99 | |||
| 100 | <pre><code class="ruby"> |
||
| 101 | [ user@sb ~] cat /application/inputparams |
||
| 102 | -10,-10,10,10 |
||
| 103 | 10,10,20,20 |
||
| 104 | </code></pre> |
||
| 105 | |||
| 106 | In the example above, the executable manages the parameters (bounding boxes) with: |
||
| 107 | |||
| 108 | <pre><code class="ruby"> |
||
| 109 | while read bbox |
||
| 110 | do |
||
| 111 | echo "processing bounding box $bbox" |
||
| 112 | done |
||
| 113 | </code></pre> |
||
| 114 | |||
| 115 | h4. Products available in the sandbox internal catalogue |
||
| 116 | |||
| 117 | During the sandbox definition and creation you may have selected a list of EO products, the references to these products are available in the sandbox internal catalogue. |
||
| 118 | The workflow is defined as follows: |
||
| 119 | |||
| 120 | <pre><code class="xml"> |
||
| 121 | <workflow id="some_workflow"> |
||
| 122 | <workflowVersion>1.0</workflowVersion> |
||
| 123 | <node id="some_node"> |
||
| 124 | <job id="some_job_template"></job> |
||
| 125 | <sources> |
||
| 126 | <source refid="cas:serie">ATS_TOA_1P</source> |
||
| 127 | </sources> |
||
| 128 | <parameters> |
||
| 129 | <parameter id="some_parameter">some_value</parameter> |
||
| 130 | </parameters> |
||
| 131 | </node> |
||
| 132 | </code></pre> |
||
| 133 | |||
| 134 | As an example, the job executable would contain the lines below to copy the catalogue products locally: |
||
| 135 | |||
| 136 | <pre><code class="ruby"> |
||
| 137 | while read product |
||
| 138 | do |
||
| 139 | echo $product | ciop-copy -o ./ - |
||
| 140 | done |
||
| 141 | </code></pre> |
||
| 142 | |||
| 143 | h4. outputs from a previous node |
||
| 144 | |||
| 145 | The methods above are used for the first job of the workflow. The remaining nodes need to refer the precedent job(s) results: |
||
| 146 | |||
| 147 | <pre><code class="xml"> |
||
| 148 | <workflow id="somename"> |
||
| 149 | <workflowVersion>1.0</workflowVersion> |
||
| 150 | <node id="some_node_1"> |
||
| 151 | <job id="some_job_template_1"></job> |
||
| 152 | <sources> |
||
| 153 | <source refid="file:urls">/application/inputparams</source> |
||
| 154 | </sources> |
||
| 155 | </node> |
||
| 156 | <node id="some_node_2"> |
||
| 157 | <job id="some_job_template_2"></job> |
||
| 158 | <sources> |
||
| 159 | <source refid="wf:node">some_node_1</source> |
||
| 160 | </sources> |
||
| 161 | </node> |
||
| 162 | </workflow> |
||
| 163 | </code></pre> |
||
| 164 | |||
| 165 | h3. Job configuration |
||
| 166 | |||
| 167 | At job template level, the default properties below can be defined: |
||
| 168 | |||
| 169 | |_.Property |_.Value |_.Description | |
||
| 170 | |ciop.job.max.tasks | integer | sets the maximum number of jobs (>0) | |
||
| 171 | |mapred.task.timeout | integer | number of milliseconds of walltime for the execution of a job without reporting via ciop-log | |
||
| 172 | |||
| 173 | h2. Example |
||
| 174 | |||
| 175 | The example below is taken from the BEAM Arithm tutorial available here: [[Beam Arithm]] |
||
| 176 | |||
| 177 | <pre><code class="xml"> |
||
| 178 | <?xml version="1.0" encoding="UTF-8"?> |
||
| 179 | <application id="beam_arithm"> |
||
| 180 | <jobTemplates> |
||
| 181 | <!-- BEAM BandMaths operator job template --> |
||
| 182 | <jobTemplate id="expression"> |
||
| 183 | <streamingExecutable>/application/expression/run</streamingExecutable> |
||
| 184 | <defaultParameters> |
||
| 185 | <parameter id="expression">l1_flags.INVALID?0:radiance_13>15?0:100+radiance_9-(radiance_8+(radiance_10-radiance_8)*27.524/72.570)</parameter> |
||
| 186 | </defaultParameters> |
||
| 187 | </jobTemplate> |
||
| 188 | <!-- BEAM Level 3 processor job template --> |
||
| 189 | <jobTemplate id="binning"> |
||
| 190 | <streamingExecutable>/application/binning/run</streamingExecutable> |
||
| 191 | <defaultParameters> |
||
| 192 | <parameter id="cellsize">9.28</parameter> |
||
| 193 | <parameter id="bandname">out</parameter> |
||
| 194 | <parameter id="bitmask">l1_flags.INVALID?0:radiance_13>15?0:100+radiance_9-(radiance_8+(radiance_10-radiance_8)*27.524/72.570)</parameter> |
||
| 195 | <parameter id="bbox">-180,-90,180,90</parameter> |
||
| 196 | <parameter id="algorithm">Minimum/Maximum</parameter> |
||
| 197 | <parameter id="outputname">binned</parameter> |
||
| 198 | <parameter id="resampling">binning</parameter> |
||
| 199 | <parameter id="palette">#MCI_Palette |
||
| 200 | color0=0,0,0 |
||
| 201 | color1=0,0,154 |
||
| 202 | color2=54,99,250 |
||
| 203 | color3=110,201,136 |
||
| 204 | color4=166,245,8 |
||
| 205 | color5=222,224,0 |
||
| 206 | color6=234,136,0 |
||
| 207 | color7=245,47,0 |
||
| 208 | color8=255,255,255 |
||
| 209 | numPoints=9 |
||
| 210 | sample0=98.19878118960284 |
||
| 211 | sample1=98.64947122314665 |
||
| 212 | sample2=99.10016125669047 |
||
| 213 | sample3=99.5508512902343 |
||
| 214 | sample4=100.0015413237781 |
||
| 215 | sample5=100.4522313573219 |
||
| 216 | sample6=100.90292139086574 |
||
| 217 | sample7=101.35361142440956 |
||
| 218 | sample8=101.80430145795337</parameter> |
||
| 219 | <parameter id="band">1</parameter> |
||
| 220 | <parameter id="tailor">true</parameter> |
||
| 221 | </defaultParameters> |
||
| 222 | <defaultJobconf> |
||
| 223 | <property id="ciop.job.max.tasks">1</property> |
||
| 224 | </defaultJobconf> |
||
| 225 | </jobTemplate> |
||
| 226 | </jobTemplates> |
||
| 227 | <workflow id="beam_arithm"> |
||
| 228 | <workflowVersion>1.0</workflowVersion> |
||
| 229 | <node id="node_expression"> |
||
| 230 | <job id="expression"></job> |
||
| 231 | <sources> |
||
| 232 | <!-- <source refid="file:urls">/home/fbrito/meris</source> --> |
||
| 233 | <source refid="cas:serie">MER_RR__1P</source> |
||
| 234 | </sources> |
||
| 235 | <parameters> |
||
| 236 | </parameters> |
||
| 237 | </node> |
||
| 238 | <node id="node_binning"> |
||
| 239 | <job id="binning"></job> |
||
| 240 | <sources> |
||
| 241 | <source refid="wf:node">node_expression</source> |
||
| 242 | </sources> |
||
| 243 | <parameters> |
||
| 244 | <parameter id="bitmask"/> |
||
| 245 | </parameters> |
||
| 246 | </node> |
||
| 247 | </workflow> |
||
| 248 | </application> |
||
| 249 | </code></pre> |