skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

skaffold dev log tailing problem: doesn't output to terminal in real time

Open manocormen opened this issue 4 years ago • 1 comments

Expected behavior

Logs are streamed to the terminal line by line in real time.

Actual behavior.

Logs are are streamed to the terminal all at once every ~4 minutes.

Information

  • Skaffold version: v1.35.0
  • Operating system: macOS Big Sur 11.6 and Linux Ubuntu 20.04 (identical problem on both)
  • Installed via: skaffold.dev
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta26
kind: Config
metadata:
  name: hello-app
build:
  artifacts:
  - image: hello
    docker:
      dockerfile: Dockerfile
deploy:
  kubectl:
    manifests:
    - k8s.yaml

Steps to reproduce the behavior

  1. Clone: https://github.com/manocormen/hello-app
  2. Install skaffold, kubectl, and minikube, and run minikube start.
  3. Run skaffold dev

More details

Stack Overflow --- skaffold dev: no output to terminal (or delayed output)

manocormen avatar Dec 05 '21 12:12 manocormen

The problem wasn't with Skaffold nor Minikube. Python was buffering the output, and only writing it to stdout once the buffer was full. There are a number of ways to avoid this, including using the -u flag or flush parameter.

manocormen avatar Dec 05 '21 20:12 manocormen