Skip to content

Commit

Permalink
Give a default to sample-program (Qiskit#77)
Browse files Browse the repository at this point in the history
* Give a default to sample-program

Seeing a lot of failed jobs from people just running the sample program without parameters. It kind of skews our metrics as noise when we look at job failures over time.

* Actually not require iterations param

* Update json schema
  • Loading branch information
Renier Morales authored and GitHub Enterprise committed Nov 11, 2021
1 parent a626561 commit 675d51a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 2 additions & 4 deletions runtime/sample_program.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
"iterations": {
"type": "integer",
"minimum": 0,
"default": 1,
"description": "Number of iterations to run. Each iteration generates a runs a random circuit."
}
},
"required": [
"iterations"
]
}
},
"return_values": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
Expand Down
4 changes: 1 addition & 3 deletions runtime/sample_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ def main(backend, user_messenger, **kwargs):
program consumer.
kwargs: User inputs.
"""
if "iterations" not in kwargs:
raise ValueError('"iterations" is a required input parameter.')
iterations = kwargs["iterations"]
iterations = kwargs.get("iterations", 1)
for it in range(iterations):
qc = prepare_circuits(backend)
result = backend.run(qc).result()
Expand Down

0 comments on commit 675d51a

Please sign in to comment.