Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ abstract class TaskHandler {
record.env = task.getEnvironmentStr()
record.executorName = task.processor.executor.getName()
record.containerMeta = task.containerMeta()
record.accelerator = task.config.getAccelerator()?.request
record.accelerator_type = task.config.getAccelerator()?.type

if( isCompleted() ) {
record.error_action = task.errorAction?.toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ class TraceRecord implements Serializable {
vol_ctxt: 'num', // -- /proc/$pid/status field 'voluntary_ctxt_switches'
inv_ctxt: 'num', // -- /proc/$pid/status field 'nonvoluntary_ctxt_switches'
hostname: 'str',
cpu_model: 'str'
cpu_model: 'str',
accelerator: 'num',
accelerator_type: 'str'
]

static public Map<String,Closure<String>> FORMATTER = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class TaskHandlerTest extends Specification {
cpus: 2,
time: '1 hour',
disk: '100 GB',
memory: '4 GB'
memory: '4 GB',
accelerator: [request: 3, type: 'v100']
]
def task = new TaskRun(id: new TaskId(100), workDir: folder, name:'task1', exitStatus: 127, config: config )
task.metaClass.getHashLog = { "5d5d7ds" }
Expand Down Expand Up @@ -100,6 +101,8 @@ class TaskHandlerTest extends Specification {
trace.memory == MemoryUnit.of('4 GB').toBytes()
trace.disk == MemoryUnit.of('100 GB').toBytes()
trace.env == 'FOO=hola\nBAR=mundo\nAWS_SECRET=[secure]\n'
trace.accelerator == 3
trace.accelerator_type == 'v100'

// check get method
trace.getFmtStr('%cpu') == '1.0%'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ class TraceRecordTest extends Specification {
record.cpus = 4
record.time = 3_600_000L
record.memory = 1024L * 1024L * 1024L * 8L
record.accelerator = 3
record.accelerator_type = 'v100'

when:
def json = new JsonSlurper().parseText(record.renderJson().toString())
Expand All @@ -261,6 +263,8 @@ class TraceRecordTest extends Specification {
json.cpus == '4'
json.time == '1h'
json.memory == '8 GB'
json.accelerator == '3'
json.accelerator_type == 'v100'

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,31 @@ class TowerClientTest extends Specification {
req.tasks[0].numSpotInterruptions == 3
}

def 'should include accelerator request in task map'() {
given:
def client = Spy(new TowerClient())
client.getWorkflowProgress(true) >> new WorkflowProgress()

def now = System.currentTimeMillis()
def trace = new TraceRecord([
taskId: 42,
process: 'foo',
workdir: "/work/dir",
cpus: 1,
submit: now-2000,
start: now-1000,
complete: now,
accelerator: 2,
acceleratorType: 'v100'
])

when:
def req = client.makeTasksReq([trace])

then:
req.tasks.size() == 1
req.tasks[0].accelerator == 2
req.tasks[0].acceleratorType == 'v100'
}

}