Skip to content

Conversation

dyates
Copy link
Contributor

@dyates dyates commented Aug 8, 2025

Adds the ability to retrieve a QuantumProcessorConfig from a project. There are two ways to retrieve processor configs: from the Engine or an EngineProcessor.

Here is an example using the processor:

engine = cirq_google.get_engine('my-project')
processor = engine.get_processor('my-processor')

run_name_config = processor.get_config_by_run_name(run_name="abc", config_id="123")
current_config = processor.get_config_by_run_name(config_id="123")
snapshot_config = processor.get_config_by_snapshot_id(snapshot_id="xyz", config_id="123")

Here is an example getting the config directly from the Engine:

engine = cirq_google.get_engine('my-project')
processor_id = 'my-processor'

run_name_config = engine.get_config_by_run_name(
    processor_id=processor_id, run_name="abc", config_id="123"
)
current_config = engine.get_config_by_run_name(
    processor_id=processor_id, config_id="123"
)
snapshot_config = engine.get_config_by_snapshot_id(
    processor_id=processor_id, snapshot_id="xyz", config_id="123"
)

@dyates dyates requested review from wcourtney, vtomole, verult and a team as code owners August 8, 2025 22:54
@github-actions github-actions bot added the size: XL lines changed >1000 label Aug 8, 2025
@dyates
Copy link
Contributor Author

dyates commented Aug 11, 2025

I'm working on fixing the errors. Some missing tests/logic for a few edge cases.

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.37%. Comparing base (97781c7) to head (54cc85c).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7565    +/-   ##
========================================
  Coverage   99.37%   99.37%            
========================================
  Files        1078     1080     +2     
  Lines       96162    96484   +322     
========================================
+ Hits        95559    95881   +322     
  Misses        603      603            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hoisinberg
Copy link
Collaborator

I've verified that this works fully end-to-end with a colab containing the following code:

import cirq
import cirq_google
from cirq_google.engine.qcs_notebook import authenticate_user

authenticate_user()
engine = cirq_google.get_engine('quantum-michaelbq')
processor_id = 'WIL01_9A_BLACK'
run_name = 'current'
config_alias = 'cz_8'

print("Get config from engine")
config = engine.get_processor_config_from_run(processor_id=processor_id, run_name=run_name, config_alias=config_alias)
print(config.effective_device)

print("Get config from processor object")
config = engine.get_processor(processor_id).get_config_from_run(run_name=run_name, config_alias=config_alias)
print(config.effective_device)

Copy link
Collaborator

@hoisinberg hoisinberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my part. Looks like there are just a couple of comments left from Will.

Copy link
Collaborator

@wcourtney wcourtney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM % a few remaining nits.

@dyates dyates requested a review from wcourtney September 12, 2025 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: XL lines changed >1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants