<#722 fix: prevent double initialization logging i...
# flyte-github
a
#722 fix: prevent double initialization logging in CLI run command Pull request opened by pingsutw Summary •
initialize_config
was called in both `list_commands`/`get_command` (task discovery) and
invoke
(execution) in
TaskPerFileGroup
. Since these receive different Click context objects, the
lru_cache
missed on
invoke
, causing
init_from_config
to run twice — once with a plain
StreamHandler
and once with
RichHandler
— producing the same log lines in two different formats. • Remove the premature
initialize_config
calls from
TaskPerFileGroup.list_commands
and `get_command`; initialization now happens exactly once in
invoke
. • Pass
enable_rich=True
when the CLI sets up its logger in
main()
so the
RichHandler
is active from the start. • Add log to show the current root dir • Add default value to
hello.py
example so it can be run without arguments. Test plan Before: (flyte-sdk) (flyte-sdk) ➜ flyte-sdk git:(main) flyte -vvv run examples/basics/hello.py main --x_list "[1, 2, 3]" [flyte] No ./config.yaml found [flyte] Using config file discovered at location
/Users/kevin/git/flyte-sdk/.flyte/config.yaml
[flyte] Flyte config initialized as Config(platform=PlatformConfig(endpoint='dns:///dogfood.cloud-staging.union.ai', scopes=[]), task=TaskConfig(project='flytesnacks', domain='development'), image=ImageConfig(builder='remote', image_refs={}), source=PosixPath('.flyte/config.yaml')) 232746.146392 INFO _initialize.py:326 - Flyte config initialized as Config(platform=PlatformConfig(endpoint='dns:///dogfood.cloud-staging.union.ai', scopes=[]), task=TaskConfig(project='flytesnacks', domain='development'), image=ImageConfig(builder='remote', image_refs={}), source=PosixPath('.flyte/config.yaml')) > Launching remote execution... 232746.184885 DEBUG _run.py:126 - Effective run mode:
remote
, client configured:
True
After: (flyte-sdk) (flyte-sdk) ➜ flyte-sdk git:(main) ✗ flyte -vvv run examples/basics/hello.py main 232103.846958 DEBUG _reader.py:161 - No ./config.yaml found 232103.849722 DEBUG main.py:217 - Using config file discovered at location
/Users/kevin/git/flyte-sdk/.flyte/config.yaml
232103.875928 INFO _initialize.py:327 - Flyte config initialized as Config(platform=PlatformConfig(endpoint='dns:///dogfood.cloud-staging.union.ai', scopes=[]), task=TaskConfig(project='flytesnacks', domain='development'), image=ImageConfig(builder='remote', image_refs={}), source=PosixPath('.flyte/config.yaml')) 232104.001898 INFO _initialize.py:247 - Flyte root directory set to /Users/kevin/git/flyte-sdk > Launching remote execution... 232104.003213 DEBUG _run.py:126 - Effective run mode:
remote
, client configured:
True
flyteorg/flyte-sdk