Skip to content

Add a callback to get_parameter_data to follow data loading#4688

Merged
jenshnielsen merged 25 commits intomicrosoft:masterfrom
edumur:add-feedback
Nov 28, 2022
Merged

Add a callback to get_parameter_data to follow data loading#4688
jenshnielsen merged 25 commits intomicrosoft:masterfrom
edumur:add-feedback

Conversation

@edumur
Copy link
Copy Markdown
Contributor

@edumur edumur commented Oct 4, 2022

Hi all,

In the effort to use qcodes as the data loader of the pyplotter I added a callback to get_parameter. This is usefull to track the progress of the data download.
Since sqlite3 does not allow to keep track of the data loading progress, we compute how many sqlite requests correspond to a certain percentage of progress which is dictated by a config parameter. Then we perform x sql request instead of one, running the callback everytime.

The whole process add an overhead of ~13% on my laptop when used which is not negligible.
However, I would argue that keeping track of the download progress for a GUI is precious and is worth the overhead.

To test the download time

import qcodes as qc
from time import time

def callback(progress):
    # print(progress)
    pass

qc.initialise_or_create_database_at('test.db')

start = time()
qc.load_by_id(2).get_parameter_data('phase')
stop = time()
dt1 = stop-start
print(dt1)
start = time()
qc.load_by_id(2).get_parameter_data('phase', callback=callback)
stop = time()
dt2 = stop-start
print(dt2)

print(dt2/dt1)

I kept the change minimal hoping other people will have comments.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants