Skip to content

Commit

Permalink
Update run_id when adding ds in mem to db
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik-Vogel authored and jenshnielsen committed Jun 16, 2023
1 parent c5ec9c7 commit d96dd4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion qcodes/dataset/data_set_in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def write_metadata_to_db(self, path_to_db: str | Path | None = None) -> None:
sample_name=self.sample_name,
load_last_duplicate=True,
)
_add_run_to_runs_table(self, aconn, exp.exp_id, create_run_table=False)
run_id = _add_run_to_runs_table(
self, aconn, exp.exp_id, create_run_table=False
)
self._run_id = run_id
self._path_to_db = conn.path_to_dbfile

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions qcodes/dataset/dataset_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def _add_run_to_runs_table(
target_conn: ConnectionPlus,
target_exp_id: int,
create_run_table: bool = True,
) -> str | None:
) -> int:
metadata = dataset.metadata
snapshot_raw = dataset._snapshot_raw
captured_run_id = dataset.captured_run_id
captured_counter = dataset.captured_counter
parent_dataset_links = links_to_str(dataset.parent_dataset_links)
_, target_run_id, target_table_name = create_run(
_, target_run_id, _ = create_run(
target_conn,
target_exp_id,
name=dataset.name,
Expand All @@ -41,4 +41,4 @@ def _add_run_to_runs_table(
dataset.run_timestamp_raw,
dataset.completed_timestamp_raw,
)
return target_table_name
return target_run_id

0 comments on commit d96dd4f

Please sign in to comment.