-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Python] Call SDK asyncio friendly #32764
Merged
mergify
merged 6 commits into
project-chip:master
from
agners:call-sdk-asyncio-friendly
May 16, 2024
Merged
[Python] Call SDK asyncio friendly #32764
mergify
merged 6 commits into
project-chip:master
from
agners:call-sdk-asyncio-friendly
May 16, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR #32764: Size comparison from 4e582fc to 0246d05 Decreases (1 build for efr32)
Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, stm32, telink)
|
0246d05
to
f4635db
Compare
PR #32764: Size comparison from 5570be9 to f4635db Full report (4 builds for cc32xx, mbed, stm32)
|
f4635db
to
79520c0
Compare
PR #32764: Size comparison from 5570be9 to 79520c0 Decreases (2 builds for efr32)
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
79520c0
to
44ea891
Compare
PR #32764: Size comparison from 5570be9 to 44ea891 Decreases (2 builds for efr32)
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
44ea891
to
3fdbbbe
Compare
PR #32764: Size comparison from 5570be9 to 3fdbbbe Decreases (2 builds for efr32)
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
tehampson
reviewed
May 2, 2024
PR #32764: Size comparison from 5570be9 to 9da6eaa Increases (11 builds for bl702l, esp32, linux, nrfconnect, telink)
Decreases (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
Full report (71 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
tehampson
approved these changes
May 7, 2024
CallAsync continuously calls a callback function during the wait for the call. Rename the function to reflect that fact. This frees up CallAsync for an asyncio friendly implementation.
Call Matter SDK in a asyncio friendly way. During posting of the task onto the CHIP mainloop, it makes sure that the asyncio loop is not blocked.
Also add a comment that the function needs to be released by registering a callback and setting the complete event.
6c69159
to
d411e77
Compare
PR #32764: Size comparison from 36c76e6 to d411e77 Decreases (2 builds for efr32)
Full report (77 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink)
|
cecille
approved these changes
May 15, 2024
fessehaeve
approved these changes
May 16, 2024
This was referenced Jun 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements CHIP mainloop calls in an asyncio friendly manner. Today, when posting onto the CHIP thread, the function
builtins.chipStack.Call
which runs the command on the CHIP mainloop, blocks until the command has been actually issued on the CHIP thread (usingthreading.Condition
, seeAsyncCallableHandle
). This is not very asyncio friendly. Instead, use the asyncio loop and schedule a task on the asyncio loop when the command has been executed.Note that this means that an asyncio loop might be scheduling multiple CHIP calls before they complete. But as they are still run on the same CHIP mainloop, this is safe.
The current implementation changes function names a bit: Today's
CallAsync
is being renamed toCallAsyncWithCallback
to free upCallAsync
for the asyncio variant.