Skip to content

Commit

Permalink
Add warning on Google Logs failure [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 Dec 3, 2022
1 parent b397506 commit bdbcdde
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,21 @@ class BatchLogging {
}

String stdout(String jobId) {
return fetchLogs(jobId)[0]
return safeLogs(jobId,0)
}

String stderr(String jobId) {
return fetchLogs(jobId)[1]
return safeLogs(jobId,1)
}

protected String safeLogs(String jobId, int index) {
try {
return fetchLogs(jobId)[index]
}
catch (Exception e) {
log.warn("Cannot read logs for Batch job '$jobId' - cause: ${e.message}", e)
return null
}
}

@Memoized(maxCacheSize = 1000)
Expand All @@ -70,8 +80,6 @@ class BatchLogging {
for (LogEntry logEntry : page.iterator()) {
parseOutput(logEntry, stdout, stderr)
}
} catch (Exception e) {
log.debug "[GOOGLE BATCH] Cannot read logs for job: `$uid` | ${e.message}"
}
return [ stdout.toString(), stderr.toString() ]
}
Expand All @@ -84,4 +92,4 @@ class BatchLogging {
stdout.append(output)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import groovy.util.logging.Slf4j
import nextflow.Session
import nextflow.cloud.google.batch.client.BatchClient
import nextflow.cloud.google.batch.client.BatchConfig
import nextflow.cloud.google.batch.logging.BatchLogging
import spock.lang.IgnoreIf
import spock.lang.Requires
import spock.lang.Specification
Expand Down

0 comments on commit bdbcdde

Please sign in to comment.