Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Confusing behaviour with default True boolean arguments when using pyflyte run #5768

Closed
2 tasks done
Tom-Newton opened this issue Sep 23, 2024 · 1 comment · Fixed by flyteorg/flytekit#2764
Closed
2 tasks done
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers

Comments

@Tom-Newton
Copy link
Contributor

Tom-Newton commented Sep 23, 2024

Describe the bug

Adding --paramater name on a deafault true boolean paramater causes the workflow to run with the value as False.

Example:

from flytekit import task, workflow


@task
def task0(test_bool: bool) -> bool:
    return test_bool


@workflow
def workflow0(test_bool: bool = True) -> bool:
    return task0(test_bool=test_bool)

The default works as expected:

$ pyflyte run workflow2.py workflow0
Running Execution on local.
True

Adding --test_bool causes unexpected behaviour where it uses False is used

$ pyflyte run workflow2.py workflow0 --test_bool
Running Execution on local.
False

Expected behavior

Based on https://click.palletsprojects.com/en/8.1.x/options/#boolean-flags I would expect

$ pyflyte run workflow2.py workflow0
Running Execution on local.
True
$ pyflyte run workflow2.py workflow0 --test_bool
Running Execution on local.
True
$ pyflyte run workflow2.py workflow0 --no_test_bool
Running Execution on local.
False

Additional context to reproduce

No response

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@Tom-Newton Tom-Newton added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Sep 23, 2024
@Tom-Newton
Copy link
Contributor Author

If we think this is sensible I made a PR which implements it flyteorg/flytekit#2764

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant