qiskit
qiskit copied to clipboard
Read timing constraints from target when no backend is provided
Summary
This fixes #14329. When there is no backend, TimingConstraints will be set to None, and then populated from the target.
Details and comments
If there is no target provided, the timing constraints will come from the generated target. By delaying the assignment of the TimingConstraints, ensure that target is examined before using the default TimingConstraints. A test has also been added to test this.
Thank you for opening a new pull request.
Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.
While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.
One or more of the following people are relevant to this code:
@Qiskit/terra-core
I was having trouble running the CI on my own fork, but I ran the tests locally with tox and ran the formatter. If there are more tests you want me to run before continuing with this pull request, just let me know!
From the CI results there are a couple of lint issues identified:
https://dev.azure.com/qiskit-ci/qiskit/_build/results?buildId=67400&view=logs&j=ee6a574e-a884-556d-e11f-f4e0408370dd&t=cda6e954-50e0-5d66-9385-47256a656c01&l=1584
************* Module qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager
qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py:29:0: W0611: Unused TimingConstraints imported from qiskit.transpiler.timing_constraints (unused-import)
************* Module test.python.transpiler.test_preset_passmanagers
test/python/transpiler/test_preset_passmanagers.py:1513:8: C0103: Variable name "has_InstructionDurationsCheck" doesn't conform to '[a-z_][a-z0-9_]{1,30}$' pattern (invalid-name)
test/python/transpiler/test_preset_passmanagers.py:1517:15: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
test/python/transpiler/test_preset_passmanagers.py:1518:16: C0103: Variable name "has_InstructionDurationsCheck" doesn't conform to '[a-z_][a-z0-9_]{1,30}$' pattern (invalid-name)
Pull Request Test Coverage Report for Build 16918078305
Details
- 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
- 14 unchanged lines in 3 files lost coverage.
- Overall coverage decreased (-0.002%) to 87.671%
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| crates/circuit/src/parameter/symbol_expr.rs | 1 | 74.29% |
| crates/qasm2/src/lex.rs | 1 | 92.78% |
| crates/qasm2/src/parse.rs | 12 | 97.09% |
| <!-- | Total: | 14 |
| Totals | |
|---|---|
| Change from base Build 16917208243: | -0.002% |
| Covered Lines: | 82372 |
| Relevant Lines: | 93956 |
💛 - Coveralls
@mtreinish Thanks for pointing those out! I was able to fix those linter issues.