Skip to content

Commit cd044ff

Browse files
committed
feat: Add fusion field to DiskResource
Add optional Boolean fusion field to DiskResource to allow per-task control of Fusion filesystem usage. Changes: - Add fusion field to DiskResource class - Update constructor to accept fusion parameter from disk directive - Make request field optional (can be null) for fusion-only usage - Update withRequest() to preserve fusion setting - Update toString() via @tostring to include fusion field This enables syntax like: disk fusion: false disk request: '100 GB', fusion: true Signed-off-by: Edmund Miller <[email protected]>
1 parent 4dc9945 commit cd044ff

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

modules/nextflow/src/main/groovy/nextflow/executor/res/DiskResource.groovy

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import nextflow.util.MemoryUnit
2323

2424
/**
2525
* Models disk resource request
26-
*
26+
*
2727
* @author Ben Sherman <[email protected]>
2828
*/
2929
@ToString(includeNames = true, includePackage = false)
@@ -33,30 +33,34 @@ class DiskResource {
3333

3434
final MemoryUnit request
3535
final String type
36+
final Boolean fusion
3637

37-
DiskResource( value ) {
38+
DiskResource(value) {
3839
this(request: value)
3940
}
4041

41-
DiskResource( Map opts ) {
42-
this.request = toMemoryUnit(opts.request)
42+
DiskResource(Map opts) {
43+
this.request = opts.request != null ? toMemoryUnit(opts.request) : null
4344

44-
if( opts.type )
45+
if (opts.type)
4546
this.type = opts.type as String
47+
48+
if (opts.fusion != null)
49+
this.fusion = opts.fusion as Boolean
4650
}
4751

4852
DiskResource withRequest(MemoryUnit value) {
49-
return new DiskResource(request: value, type: this.type)
53+
return new DiskResource(request: value, type: this.type, fusion: this.fusion)
5054
}
5155

52-
private static MemoryUnit toMemoryUnit( value ) {
53-
if( value instanceof MemoryUnit )
54-
return (MemoryUnit)value
56+
private static MemoryUnit toMemoryUnit(value) {
57+
if (value instanceof MemoryUnit)
58+
return (MemoryUnit) value
5559

5660
try {
5761
return new MemoryUnit(value.toString().trim())
5862
}
59-
catch( Exception e ) {
63+
catch (Exception e) {
6064
throw new IllegalArgumentException("Not a valid disk value: $value")
6165
}
6266
}

0 commit comments

Comments
 (0)