Skip to content

Commit

Permalink
Fix submit command in error message for grid executors that pipe wrap…
Browse files Browse the repository at this point in the history
…per script (#3548)


Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
bentsherman and pditommaso committed Feb 3, 2023
1 parent 8278078 commit 40ebd30
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Expand Up @@ -185,7 +185,7 @@ class GridTaskHandler extends TaskHandler {
final exitStatus = process.waitFor()

if( exitStatus ) {
throw new ProcessNonZeroExitStatusException("Failed to submit process to grid scheduler for execution", result, exitStatus, builder.command())
throw new ProcessNonZeroExitStatusException("Failed to submit process to grid scheduler for execution", result, exitStatus, launchCmd0(builder,pipeScript))
}

// -- return the process stdout
Expand All @@ -199,6 +199,15 @@ class GridTaskHandler extends TaskHandler {
process.destroy()
}
}

protected List<String> launchCmd0(ProcessBuilder builder, String pipeScript) {
if( !pipeScript )
return builder.command()
final result = new ArrayList(builder.command())
result.add('<')
result.add(TaskRun.CMD_RUN)
return result
}

/*
* {@inheritDocs}
Expand Down
Expand Up @@ -67,4 +67,17 @@ class GridTaskHandlerTest extends Specification {
task.exitStatus == 10

}

def 'should create launch command' () {
given:
def builder = new ProcessBuilder().command(CMD)
def exec = Spy(GridTaskHandler)
expect:
exec.launchCmd0(builder, PIPE) == EXPECTED

where:
CMD | PIPE | EXPECTED
['qsub'] | null | ['qsub']
['qsub'] | 'xyz' | ['qsub', '<', '.command.run']
}
}

0 comments on commit 40ebd30

Please sign in to comment.