Skip to content
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

Merged
merged 2 commits into from Dec 7, 2020

Conversation

andy-slac
Copy link
Collaborator

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.

from lsst.daf.butler.core.utils import iterable


def _split_commas_int(context, param, values):
Copy link
Member

@timj timj Dec 1, 2020

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

Copy link
Collaborator Author

@andy-slac andy-slac Dec 1, 2020

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.

Copy link
Collaborator Author

@andy-slac andy-slac Dec 2, 2020

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.

Copy link
Collaborator Author

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.

@andy-slac andy-slac force-pushed the tickets/DM-27667 branch 2 times, most recently from 7aaaa23 to 2971b8e Compare December 2, 2020 21:52
@andy-slac andy-slac force-pushed the tickets/DM-27667 branch 2 times, most recently from de477bd to 1c99b9a Compare December 4, 2020 19:49
Copy link
Contributor

@MichelleGower MichelleGower left a 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.
Copy link
Contributor

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?

Copy link
Collaborator Author

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.
@andy-slac andy-slac changed the title Add pipetask option to execute graph subset (DM-27667) DM-27667: Add pipetask option to execute graph subset Dec 7, 2020
@andy-slac andy-slac merged commit 9a9aca6 into master Dec 7, 2020
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.

None yet

3 participants