qiskit-community / qiskit-metal

Quantum Hardware Design. Open-source project for engineers and scientists to design superconducting quantum devices with ease.
https://qiskit-community.github.io/qiskit-metal/
Apache License 2.0
270 stars 201 forks source link

Display option name and option value of failed runs in the Sweeper class' `run_sweep` method #907

Closed jagandecapri closed 1 year ago

jagandecapri commented 1 year ago

Please be as descriptive as possible, including: what is expected, why is this feature needed, what is the objective, etc.

What is the feature being requested?

Currently, when a run fails during the execution of Sweeper class' run_sweep method, the warning message, , does not tell which option name or option value that failed.

https://github.com/Qiskit/qiskit-metal/blob/fdc6df69ecb1e9a4ada03f519228a16903f0ec7d/qiskit_metal/analyses/sweep_and_optimize/sweeper.py#L166-L168

One way to trigger this warning is to abort the simulation in Ansys when the run_sweep class is executing.

What are use cases for this feature?

It will be useful to add which option name + option value (key) combination that didn't execute properly for reference in case the user wants to run the sweeper again for the failed option values.

Proposed idea

I made a change in my local Qiskit Metal code as following to display the option name and option value that failed in the warning message.

self.design.logger.warning(f'For class {self.parent.__class__.__name__}, option_name={".".join(option_path)}, key={item}, run() did not execute as expected: {message}')

The necessary variables are available within the iterate_option_sweep method.

Miscellaneous

Slack conversation at https://qiskit.slack.com/archives/C01R8KP5WP7/p1673986921233929