-
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
Modifications to callable_from_qua #178
Conversation
I agree with what you wrote (haven't looked at the code yet). |
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.
The test programs don't run because a running job is needed before it is actually created
compiler_options: Optional[CompilerOptionArguments] = None, | ||
) -> RunningQmJob: | ||
for program_addon in program.addons.values(): | ||
program_addon.execute_program(program=program, quantum_machine=self) |
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 execute_program(), you're trying to get the running job job = quantum_machine.get_running_job()
which doesn't already exist since it will be created in the next line. This prevents the program from running and I am not sure how to fix it myself...
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.
Ah good point, maybe the solution is then to run the addons after starting the main program.
In this case we need to make sure that if QUA performs a callable_from_qua
before the addon programs are started, it won't cause issues. We can do this by e.g. adding a few seconds delay between executing the program and starting the addons. @TheoLaudatQM could you try this out?
* 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]>
* working version * Callable from QUA tests * Working version for serwan * More examples * after code session with Serwan * clean + readme + examples * Update examples * Modifications to callable_from_qua (#178) * 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]> * _get_root_program_scope() + black * fix black formatting * second attempt black formatting * Rewrite patch_qua_program_addons, improve qm.execute patch * Conf_test, basic test * Example files * Example readme * default config * readme and changelog * black * remove example * Add example with small c --------- Co-authored-by: Serwan Asaad <[email protected]> Co-authored-by: Serwan Asaad <[email protected]>
This is a PR attempting to implement the changes required for callable_from_qua.
@TheoLaudatQM I'm not able to run this locally, so there are likely to be several bugs. can you try this out nonetheless?
Following our earlier conversation with @TheoLaudatQM @yonatanrqm @yomach I'll try to implement the changes related to inheriting from
Program
andQuantumMachine
.The goal is that we no longer need to run the following:
but can instead directly run
Usage:
I think the following items should be done
QuantumMachine
, addQuantumMachine.callables
which get executed when callingqm.execute()
Program
, addprogram.addons
@local_run
back to@callable_from_qua
LocalRunManager
toQuaCallableEventManager
callable_from_qua
away fromqualang_tools/addons
toqualang_tools/callable_from_qua
. @yomach do you agreeOpen questions
CallableEventManager
be opened in the main thread or in a separate thread while the program is executing on the machine?I think the best is if it by default opens in a separate thread, but the user can specify to run it in the main thread, in which case it's blocking.
E.g. we can currently run
with prog.local_run(qm, funcs=[live_plot]):
to also add live plotting