Skip to content

Commit

Permalink
Improve container succeed check [ci fast]
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Oct 12, 2024
1 parent 8eb0c39 commit 9ed18a8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion plugins/nf-wave/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
api 'org.apache.commons:commons-lang3:3.12.0'
api 'com.google.code.gson:gson:2.10.1'
api 'org.yaml:snakeyaml:2.2'
api 'io.seqera:wave-api:0.13.2'
api 'io.seqera:wave-api:0.13.3'
api 'io.seqera:wave-utils:0.14.1'

testImplementation(testFixtures(project(":nextflow")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class SubmitContainerTokenRequest {
/**
* Whenever use container "mirror" mode
*/
public boolean mirror;
boolean mirror;

/**
* The request security scan mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ package io.seqera.wave.plugin
import groovy.transform.CompileStatic
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import io.seqera.wave.api.ContainerStatus

/**
* Model a response for an augmented container
*
Expand Down Expand Up @@ -78,8 +76,9 @@ class SubmitContainerTokenResponse {
String scanId

/**
* The status of the container for this request
* Whenever the container has been provisioned successfully or not. If false
* the current status needs the be check via container status API
*/
ContainerStatus status
Boolean succeeded

}
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ class WaveClient {
throw new IllegalStateException("Unable to find any container with key: $key")
final resp = handle.response
if( resp.requestId ) {
return resp.status != ContainerStatus.DONE
? checkContainerCompletion(handle)
: true
return resp.succeeded
? true
: checkContainerCompletion(handle)
}
if( resp.buildId && !resp.cached )
return checkBuildCompletion(handle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1310,14 +1310,14 @@ class WaveClientTest extends Specification {
def wave = Spy(new WaveClient(session:sess, cache: cache))
boolean ready

// container is READY
// container succeeded
when:
ready = wave.isContainerReady('xyz')
then:
cache.getIfPresent('xyz') >> handle
and:
resp.requestId >> '12345'
resp.status >> ContainerStatus.DONE
resp.succeeded >> true
and:
0 * wave.checkContainerCompletion(handle) >> null
0 * wave.checkBuildCompletion(_) >> null
Expand All @@ -1331,26 +1331,26 @@ class WaveClientTest extends Specification {
cache.getIfPresent('xyz') >> handle
and:
resp.requestId >> '12345'
resp.status >> ContainerStatus.PENDING
resp.succeeded >> null
and:
1 * wave.checkContainerCompletion(handle) >> false
1 * wave.checkContainerCompletion(handle) >> true
0 * wave.checkBuildCompletion(_) >> null
and:
!ready
ready

// container succeeded
// container failed
when:
ready = wave.isContainerReady('xyz')
then:
cache.getIfPresent('xyz') >> handle
and:
resp.requestId >> '12345'
resp.status >> ContainerStatus.PENDING
resp.succeeded >> false
and:
1 * wave.checkContainerCompletion(handle) >> true
1 * wave.checkContainerCompletion(handle) >> false
0 * wave.checkBuildCompletion(_) >> null
and:
ready
!ready


// build is READY
Expand Down

0 comments on commit 9ed18a8

Please sign in to comment.