Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add plural flags --nodes, --tags, and --load-versions to
kedro run
#2301Add plural flags --nodes, --tags, and --load-versions to
kedro run
#2301Changes from 14 commits
b59ec24
452f4e6
e400ea8
e157502
68568bc
c48fa1c
3cc615c
73ff831
0b8195f
156530c
958baa7
7afac7b
99f74f7
b45f9e7
65fe683
bd6b097
9e2bc78
414b183
5b79585
78be95a
0156e93
897558c
94d4c3c
cbcfef6
f146a21
917841d
c7a43b7
dd83248
f3ee8f0
40c14d1
f4c2200
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This is named this way for differentiation from the already existing
node_names
- in #2245 I'd suggest keepingnode_names
as the parameter nameThere 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.
Fine to keep
node_names
for now in #2245 but as part of #2247 I think we should consider just calling thisnodes
. (Just while I remember, Ivan's argument for why we might not want to do this: it's deliberately written asnode_names
to deter people from trying to pass node objects themselves to the underlyingsession.run
. My argument for it is consistency and simplicity, particularly when we eventually return to #1423)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.
Minor, but do we need these
if/else
clauses? Since_get_values_as_tuple("") == tuple("") == tuple()
already?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.
Good catch - was following convention from the earlier implementation but looks like they weren't needed there either. My suspicion is that
multiple=True
implies a default value of an empty tuple 🤔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.
I was unable to find any documentation on the matter but manual testing does expose that values on options where
multiple=True
will be tuples if the default is unspecified, even when a value is not provided. I'll remove the unnecessaryif
s.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.
Cool, that's what I suspected about
multiple=True
👍 Just to double check though, it's ok to remove theif/else
for both themultiple=True
and themultiple=False
versions of these arguments?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.
Yep! For the other flags their input is immediately handled by the callback function which goes on to return a list, and it's this list that get's passed to
_get_values_as_tuple
, which splits them safelyThere 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 we need the
[value]
here rather thanvalue
? Elsewhere we call_get_values_as_tuple
just with a single string. (Edit: is that true? Maybe it gets tuple-ified due tomultiple=True
? But then that wouldn't make sense for the instances you've added 🤔 )Also do we need the
if/else
here? Wouldn't_reformat_load_versions
work the same just passing the emptyvalue
into it directly?After we've removed the old
load_version
we should definitely just move_reformat_load_versions
code into this instead of having two separate functions.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.
@AntonyMilneQB
Without wrapping
value
in a list_get_values_as_tuples
will treat each character in the string as a value. The function is never called on a single string asmultiple=True
tuplifies the values of--node
and--tag
, and the callback functions for--nodes
and--tags
both return lists.The
if/else
isn't needed as_reformat_load_versions
would still work - the idea was to prevent calling another method if unnecessary. Which approach would be considered more pythonic?Agreed
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.
Overall I think without the
if/else
. The performance overhead of calling another function here is very small compared to the (also small) additional complexity of branching in the code. It's a small thing, but I'd only skip calling the function here if it was particularly expensive.