Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions qiskit_experiments/framework/composite/composite_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,15 @@ def _run_analysis(self, experiment_data: ExperimentData):
# Since copy for replace result is handled at the parent level
# we always run with replace result on component analysis
self._analyses[i].run(sub_expdata, replace_results=True)

# Analysis is running in parallel so we add loop to wait
# for all component analysis to finish before returning
# the parent experiment analysis results
for sub_expdata in component_expdata:
# Block for results to avoid issues nested CompositeAnalysis runs.
# Ideally this constraint will be removed in the future.
# Previously run() was called on all components and then
# block_for_results() was called on all of them, but since only one
# thread can execute Python code at a time there is not much
# difference in performance. Blocking separately limits the number
# of threads that are started simultaneously.
sub_expdata.block_for_results()

# Optionally flatten results from all component experiments
# for adding to the main experiment data container
if self._flatten_results:
Expand Down