Conversation
src/main/groovy/io/seqera/wave/service/builder/DockerBuildStrategy.groovy
Outdated
Show resolved
Hide resolved
…gs' into 451-enable-streaming-of-build-logs
|
@pditommaso is this required or should it refresh automatically? wavebuildpodlogs1.mov |
|
If only build box content is refreshed while the status is PENDING, it would be cool |
I will give it a try |
|
@pditommaso build logs with refresh now refreshwavebuildlogs.mov |
src/main/groovy/io/seqera/wave/service/builder/BuildStrategy.groovy
Outdated
Show resolved
Hide resolved
| try { | ||
| return k8sClient.coreV1Api().readNamespacedPodLog(name, namespace, null, null, null, null, null, null, null, null, null) | ||
| } catch (Exception e) { | ||
| // logging trace here because errors are expected when the pod is not running | ||
| log.trace "Unable to fetch logs for pod: $name", e | ||
| return null | ||
| } | ||
| } |
There was a problem hiding this comment.
It should be considered to use a streaming approach, see
There was a problem hiding this comment.
I did tried it, but streamNamespacedPodLog() waits till the pod execution is completed. I will dig more
There was a problem hiding this comment.
It happens because podlogs set the follow true and under the hood use readNamespacedPodLog
There was a problem hiding this comment.
I will move the logic to convert string to inputstream to this function so that getLogs return input stream
There was a problem hiding this comment.
I don't know if this is a limitation of java client or a bug, but I'm quite sure it's possible to stream the logs of a running pod.
I've made a simple test running a pod like this
kubectl run counter --image=busybox --command -- /bin/sh -c 'n=0; while true; do echo $((n++)); sleep 1;
Then I've used the K8s client implemented in Nextflow, that's a bare simple http request over URLConnection.
This snippet just stream the pod logs until the pod completes
def 'should get pod log' () {
given:
def settings = ['context': 'docker-desktop', name: 'default']
def config = new K8sConfig(settings)
def client = new K8sClient( config.getClient() )
when:
def logs = client.podLog([follow:'true'], 'counter')
then:
logs.text == 'hello\n'
}
|
@pditommaso its ready for review |
…gs' into 451-enable-streaming-of-build-logs
|
I have moved the docs changes to #464 |
|
Suggestion from @ewels |
|
Please keep colour outside of this PR. We need fist makes the logs stream to work |
I will create another issue |
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
|
merged get messed up, moving to draft |
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
Signed-off-by: munishchouhan <hrma017@gmail.com>
This PR will enalbe log streaming to get build log endpoint, while build is in process