Skip to content

Make optional arguments not required in click option#3432

Open
Sovietaced wants to merge 1 commit into
flyteorg:masterfrom
Sovietaced:optional-args
Open

Make optional arguments not required in click option#3432
Sovietaced wants to merge 1 commit into
flyteorg:masterfrom
Sovietaced:optional-args

Conversation

@Sovietaced
Copy link
Copy Markdown
Member

@Sovietaced Sovietaced commented May 15, 2026

Why are the changes needed?

This pull request addresses a regression introduced in #3338

Running a remote-workflow used to involved retrieving an existing launch plan and crafting click options based on the launch plan defaults and the values provided on the CLI. When the code was changed to retrieve an existing workflow it does not include any possible default values from the launch plan so we update the code to introspect whether arguments are required or not based on the signature of the workflow.

How was this patch tested?

Tested in production as well as unit tests.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Jason Parraga <sovietaced@gmail.com>
@machichima
Copy link
Copy Markdown
Member

machichima commented May 15, 2026

I tested with following script, there's no error when using pyflyte run remote-workflow. Thank you!

image image
import os
from typing import Optional
from flytekit import task, workflow

@task()
def example_task(flag: bool, docker_tag: Optional[str] = None) -> bool:
    print(f"docker_tag: {docker_tag}")
    return flag

@workflow
def wf(
    flag: bool = True,
    docker_tag: Optional[str] = None,
) -> None:
    example_task(flag=flag, docker_tag=docker_tag)


if __name__ == "__main__":
    from flytekit.clis.sdk_in_container import pyflyte
    from click.testing import CliRunner

    runner = CliRunner()
    path = os.path.realpath(__file__)
    result = runner.invoke(pyflyte.main, ["run", "--remote", path, "wf"])
    print("Remote Execution: ", result.output)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants