-
Notifications
You must be signed in to change notification settings - Fork 689
Solve queueSize exceeded when using job arrays #6047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jorgee
wants to merge
6
commits into
master
Choose a base branch
from
5920-job-array-with-queuesize-exceeds-queuesize
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2310443
first fix
jorgee 25a6bb3
Add warning when array size is larger than queueSize
jorgee e3528c0
cleanup
bentsherman 42d6a8b
Update unit tests
bentsherman b42a641
Merge branch 'master' into 5920-job-array-with-queuesize-exceeds-queu…
bentsherman a944cc8
Fix failing test
bentsherman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -16,11 +16,14 @@ | |
|
||
package nextflow.processor | ||
|
||
import java.util.concurrent.atomic.LongAdder | ||
|
||
import nextflow.Session | ||
import nextflow.util.Duration | ||
import nextflow.util.RateUnit | ||
import nextflow.util.ThrottlingExecutor | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
/** | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
|
@@ -148,4 +151,59 @@ class TaskPollingMonitorTest extends Specification { | |
3 * session.notifyTaskSubmit(handler) | ||
} | ||
|
||
@Unroll | ||
def 'should check whether job can be submitted' () { | ||
given: | ||
def session = Mock(Session) | ||
def monitor = Spy(new TaskPollingMonitor(name: 'foo', session: session, capacity: CAPACITY, pollInterval: Duration.of('1min'))) | ||
and: | ||
def processor = Mock(TaskProcessor) { | ||
getForksCount() >> new LongAdder() | ||
getMaxForks() >> FORKS | ||
} | ||
def handler = Spy(TaskHandler) | ||
handler.task = Mock(TaskRun) { | ||
getProcessor() >> processor | ||
} | ||
def arrayHandler = Spy(TaskHandler) { | ||
isReady() >> true | ||
} | ||
arrayHandler.task = Mock(TaskArrayRun) { | ||
getArraySize() >> ARRAY | ||
getProcessor() >> processor | ||
} | ||
|
||
and: | ||
SUBMIT.times { monitor.runningQueue.add(handler) } | ||
|
||
expect: | ||
monitor.runningQueue.size() == SUBMIT | ||
monitor.canSubmit(arrayHandler) == EXPECTED | ||
where: | ||
CAPACITY | SUBMIT | FORKS | ARRAY | EXPECTED | ||
0 | 0 | 0 | 2 | true | ||
0 | 0 | 1 | 2 | false | ||
10 | 5 | 0 | 5 | true | ||
10 | 8 | 0 | 5 | false | ||
10 | 0 | 1 | 5 | false | ||
} | ||
|
||
def 'should throw error if job array size exceeds queue size' () { | ||
given: | ||
def session = Mock(Session) | ||
def monitor = Spy(new TaskPollingMonitor(name: 'foo', session: session, capacity: 2, pollInterval: Duration.of('1min'))) | ||
and: | ||
def arrayHandler = Spy(TaskHandler) | ||
arrayHandler.task = Mock(TaskArrayRun) { | ||
getName() >> 'bar' | ||
getArraySize() >> 4 | ||
} | ||
|
||
when: | ||
monitor.canSubmit(arrayHandler) | ||
then: | ||
def e = thrown(IllegalArgumentException) | ||
e.message == 'Job array bar exceeds the queue size (array size: 4, queue size: 2)' | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be
task.processor.forksCount * getForksCount()
, I mean multiplied?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would it be multiplied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I was totally confused by the
getForksCount
naming. This new attribute should be named differently because it overlaps withprocessor.forksCount
that has a complete different meaning. Something likegetRunsCount
andgetArraySize
would be much betterThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are they different in meaning?