Changes to saving and loading QuantumGraphs

DM-27784 and DM-27667 introduced a new system for saving and loading QuantumGraph objects created with the pipetask command.

The file name of a QuantumGraph object must now end with the extension .qgraph. The binary representation of the file is no longer a python pickle file, and this extension reflects what type of data this file should contain.

Existing QuantumGraphs that were saved in pickle format can continue to be loaded, but they do not benefit from enhancements described below and will generate a warning. It is suggested these graphs be loaded in, and saved again which will use the new format, and will not require a potentially slow stage of re-generating the graph.

The pipetask command supports loading a subset of nodes from a QuantumGraph using the new --qgraph-node-id command line switch. This takes a comma separated list of ints representing the nodes of a graph that are to be loaded. There is also a new optional switch named --qgraph-id that can be used to verify the graph that is loaded is the same graph that was used when selecting node number.

DM-27682 introduced the ability to specify a QauntumGraph using a URI. These can be things like a file path (which support shell variable expansion), s3, webdav, and anything else supported by ButlerURI.

When loading from a file path, or s3, partial loading is supported. That is to say, the entire file does not need to be retrieved before un-persisting a supplied list of individual nodes to load. This should make loads faster, and more efficient. For other URIs the entire quantum graph is loaded, and the resulting object is then subset. Support for partial loading for the other URIs is currently in progress, and support for webdav should be coming soon.

All of the above is completely optional except the new file extension. Existing code and scripts should continue to work just the same as they have once the filename path has been updated to use .qgraph.

2 Likes