forked from microsoft/Qcodes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request microsoft#2124 from jenshnielsen/nested_measurements
Only create one background writer for multiple datasets
- Loading branch information
Showing
7 changed files
with
765 additions
and
254 deletions.
There are no files selected for viewing
548 changes: 352 additions & 196 deletions
548
docs/examples/DataSet/Performing-measurements-using-qcodes-parameters-and-dataset.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
""" | ||
Test that multiple datasets can coexist as expected | ||
""" | ||
import pytest | ||
|
||
from qcodes import new_experiment | ||
from qcodes.dataset.data_set import DataSet | ||
|
||
|
||
def test_foreground_after_background_raises(empty_temp_db_connection): | ||
new_experiment("test", "test1", conn=empty_temp_db_connection) | ||
ds1 = DataSet(conn=empty_temp_db_connection) | ||
ds1.mark_started(start_bg_writer=True) | ||
|
||
ds2 = DataSet(conn=empty_temp_db_connection) | ||
with pytest.raises(RuntimeError, match="All datasets written"): | ||
ds2.mark_started(start_bg_writer=False) | ||
|
||
|
||
def test_background_after_foreground_raises(empty_temp_db_connection): | ||
new_experiment("test", "test1", conn=empty_temp_db_connection) | ||
ds1 = DataSet(conn=empty_temp_db_connection) | ||
ds1.mark_started(start_bg_writer=False) | ||
|
||
ds2 = DataSet(conn=empty_temp_db_connection) | ||
with pytest.raises(RuntimeError, match="All datasets written"): | ||
ds2.mark_started(start_bg_writer=True) | ||
|
||
|
||
def test_background_twice(empty_temp_db_connection): | ||
new_experiment("test", "test1", conn=empty_temp_db_connection) | ||
ds1 = DataSet(conn=empty_temp_db_connection) | ||
ds1.mark_started(start_bg_writer=True) | ||
|
||
ds2 = DataSet(conn=empty_temp_db_connection) | ||
ds2.mark_started(start_bg_writer=True) | ||
|
||
|
||
def test_foreground_twice(empty_temp_db_connection): | ||
new_experiment("test", "test1", conn=empty_temp_db_connection) | ||
ds1 = DataSet(conn=empty_temp_db_connection) | ||
ds1.mark_started(start_bg_writer=False) | ||
|
||
ds2 = DataSet(conn=empty_temp_db_connection) | ||
ds2.mark_started(start_bg_writer=False) | ||
|
||
|
||
def test_foreground_after_background_non_concurrent(empty_temp_db_connection): | ||
new_experiment("test", "test1", conn=empty_temp_db_connection) | ||
ds1 = DataSet(conn=empty_temp_db_connection) | ||
ds1.mark_started(start_bg_writer=True) | ||
ds1.mark_completed() | ||
|
||
ds2 = DataSet(conn=empty_temp_db_connection) | ||
ds2.mark_started(start_bg_writer=False) | ||
ds2.mark_completed() | ||
|
||
ds3 = DataSet(conn=empty_temp_db_connection) | ||
ds3.mark_started(start_bg_writer=True) | ||
ds3.mark_completed() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.