-
Notifications
You must be signed in to change notification settings - Fork 21
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
Callable_from_QUA #173
Callable_from_QUA #173
Conversation
Two things are currently not working well:
|
Points 1. and 2. will be added as a second version and I will work on implementing point 3. using a class. |
Following our earlier conversation with @TheoLaudatQM @yonatanrqm @yomach I'll try to implement the changes related to inheriting from The goal is that we no longer need to run the following: with prog.local_run(qm):
job = qm.execute(prog) but can instead directly run job = qm.execute(prog) I think the following items should be done
Open questions
|
This PR is ready for review by @yomach and @yonatanrqm. SummaryWe've developed the Basic code examplepatch_callable_from_qua() # Necessary patches
@callable_from_qua
def qua_print(*args):
print(", ".join(args))
with program() as prog:
n1 = declare(int)
n2 = declare(int)
qua_print("n1", n1, "n2", n2)
qm.execute(prog) When the program is executed and reaches ConsiderationsEvent managerWhile the QUA program is being executed, the local PC is running a AddonsThe event manager attaches itself as a
In the current implementation, the event manager addon is automatically added to the program if a Currently this functionality is added through patching (see next point), but if this PR is accepted, it should be incorporated into QUA in one way or another. PatchingCurrently the function
These changes should ideally be incorporated into QUA directly, making this patch obsolete. Once this is the case, the patch will simply print a deprecation warning. Private QUA variablesSeveral private variables from
Follow-up featuresTo be implemented in subsequent PR:
|
I should mention that this addon feature might also be useful in other cases, e.g. QuAM, execution standardization |
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.
Looks very good, few comments on the example folder:
- Let's remove IPs, calibration database, and other specific information from there.
- There are 5 usecases written in the readme, but 7 "test_" files. Let's narrow it down so it would match
- At the same time, let's remove the
test_
from their name, and give them a name which suits the example their are showing. Some are ok, so are not clear... - Add a short explanation to each example
- Remove the capital C from the name of the folder
@yomach I rewrote the patch of |
So we're patching the function and not the class? In any case, the previous comments I wrote are still valid. |
Yeah I think it's safer to patch the function rather than the class. There's a slight chance of unintended consequences, e.g. |
* move callable_from_qua away from addons * rename folders * Rename run_local -> callable_from_qua * add patches to qua classes * add to import * Added patches * patches and transformed to ProgramAddon * add creation of QuaCallableEventManager * rename everything to qua_callable * Add callables attr * add enable_callable_from_qua * fix: classmethods * fixed bugs related to class * update tests * Switch order in execute and addons execution * fix bug * qua_patches decoupled * work in progress * remove "enable_callable" * get program from scope --------- Co-authored-by: TheoQM <[email protected]>
4a72d30
to
adb49f9
Compare
Hey, I fixed the examples folder and the readme.
|
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.
Didn't do a full review again, but just looking at what I wrote previously, this looks super good and almost everything is done!
A bit minor, but can we remove the capital C from examples/Callable_from_qua
?
Thanks Yoav, it's done now (I actually had to delete the folder and put it back so that it changes the name...) |
I think it's a windows thing... Anyway, thanks! Good from my side, @yonatanrqm @nulinspiratie - any more comments, or should we merge? |
Looks good to me, thanks for cleaning up @TheoLaudatQM! I think it's ready to be merged |
Call Python functions from the QUA program directly using the decorator @run_local