-
Notifications
You must be signed in to change notification settings - Fork 297
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
Adds support for YAML file to pyflyte run #2583
Conversation
Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>
Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>
new_args = [] | ||
for k, v in inputs.items(): | ||
if isinstance(v, str): | ||
v = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha ya
try: | ||
inputs = json.load(f) | ||
except json.JSONDecodeError as e: | ||
click.secho( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets raise an exception here - maybe of type click.BadParameterException ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean changing the secho
lines (line 797 - 803) to something like this?
raise click.BadParameter(
message=f"Could not load the inputs file. Please make sure it is a valid JSON or YAML file."
f"\n json error: {e},"
f"\n yaml error: {yaml_e}",
param_hint="--flyte-inputs-file",
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Couple small nits, then lets ship it. Also can you please add some unit tests? cc @mao3267. I want to get this commit in quickly. Adding unit tests, especially the example I have and maybe another nested JSON example will help |
def __init__(self, name: str, params: typing.List[click.Option], help: str, callback: typing.Callable = None): | ||
params.append( | ||
click.Option( | ||
["--flyte-inputs-file"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, we are already running pyflyte run ...
. Can the option be called --inputs-file
?
Some unit tests are added in #2552 . Does the |
…teorg#2583) Signed-off-by: mao3267 <chenvincent610@gmail.com>
…teorg#2583) Signed-off-by: mao3267 <chenvincent610@gmail.com>
Tracking issue
flyteorg/flyte#5365
Why are the changes needed?
To pass a yaml | json file
What changes were proposed in this pull request?
You can now pass all inputs as yaml optionally using the flag
--flyte-inputs-file
. It can also be a jsonAlso it is possible to override certain parameters in the input file using additional args, like so
For the interface
The yaml file
t.yaml
is like thisTODO: