Skip to content

Commit 3d50921

Browse files
authored
[cirqflow] Provide concrete ExecutableSpec (#4559)
`ExecutableSpec` is a newly-introduced abstract class. The design was each application would subclass it for application-dependent data attributes. 1. Writing all the serialization tests is a nightmare without a full-fledged lives-in-Cirq concrete implementation of this 2. You could imagine users might want a lower-touch way to put together an executable using an untyped, implicit-schema version of the spec. Ergo: this PR introduces `KeyValueExecutableSpec` to address these two concerns.
1 parent 978dbac commit 3d50921

12 files changed

+3917
-40
lines changed

cirq-google/cirq_google/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120

121121
from cirq_google.workflow import (
122122
ExecutableSpec,
123+
KeyValueExecutableSpec,
123124
QuantumExecutable,
124125
QuantumExecutableGroup,
125126
BitstringsMeasurement,

cirq-google/cirq_google/json_resolver_cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ def _class_resolver_dictionary() -> Dict[str, ObjectFactory]:
4444
'cirq.google.BitstringsMeasurement': cirq_google.BitstringsMeasurement,
4545
'cirq.google.QuantumExecutable': cirq_google.QuantumExecutable,
4646
'cirq.google.QuantumExecutableGroup': cirq_google.QuantumExecutableGroup,
47+
'cirq.google.KeyValueExecutableSpec': cirq_google.KeyValueExecutableSpec,
4748
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"cirq_type": "cirq.google.KeyValueExecutableSpec",
3+
"executable_family": "cirq_google.algo_benchmarks.example",
4+
"key_value_pairs": [
5+
[
6+
"name",
7+
"example-program"
8+
]
9+
]
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cirq_google.KeyValueExecutableSpec(executable_family='cirq_google.algo_benchmarks.example', key_value_pairs=(('name', 'example-program'),))

0 commit comments

Comments
 (0)