Skip to content

Commit

Permalink
Passing exact memory to executors in GiB (#1696)
Browse files Browse the repository at this point in the history
Signed-off-by: alvaro.gonzalez <alvaro.gonzalez@csc.fi>
  • Loading branch information
lvarin authored Aug 5, 2020
1 parent cae1d18 commit c8a1554
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import nextflow.processor.TaskConfig
import nextflow.processor.TaskHandler
import nextflow.processor.TaskRun
import nextflow.processor.TaskStatus
import nextflow.util.MemoryUnit
/**
* Handle execution phases for a task executed by a TES executor
*
Expand Down Expand Up @@ -204,14 +205,18 @@ class TesTaskHandler extends TaskHandler {
private TesResources getResources(TaskConfig cfg) {
def res = new TesResources()
res.cpuCores(cfg.getCpus())
.ramGb(cfg.getMemory()?.toGiga()) // @TODO only works for >= 1.GB
.ramGb(toGiga(cfg.getMemory()))
.diskGb(cfg.getDisk()?.toGiga())
log.trace("[TES] Adding resource request: $res")
// @TODO preemptible
// @TODO zones
return res
}

private Double toGiga(MemoryUnit size) {
// 1073741824 = 1GB
return size != null ? ((double)size.bytes)/1073741824 : null
}

private TesInput inItem( Path realPath, String fileName = null) {
def result = new TesInput()
Expand Down

0 comments on commit c8a1554

Please sign in to comment.