-
Notifications
You must be signed in to change notification settings - Fork 107
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
[feat] Asyncio execution policy #3347
base: develop
Are you sure you want to change the base?
[feat] Asyncio execution policy #3347
Conversation
Hello @Blanca-Fuentes, Thank you for updating!
Do see the ReFrame Coding Style Guide Comment last updated at 2025-01-24 12:30:40 UTC |
00b25b8
to
010b8fb
Compare
2a01b52
to
c25e50b
Compare
e35b694
to
02ddcc2
Compare
9d336c4
to
914ddf1
Compare
This PR changes the asynchronous execution policy to use
asyncio
(AsyncioExecutionPolicy
).The main changes introduced are the following:
KeyBoardInterrupt
management: introduction of a new type of exceptionKeyboardError
to raise in case of keyboard interruption during the execution of the code.attach_hooks()
: if the hook is therun
/wait
methods of a test then, they need to be treate as asyncio coroutines_global_logger
and atasks_logger
. The_global_logger
is used when the asyncio loop has not been yet opened and thetasks_logger
to retrieve the right logging context for each task.stage_dir
and theoutput_dir
must be absolute paths for the right context switching withwith change_dir_global
. The working directory of reframe is now set at the beginning withset_working_dir
, it is retrieved at any point in the code withget_working_dir
because changing directory with asyncio does not guarantee that we will be in the right directory when doingos.getcwd()
.compile
,run
,compile_wait
,run_wait
are now asynchronous.run_command_asyncio
method was added to create an asyncio subprocess, which has the same output as therun_command_async
. This method waits (asynchronously) for the command to be executed. The methodrun_command_async_alone
just starts the subprocess but does not wait for completion (this allows the local scheduler to poll for the job completion)._term_all()
and_kill_all()
) of the processes in the local scheduler is more challenging because the communication of signals between children and parent processes is not handled in the same way. The children of a process are retrieved explicitly and signals are sent to each process individually._run_strict
and_run_strict_s
are the asyncio and synchronous versions of_run_strict
.execute()
not inexit()
as in the previousAsynchronousExecutionPolicy
.asyncio
policy.TODOs
Extend the implementation to other schedulers (only slurm /local)
Other tasks