-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add account config option for grid executors (#4975)
Signed-off-by: Paolo Di Tommaso <[email protected]> Signed-off-by: Dr Marco Claudio De La Pierre <[email protected]> Co-authored-by: Dr Marco Claudio De La Pierre <[email protected]>
- Loading branch information
1 parent
a614fbe
commit a09e37d
Showing
9 changed files
with
163 additions
and
7 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
*/ | ||
|
||
package nextflow.executor | ||
|
||
import java.nio.file.Paths | ||
|
||
import nextflow.Session | ||
|
@@ -23,7 +24,6 @@ import nextflow.processor.TaskProcessor | |
import nextflow.processor.TaskRun | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
/** | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
|
@@ -82,6 +82,7 @@ class SlurmExecutorTest extends Specification { | |
setup: | ||
// SLURM executor | ||
def executor = [:] as SlurmExecutor | ||
executor.session = Mock(Session) | ||
|
||
// mock process | ||
def proc = Mock(TaskProcessor) | ||
|
@@ -210,6 +211,7 @@ class SlurmExecutorTest extends Specification { | |
setup: | ||
// LSF executor | ||
def executor = Spy(SlurmExecutor) | ||
executor.session = Mock(Session) | ||
|
||
// mock process | ||
def proc = Mock(TaskProcessor) | ||
|
@@ -275,4 +277,30 @@ class SlurmExecutorTest extends Specification { | |
exec.queueStatusCommand('xxx') == ['squeue','--noheader','-o','%i %t','-t','all','-p','xxx','-u', usr] | ||
|
||
} | ||
|
||
@Unroll | ||
def 'should set slurm account' () { | ||
given: | ||
// task | ||
def task = new TaskRun() | ||
task.workDir = Paths.get('/work/dir') | ||
task.processor = Mock(TaskProcessor) | ||
task.processor.getSession() >> Mock(Session) | ||
task.config = Mock(TaskConfig) | ||
and: | ||
def executor = Spy(SlurmExecutor) | ||
executor.getJobNameFor(_) >> 'foo' | ||
executor.getName() >> 'slurm' | ||
executor.getSession() >> Mock(Session) { getExecConfigProp('slurm', 'account',null)>>ACCOUNT } | ||
|
||
when: | ||
def result = executor.getDirectives(task, []) | ||
then: | ||
result == EXPECTED | ||
|
||
where: | ||
ACCOUNT | EXPECTED | ||
null | ['-J', 'foo', '-o', '/work/dir/.command.log', '--no-requeue', '', '--signal', 'B:USR2@30'] | ||
'project-123' | ['-J', 'foo', '-o', '/work/dir/.command.log', '--no-requeue', '', '--signal', 'B:USR2@30', '-A', 'project-123'] | ||
} | ||
} |