volcano icon indicating copy to clipboard operation
volcano copied to clipboard

bugfix and code refactor around klog

Open SataQiu opened this issue 9 months ago • 3 comments

  1. use cli.Run for cli commands, cli.Run has already integrated support for --log-flush-frequency. As a result, the code is simplified without having to deal with more details about klog. Also, fix the following bugs:
  • fix the bug that --log-flush-frequency does not take effect for cli commands (Parse() is not called, so it is always the default value 5s) . And,klog has already reduced the default value from 30s to 5s https://github.com/kubernetes/klog/pull/40
  • fix the bug that -v flag is not available for cli commands

Before:

$ ./_output/bin/vcctl -h
Usage:
  vcctl [command]

Available Commands:
  help        Help about any command
  job         vcctl command line operation job
  queue       Queue Operations
  version     Print the version information

Flags:
  -h, --help                           help for vcctl
      --log-flush-frequency duration   Maximum number of seconds between log flushes (default 5s)

Use "vcctl [command] --help" for more information about a command.

After:

After:
$  ./_output/bin/vcctl -h
Usage:
  vcctl [command]

Available Commands:
  help        Help about any command
  job         vcctl command line operation job
  queue       Queue Operations
  version     Print the version information

Flags:
  -h, --help                           help for vcctl
      --log-flush-frequency duration   Maximum number of seconds between log flushes (default 5s)
  -v, --v Level                        number for the log level verbosity
      --vmodule moduleSpec             comma-separated list of pattern=N settings for file-filtered logging (only works for the default text log format)

Use "vcctl [command] --help" for more information about a command.
  1. use klog.StartFlushDaemon to config --log-flush-frequency instead of starting a new goroutine for controller commands

SataQiu avatar May 08 '24 04:05 SataQiu