Skip to content

Commit ac29818

Browse files
committed
Drop multi processing test. Qiskit parallel_map is multiprocess based, and it copies container into each process. Saving data in the copied container just discards added data when the process finishes. For now Qiskit Experiments don't use multi processing and we don't need to care these tests immediately.
1 parent 6a80707 commit ac29818

File tree

1 file changed

+0
-71
lines changed

1 file changed

+0
-71
lines changed

test/framework/test_data_table.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import numpy as np
1818
import pandas as pd
19-
from qiskit.tools import parallel_map
2019

2120
from qiskit_experiments.database_service.utils import ThreadSafeDataFrame
2221
from qiskit_experiments.framework.analysis_result_table import AnalysisResultTable
@@ -120,76 +119,6 @@ def test_clear_container(self):
120119
table.clear()
121120
self.assertEqual(len(table), 0)
122121

123-
def test_multi_thread_add_entry(self):
124-
"""Test add entry with parallel thread access."""
125-
table = TestBaseTable.TestTable()
126-
127-
# Mutate thread safe table in parallel thread. No race should occur.
128-
parallel_map(
129-
_callable_thread_local_add_entry,
130-
[
131-
["x", {"value1": 0.0, "value2": 1.0, "value3": 2.0}],
132-
["y", {"value1": 3.0, "value2": 4.0, "value3": 5.0}],
133-
["z", {"value1": 6.0, "value2": 7.0, "value3": 8.0}],
134-
],
135-
task_kwargs={"thread_table": table},
136-
)
137-
self.assertEqual(len(table), 3)
138-
139-
self.assertListEqual(table.loc["x"].to_list(), [0.0, 1.0, 2.0])
140-
self.assertListEqual(table.loc["y"].to_list(), [3.0, 4.0, 5.0])
141-
self.assertListEqual(table.loc["z"].to_list(), [6.0, 7.0, 8.0])
142-
143-
def test_multi_thread_add_entry_with_new_column(self):
144-
"""Test add entry with parallel thread access, each thread adds new column."""
145-
table = TestBaseTable.TestTable()
146-
147-
# Mutate thread safe table in parallel thread. No race should occur.
148-
parallel_map(
149-
_callable_thread_local_add_entry,
150-
[
151-
["x", {"value1": 0.0, "value2": 1.0, "value3": 2.0, "new_x": "x_val"}],
152-
["y", {"value1": 3.0, "value2": 4.0, "value3": 5.0, "new_y": "y_val"}],
153-
["z", {"value1": 6.0, "value2": 7.0, "value3": 8.0, "new_z": "z_val"}],
154-
],
155-
task_kwargs={"thread_table": table},
156-
)
157-
self.assertEqual(len(table), 3)
158-
159-
self.assertDictEqual(
160-
table.loc["x"].to_dict(),
161-
{
162-
"value1": 0.0,
163-
"value2": 1.0,
164-
"value3": 2.0,
165-
"new_x": "x_val",
166-
"new_y": None,
167-
"new_z": None,
168-
},
169-
)
170-
self.assertDictEqual(
171-
table.loc["y"].to_dict(),
172-
{
173-
"value1": 3.0,
174-
"value2": 4.0,
175-
"value3": 5.0,
176-
"new_x": None,
177-
"new_y": "y_val",
178-
"new_z": None,
179-
},
180-
)
181-
self.assertDictEqual(
182-
table.loc["z"].to_dict(),
183-
{
184-
"value1": 6.0,
185-
"value2": 7.0,
186-
"value3": 8.0,
187-
"new_x": None,
188-
"new_y": None,
189-
"new_z": "z_val",
190-
},
191-
)
192-
193122
def test_container_is_immutable(self):
194123
"""Test modifying container doesn't mutate the original payload."""
195124
table = TestBaseTable.TestTable()

0 commit comments

Comments
 (0)