-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding qq update
command
#905
Conversation
src/qibocal/cli/update.py
Outdated
runcard = Runcard.load(yaml.safe_load((path / RUNCARD).read_text())) | ||
set_backend(backend=runcard.backend, platform=runcard.platform) | ||
# run | ||
history = run( | ||
output=path, | ||
runcard=runcard, | ||
mode=ExecutionMode.UPDATE, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should already have the most updated runcard in the output folder, when you invoke qq update
.
Maybe it is in a subfolder, corresponding to the latest routine (which is perfectly fine), but I'd just maintain a link to the latest one in the top-level folder, and copy that one to the original platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this way, you won't even need to track the timing. It's just a copy, it will take almost nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should already have the most updated runcard in the output folder, when you invoke
qq update
.Maybe it is in a subfolder, corresponding to the latest routine (which is perfectly fine), but I'd just maintain a link to the latest one in the top-level folder, and copy that one to the original platform.
Actually this might not be the case. This is true only when running with AUTOCALIBRATION
, but in this execution mode all updates will be performed in any case (local one after each protocol and the global one at the end).
I know that we still need to decide how to handle local updates. If by default we decide to keep local updates what you are suggesting makes sense. What do you think @alecandido?
src/qibocal/update.py
Outdated
"""Update drive frequency value in platform for specific qubit.""" | ||
if isinstance(freq, tuple): | ||
if isinstance(freq, (tuple, list)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just using one of the two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an ugly patch. I will try to improve it. The error was triggered when I tested with qq update
, I think that there are some attributes in Results
which are tuple since they contain also the error and when they are deserialized they are converted into lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, JSON only supports one type of sequences, and that type is deserialized to list
in Python.
However, if we want to serialize it, and we don't have advanced support to deserialize to our own types (e.g. Pydantic), I'd propose to not oppose to JSON, and just use list
s. It's a practical solution to avoid an increased amount of code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in cf006ca
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been through cf006ca, and I marked a few tuples I've found, but there are many more.
Maybe I missed where the tuples had to be dropped from. Sorry...
@andrea-pasquale I'm sorry for the tuple business. As soon as I will finish #909 I have other few simpler improvements in mind, including a consistent migration to Pydantic. Whenever that will be completed, tuples will be available again, since the serialization will come out of the box. Unfortunately, I will have to balance those with #869 (but if I will be good enough with #909, a first version of that should be pretty simple to achieve). |
No problem @alecandido. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #905 +/- ##
==========================================
- Coverage 97.47% 97.46% -0.02%
==========================================
Files 116 117 +1
Lines 8882 8906 +24
==========================================
+ Hits 8658 8680 +22
- Misses 224 226 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Now it should be ready to review. There are a lot of file changes just for the tuple issue |
qq update
commandqq update
command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just a comment about local_update
, but other than that it should be fine.
I'm also glad that the superposition with #909 is very small, it should be pretty simple to rebase :D
completed.update_platform(platform=self.platform, update=self.update) | ||
|
||
if self.platform is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can move this line before if ExecutionMode.FIT in mode and self.platform is not None and update:
There is a small inconsistency with the typing, according to the Executor definition a platform is always defined even in the create
method, for the moment could you change it ? (we can even wait #909)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, the check now is needed only because we support still execution with simulation (where platform is None
). Since #909 will drop it here we can keep it I think. I'll open an issue just to remember to do it.
Addition of a
qq update
program to generate the updated platform from CLI after the qibocal execution. Closes #833.Checklist:
master
main
main