• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

common-workflow-language / cwljava / #352

07 Apr 2025 10:22AM UTC coverage: 59.538% (-0.6%) from 60.167%
#352

Pull #193

github

web-flow
Merge d636f9333 into 46536cad2
Pull Request #193: Add accessor for the extension field.

0 of 129 new or added lines in 129 files covered. (0.0%)

7347 of 12340 relevant lines covered (59.54%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.61
/src/main/java/org/w3id/cwl/cwl1_2/ResourceRequirementImpl.java
1
// Copyright Common Workflow Language project contributors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package org.w3id.cwl.cwl1_2;
16

17
import org.w3id.cwl.cwl1_2.utils.LoaderInstances;
18
import org.w3id.cwl.cwl1_2.utils.LoadingOptions;
19
import org.w3id.cwl.cwl1_2.utils.LoadingOptionsBuilder;
20
import org.w3id.cwl.cwl1_2.utils.SaveableImpl;
21
import org.w3id.cwl.cwl1_2.utils.ValidationException;
22

23
/**
24
* Auto-generated class implementation for <I>https://w3id.org/cwl/cwl#ResourceRequirement</I><BR> <BLOCKQUOTE>
25
 Specify basic hardware resource requirements.
26
 
27
 "min" is the minimum amount of a resource that must be reserved to
28
 schedule a job. If "min" cannot be satisfied, the job should not
29
 be run.
30
 
31
 "max" is the maximum amount of a resource that the job shall be
32
 allocated. If a node has sufficient resources, multiple jobs may
33
 be scheduled on a single node provided each job's "max" resource
34
 requirements are met. If a job attempts to exceed its resource
35
 allocation, an implementation may deny additional resources, which
36
 may result in job failure.
37
 
38
 If both "min" and "max" are specified, an implementation may
39
 choose to allocate any amount between "min" and "max", with the
40
 actual allocation provided in the `runtime` object.
41
 
42
 If "min" is specified but "max" is not, then "max" == "min"
43
 If "max" is specified by "min" is not, then "min" == "max".
44
 
45
 It is an error if max < min.
46
 
47
 It is an error if the value of any of these fields is negative.
48
 
49
 If neither "min" nor "max" is specified for a resource, use the default values below.
50
  </BLOCKQUOTE>
51
 */
52
public class ResourceRequirementImpl extends SaveableImpl implements ResourceRequirement {
53
  private LoadingOptions loadingOptions_ = new LoadingOptionsBuilder().build();
1✔
54
  private java.util.Map<String, Object> extensionFields_ =
1✔
55
      new java.util.HashMap<String, Object>();
56
  public java.util.Map<String, Object> getExtensionFields() {
NEW
57
    return this.extensionFields_;
×
58
  }
59

60
  private ResourceRequirement_class class_;
61

62
  /**
63
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/class</I><BR>
64
   * <BLOCKQUOTE>
65
   * Always 'ResourceRequirement'   * </BLOCKQUOTE>
66
   */
67

68
  public ResourceRequirement_class getClass_() {
69
    return this.class_;
×
70
  }
71

72
  private Object coresMin;
73

74
  /**
75
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/coresMin</I><BR>
76
   * <BLOCKQUOTE>
77
   * Minimum reserved number of CPU cores (default is 1).
78
   * 
79
   * May be a fractional value to indicate to a scheduling
80
   * algorithm that one core can be allocated to multiple
81
   * jobs. For example, a value of 0.25 indicates that up to 4
82
   * jobs may run in parallel on 1 core.  A value of 1.25 means
83
   * that up to 3 jobs can run on a 4 core system (4/1.25 ≈ 3).
84
   * 
85
   * Processes can only share a core allocation if the sum of each
86
   * of their `ramMax`, `tmpdirMax`, and `outdirMax` requests also
87
   * do not exceed the capacity of the node.
88
   * 
89
   * Processes sharing a core must have the same level of isolation
90
   * (typically a container or VM) that they would normally have.
91
   * 
92
   * The reported number of CPU cores reserved for the process,
93
   * which is available to expressions on the CommandLineTool as
94
   * `runtime.cores`, must be a non-zero integer, and may be
95
   * calculated by rounding up the cores request to the next whole
96
   * number.
97
   * 
98
   * Scheduling systems may allocate fractional CPU resources by
99
   * setting quotas or scheduling weights.  Scheduling systems that
100
   * do not support fractional CPUs may round up the request to the
101
   * next whole number.
102
   *    * </BLOCKQUOTE>
103
   */
104

105
  public Object getCoresMin() {
106
    return this.coresMin;
×
107
  }
108

109
  private Object coresMax;
110

111
  /**
112
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/coresMax</I><BR>
113
   * <BLOCKQUOTE>
114
   * Maximum reserved number of CPU cores.
115
   * 
116
   * See `coresMin` for discussion about fractional CPU requests.
117
   *    * </BLOCKQUOTE>
118
   */
119

120
  public Object getCoresMax() {
121
    return this.coresMax;
×
122
  }
123

124
  private Object ramMin;
125

126
  /**
127
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/ramMin</I><BR>
128
   * <BLOCKQUOTE>
129
   * Minimum reserved RAM in mebibytes (2**20) (default is 256)
130
   * 
131
   * May be a fractional value.  If so, the actual RAM request must
132
   * be rounded up to the next whole number.  The reported amount of
133
   * RAM reserved for the process, which is available to
134
   * expressions on the CommandLineTool as `runtime.ram`, must be a
135
   * non-zero integer.
136
   *    * </BLOCKQUOTE>
137
   */
138

139
  public Object getRamMin() {
140
    return this.ramMin;
×
141
  }
142

143
  private Object ramMax;
144

145
  /**
146
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/ramMax</I><BR>
147
   * <BLOCKQUOTE>
148
   * Maximum reserved RAM in mebibytes (2**20)
149
   * 
150
   * See `ramMin` for discussion about fractional RAM requests.
151
   *    * </BLOCKQUOTE>
152
   */
153

154
  public Object getRamMax() {
155
    return this.ramMax;
×
156
  }
157

158
  private Object tmpdirMin;
159

160
  /**
161
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/tmpdirMin</I><BR>
162
   * <BLOCKQUOTE>
163
   * Minimum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20) (default is 1024)
164
   * 
165
   * May be a fractional value.  If so, the actual storage request
166
   * must be rounded up to the next whole number.  The reported
167
   * amount of storage reserved for the process, which is available
168
   * to expressions on the CommandLineTool as `runtime.tmpdirSize`,
169
   * must be a non-zero integer.
170
   *    * </BLOCKQUOTE>
171
   */
172

173
  public Object getTmpdirMin() {
174
    return this.tmpdirMin;
×
175
  }
176

177
  private Object tmpdirMax;
178

179
  /**
180
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/tmpdirMax</I><BR>
181
   * <BLOCKQUOTE>
182
   * Maximum reserved filesystem based storage for the designated temporary directory, in mebibytes (2**20)
183
   * 
184
   * See `tmpdirMin` for discussion about fractional storage requests.
185
   *    * </BLOCKQUOTE>
186
   */
187

188
  public Object getTmpdirMax() {
189
    return this.tmpdirMax;
×
190
  }
191

192
  private Object outdirMin;
193

194
  /**
195
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/outdirMin</I><BR>
196
   * <BLOCKQUOTE>
197
   * Minimum reserved filesystem based storage for the designated output directory, in mebibytes (2**20) (default is 1024)
198
   * 
199
   * May be a fractional value.  If so, the actual storage request
200
   * must be rounded up to the next whole number.  The reported
201
   * amount of storage reserved for the process, which is available
202
   * to expressions on the CommandLineTool as `runtime.outdirSize`,
203
   * must be a non-zero integer.
204
   *    * </BLOCKQUOTE>
205
   */
206

207
  public Object getOutdirMin() {
208
    return this.outdirMin;
×
209
  }
210

211
  private Object outdirMax;
212

213
  /**
214
   * Getter for property <I>https://w3id.org/cwl/cwl#ResourceRequirement/outdirMax</I><BR>
215
   * <BLOCKQUOTE>
216
   * Maximum reserved filesystem based storage for the designated output directory, in mebibytes (2**20)
217
   * 
218
   * See `outdirMin` for discussion about fractional storage requests.
219
   *    * </BLOCKQUOTE>
220
   */
221

222
  public Object getOutdirMax() {
223
    return this.outdirMax;
×
224
  }
225

226
  /**
227
   * Used by {@link org.w3id.cwl.cwl1_2.utils.RootLoader} to construct instances of ResourceRequirementImpl.
228
   *
229
   * @param __doc_            Document fragment to load this record object from (presumably a
230
                              {@link java.util.Map}).
231
   * @param __baseUri_        Base URI to generate child document IDs against.
232
   * @param __loadingOptions  Context for loading URIs and populating objects.
233
   * @param __docRoot_        ID at this position in the document (if available) (maybe?)
234
   * @throws ValidationException If the document fragment is not a {@link java.util.Map}
235
   *                             or validation of fields fails.
236
   */
237
  public ResourceRequirementImpl(
238
      final Object __doc_,
239
      final String __baseUri_,
240
      LoadingOptions __loadingOptions,
241
      final String __docRoot_) {
242
    super(__doc_, __baseUri_, __loadingOptions, __docRoot_);
1✔
243
    // Prefix plumbing variables with '__' to reduce likelihood of collision with
244
    // generated names.
245
    String __baseUri = __baseUri_;
1✔
246
    String __docRoot = __docRoot_;
1✔
247
    if (!(__doc_ instanceof java.util.Map)) {
1✔
248
      throw new ValidationException("ResourceRequirementImpl called on non-map");
×
249
    }
250
    final java.util.Map<String, Object> __doc = (java.util.Map<String, Object>) __doc_;
1✔
251
    final java.util.List<ValidationException> __errors =
1✔
252
        new java.util.ArrayList<ValidationException>();
253
    if (__loadingOptions != null) {
1✔
254
      this.loadingOptions_ = __loadingOptions;
1✔
255
    }
256
    ResourceRequirement_class class_;
257
    try {
258
      class_ =
1✔
259
          LoaderInstances
260
              .uri_ResourceRequirement_class_False_True_None_None
261
              .loadField(__doc.get("class"), __baseUri, __loadingOptions);
1✔
262
    } catch (ValidationException e) {
1✔
263
      class_ = null; // won't be used but prevents compiler from complaining.
1✔
264
      final String __message = "the `class` field is not valid because:";
1✔
265
      __errors.add(new ValidationException(__message, e));
1✔
266
    }
1✔
267
    Object coresMin;
268

269
    if (__doc.containsKey("coresMin")) {
1✔
270
      try {
271
        coresMin =
1✔
272
            LoaderInstances
273
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
274
                .loadField(__doc.get("coresMin"), __baseUri, __loadingOptions);
1✔
275
      } catch (ValidationException e) {
×
276
        coresMin = null; // won't be used but prevents compiler from complaining.
×
277
        final String __message = "the `coresMin` field is not valid because:";
×
278
        __errors.add(new ValidationException(__message, e));
×
279
      }
1✔
280

281
    } else {
282
      coresMin = null;
1✔
283
    }
284
    Object coresMax;
285

286
    if (__doc.containsKey("coresMax")) {
1✔
287
      try {
288
        coresMax =
1✔
289
            LoaderInstances
290
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
291
                .loadField(__doc.get("coresMax"), __baseUri, __loadingOptions);
1✔
292
      } catch (ValidationException e) {
×
293
        coresMax = null; // won't be used but prevents compiler from complaining.
×
294
        final String __message = "the `coresMax` field is not valid because:";
×
295
        __errors.add(new ValidationException(__message, e));
×
296
      }
1✔
297

298
    } else {
299
      coresMax = null;
1✔
300
    }
301
    Object ramMin;
302

303
    if (__doc.containsKey("ramMin")) {
1✔
304
      try {
305
        ramMin =
1✔
306
            LoaderInstances
307
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
308
                .loadField(__doc.get("ramMin"), __baseUri, __loadingOptions);
1✔
309
      } catch (ValidationException e) {
×
310
        ramMin = null; // won't be used but prevents compiler from complaining.
×
311
        final String __message = "the `ramMin` field is not valid because:";
×
312
        __errors.add(new ValidationException(__message, e));
×
313
      }
1✔
314

315
    } else {
316
      ramMin = null;
1✔
317
    }
318
    Object ramMax;
319

320
    if (__doc.containsKey("ramMax")) {
1✔
321
      try {
322
        ramMax =
1✔
323
            LoaderInstances
324
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
325
                .loadField(__doc.get("ramMax"), __baseUri, __loadingOptions);
1✔
326
      } catch (ValidationException e) {
×
327
        ramMax = null; // won't be used but prevents compiler from complaining.
×
328
        final String __message = "the `ramMax` field is not valid because:";
×
329
        __errors.add(new ValidationException(__message, e));
×
330
      }
1✔
331

332
    } else {
333
      ramMax = null;
1✔
334
    }
335
    Object tmpdirMin;
336

337
    if (__doc.containsKey("tmpdirMin")) {
1✔
338
      try {
339
        tmpdirMin =
1✔
340
            LoaderInstances
341
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
342
                .loadField(__doc.get("tmpdirMin"), __baseUri, __loadingOptions);
1✔
343
      } catch (ValidationException e) {
×
344
        tmpdirMin = null; // won't be used but prevents compiler from complaining.
×
345
        final String __message = "the `tmpdirMin` field is not valid because:";
×
346
        __errors.add(new ValidationException(__message, e));
×
347
      }
1✔
348

349
    } else {
350
      tmpdirMin = null;
1✔
351
    }
352
    Object tmpdirMax;
353

354
    if (__doc.containsKey("tmpdirMax")) {
1✔
355
      try {
356
        tmpdirMax =
1✔
357
            LoaderInstances
358
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
359
                .loadField(__doc.get("tmpdirMax"), __baseUri, __loadingOptions);
1✔
360
      } catch (ValidationException e) {
×
361
        tmpdirMax = null; // won't be used but prevents compiler from complaining.
×
362
        final String __message = "the `tmpdirMax` field is not valid because:";
×
363
        __errors.add(new ValidationException(__message, e));
×
364
      }
1✔
365

366
    } else {
367
      tmpdirMax = null;
1✔
368
    }
369
    Object outdirMin;
370

371
    if (__doc.containsKey("outdirMin")) {
1✔
372
      try {
373
        outdirMin =
1✔
374
            LoaderInstances
375
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
376
                .loadField(__doc.get("outdirMin"), __baseUri, __loadingOptions);
1✔
377
      } catch (ValidationException e) {
×
378
        outdirMin = null; // won't be used but prevents compiler from complaining.
×
379
        final String __message = "the `outdirMin` field is not valid because:";
×
380
        __errors.add(new ValidationException(__message, e));
×
381
      }
1✔
382

383
    } else {
384
      outdirMin = null;
1✔
385
    }
386
    Object outdirMax;
387

388
    if (__doc.containsKey("outdirMax")) {
1✔
389
      try {
390
        outdirMax =
1✔
391
            LoaderInstances
392
                .union_of_NullInstance_or_IntegerInstance_or_LongInstance_or_DoubleInstance_or_ExpressionLoader
393
                .loadField(__doc.get("outdirMax"), __baseUri, __loadingOptions);
1✔
394
      } catch (ValidationException e) {
×
395
        outdirMax = null; // won't be used but prevents compiler from complaining.
×
396
        final String __message = "the `outdirMax` field is not valid because:";
×
397
        __errors.add(new ValidationException(__message, e));
×
398
      }
1✔
399

400
    } else {
401
      outdirMax = null;
1✔
402
    }
403
    if (!__errors.isEmpty()) {
1✔
404
      throw new ValidationException("Trying 'RecordField'", __errors);
1✔
405
    }
406
    this.class_ = (ResourceRequirement_class) class_;
1✔
407
    this.coresMin = (Object) coresMin;
1✔
408
    this.coresMax = (Object) coresMax;
1✔
409
    this.ramMin = (Object) ramMin;
1✔
410
    this.ramMax = (Object) ramMax;
1✔
411
    this.tmpdirMin = (Object) tmpdirMin;
1✔
412
    this.tmpdirMax = (Object) tmpdirMax;
1✔
413
    this.outdirMin = (Object) outdirMin;
1✔
414
    this.outdirMax = (Object) outdirMax;
1✔
415
  }
1✔
416
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc