Refactor Google Batch getExitCode to imperative style#6649
Merged
pditommaso merged 3 commits intomasterfrom Dec 12, 2025
Merged
Refactor Google Batch getExitCode to imperative style#6649pditommaso merged 3 commits intomasterfrom
pditommaso merged 3 commits intomasterfrom
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
- Change getExitCode visibility from private to protected for testability - Replace functional stream-based implementation with imperative for-loop to fix IntelliJ syntax errors with lambda expressions in Groovy - Add StatusEvent import to support the refactored code - Add comprehensive unit test using Spock data-driven where clause covering 8 scenarios including null status, empty events, single/multiple events, out-of-order timestamps, and mixed events - Add detailed comments explaining the logic flow Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
707d226 to
faf54a5
Compare
Member
Author
|
This was rewritten because intellij was reporting (false positive) compilation errors, still annoying tho. |
Member
|
Do the errors prevent you from building? |
Member
Author
|
obviously no, tests were passing |
Member
|
I wonder if the errors go away by replacing the lambdas with closures. Even though it's not desirable, I think Groovy is compiling lambdas the same way as closures anyway, so you might as well use the closure if it removes the error |
Member
Author
|
Likely yes, however it's not worth spending more time on this (and i also find a bit more readable the imperative approach) |
jorgee
reviewed
Dec 12, 2025
plugins/nf-google/src/main/nextflow/cloud/google/batch/GoogleBatchTaskHandler.groovy
Outdated
Show resolved
Hide resolved
…atchTaskHandler.groovy [ci fast] Co-authored-by: Jorge Ejarque <jorgee@users.noreply.github.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
getExitCode()method inGoogleBatchTaskHandlerfrom functional stream-based style to imperative for-loop to fix IntelliJ syntax errors with lambda expressions in GroovyStatusEventimport to support the refactored codewhereclause covering 8 scenariosChanges
GoogleBatchTaskHandler.groovy
GoogleBatchTaskHandlerTest.groovy
makeStatusEventWithTime()andmakeTaskStatusWithEvents()should get exit code from latest task execution eventwith 8 test cases:Test plan
./gradlew :plugins:nf-google:test --tests GoogleBatchTaskHandlerTest🤖 Generated with Claude Code