-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jorge Aguilera <[email protected]>
- Loading branch information
Showing
12 changed files
with
459 additions
and
6 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
plugins/nf-nomad/src/main/nextflow/nomad/config/ConstraintNodeSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package nextflow.nomad.config | ||
|
||
class ConstraintNodeSpec { | ||
|
||
private String id = null | ||
private String name = null | ||
private String clientClass = null | ||
private String pool = null | ||
private String dataCenter = null | ||
private String region = null | ||
|
||
String getId() { | ||
return id | ||
} | ||
|
||
String getName() { | ||
return name | ||
} | ||
|
||
String getClientClass() { | ||
return clientClass | ||
} | ||
|
||
String getPool() { | ||
return pool | ||
} | ||
|
||
String getDataCenter() { | ||
return dataCenter | ||
} | ||
|
||
String getRegion() { | ||
return region | ||
} | ||
|
||
ConstraintNodeSpec setUnique(Map map){ | ||
unique(map) | ||
} | ||
|
||
ConstraintNodeSpec unique(Map map){ | ||
this.id = map.containsKey("id") ? map["id"].toString() : null | ||
this.name = map.containsKey("name") ? map["name"].toString() : null | ||
this | ||
} | ||
|
||
ConstraintNodeSpec setClientClass(Object map){ | ||
clientClass(map) | ||
} | ||
|
||
ConstraintNodeSpec clientClass(Object clientClass){ | ||
this.clientClass = clientClass.toString() | ||
this | ||
} | ||
|
||
ConstraintNodeSpec setPool(Object map){ | ||
pool(map) | ||
} | ||
|
||
ConstraintNodeSpec pool(Object pool){ | ||
this.pool = pool.toString() | ||
this | ||
} | ||
|
||
ConstraintNodeSpec setDataCenter(Object map){ | ||
dataCenter(map) | ||
} | ||
|
||
ConstraintNodeSpec dataCenter(Object dataCenter){ | ||
this.dataCenter = dataCenter.toString() | ||
this | ||
} | ||
|
||
ConstraintNodeSpec setRegion(Object map){ | ||
region(map) | ||
} | ||
|
||
ConstraintNodeSpec region(Object region){ | ||
this.region = region.toString() | ||
this | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
plugins/nf-nomad/src/main/nextflow/nomad/config/ConstraintsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package nextflow.nomad.config | ||
|
||
class ConstraintsSpec { | ||
|
||
List<ConstraintNodeSpec> nodeSpecs = [] | ||
|
||
ConstraintsSpec node( @DelegatesTo(ConstraintNodeSpec)Closure closure){ | ||
ConstraintNodeSpec constraintNodeSpec = new ConstraintNodeSpec() | ||
def clone = closure.rehydrate(constraintNodeSpec, closure.owner, closure.thisObject) | ||
clone.resolveStrategy = Closure.DELEGATE_FIRST | ||
clone() | ||
nodeSpecs << constraintNodeSpec | ||
this | ||
} | ||
|
||
void validate(){ | ||
|
||
} | ||
|
||
static ConstraintsSpec parse(@DelegatesTo(ConstraintsSpec)Closure closure){ | ||
ConstraintsSpec constraintsSpec = new ConstraintsSpec() | ||
def clone = closure.rehydrate(constraintsSpec, closure.owner, closure.thisObject) | ||
clone.resolveStrategy = Closure.DELEGATE_FIRST | ||
clone() | ||
constraintsSpec.validate() | ||
constraintsSpec | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.