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
DM-27667: Add pipetask option to execute graph subset #103
Conversation
0be18b6
to
8858a70
Compare
from lsst.daf.butler.core.utils import iterable | ||
|
||
|
||
def _split_commas_int(context, param, values): |
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.
Why has this been copied from daf_butler? Don't we have the ability to use the daf_butler callback? If it's simply the integers part shouldn't we implement it on top of the normal splitter with a parameter?
cc/ @n8pease
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.
It's not an exact copy, daf_butler's one splits things into strings, this one makes integers instead. But I should have probably called split_commas
from this method instead of re-implementing its logic.
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.
Re-reading the question again - I guess we could update split_commas
to do type conversion, but my general problem is that click
callbacks do not seem to be a good match for that problem. AFAIK callbacks happen after type conversion is already applied to argument, and in our case of comma-separated lists it cannot even work. What I mean is that if you declare an option to have type int
then you cannot pass comma-separated string to it because it will try to convert that string to int
and will fail. My current solution is not to declare type of an option (essentially making it str
) but cheat in the callback and return integers from that. I don't know if this is even allowed, docs don't say if this is acceptable, so there is no guarantee that it will not break.
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.
Just for record - I reimplemented my _split_commas_int
on top of split_commas
, for better unification of the latter we may need some thinking, so I want to keep _split_commas_int
here for now.
7aaaa23
to
2971b8e
Compare
de477bd
to
1c99b9a
Compare
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.
Tested the changes and they worked as expected. Only 1 very minor question about a docstring. Ready to merge.
@@ -42,6 +42,12 @@ def qgraph(pipelineObj, qgraph, skip_existing, save_qgraph, save_single_quanta, | |||
qgraph : `str` or `None` | |||
URI location for a serialized quantum graph definition as a pickle | |||
file. If this option is not None then `pipeline` should be `None`. | |||
qgraph_id : `str` or `None` | |||
Quantum graph identifier, graph loaded from a pickle file is required | |||
to have this identifier. Ignored if graph is not loaded from a 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.
Did you want to change the wording here to match the updated help wording?
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.
OK, will do.
New option `--qgraph-node-id` is added which takes a bunch of integers for node numbers to execute from a full graph. Another new option `--qgraph-id` can be used to specify graph ID to verify it after loading from pickle file.
1c99b9a
to
b2fc808
Compare
New option
--qgraph-node-id
is added which takes a bunch of integersfor node numbers to execute from a full graph. Another new option
--qgraph-id
can be used to specify graph ID to verify it after loadingfrom pickle file.