question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parse pipeline argument string 'None' to None

See original GitHub issue

When definining a kfp pipeline, with an str argument, if the value is ‘None’, then the component recieve ‘None’. Wouldn’t be better, to parse str ‘None’ to None (NoneType)?

Now:

@component
def task1(arg1: str = None):
  if arg1 is None or arg1 == 'None':
    print('arg1 is None')
@pipeline
  pipeline(arg1: str = 'None'):
  task1(arg1)

expected:

@component
def task1(arg1: str = None):
  if arg1 is None:
    print('arg1 is None')
@pipeline
  pipeline(arg1: str = 'None'):
  task1(arg1)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
chensuncommented, Jan 12, 2022

the parsing from ‘None’ to None, should be done (only) inside the py component?

No, I don’t think we should ever convert 'None' to None. It could be a legit user intention that they may want to pass 'None' and consume it as string. We don’t want to be “oversmart”.

Or not parsing at all, and that py component should recieve ‘None’ and be treated by the user inside the function? (option a)

Yes, users can choose whatever they want, 'None', 'null', 'NoValue', etc. The system doesn’t need to be aware of the user-chosen contract.

0reactions
stale[bot]commented, Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pythonic way to convert the string "None" to a proper None
In short I'm reading data from a URL and need to convert the parameters with the value None to an actual NoneType. I'm...
Read more >
Use runtime and type-safe parameters - Azure Pipelines
Parameters have data types such as number and string, and they can be ... The trigger is set to none so that you...
Read more >
Pipelines — transformers 3.0.2 documentation - Hugging Face
args_parser ( ArgumentHandler , optional , defaults to None ) – Reference to the object in charge of parsing supplied pipeline parameters.
Read more >
Pipelines — sagemaker 2.124.0 documentation
ParameterString (name, default_value=None, enum_values=None)¶. String parameter for pipelines. Create a pipeline string parameter. Parameters.
Read more >
Process - Robot Framework
Possible non-string arguments are converted to strings automatically. Process configuration. Run Process and Start Process keywords can be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found