-
Couldn't load subscription status.
- Fork 257
Feature: add executor.create_future() #1495
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
Feature: add executor.create_future() #1495
Conversation
|
@sloretz @fujitatomoya @mjcarroll @wjwwood @ahcorde |
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 think this makes sense, that makes the explicit association to the executor, the future is tied to the executor that created it. and it also aligns with create_task method in API consistency.
i would like to have another approval before merge.
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.
LGTM. I would also change the other tests in test_executor to use the new method for creating futures.
|
Also, shouldn't the |
@bjsowa @fujitatomoya rclpy/rclpy/rclpy/executors.py Line 516 in 0fbd01a
The same case applies to ActionClient (or any other Waitable) rclpy/rclpy/rclpy/executors.py Line 566 in 0fbd01a
Done |
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.
Client and ActionClient initialize the Future object without an executor by design.
Currently, users are able to execute client.call_async() before initializing an executor.
To allow this behavior, Future is initialized without an executor, and the executor is set when processing the service response.
Oh, I haven't realized that. That makes sense.
|
@Mergifyio rebase |
Signed-off-by: Nadav Elkabets <[email protected]>
Signed-off-by: Nadav Elkabets <[email protected]>
✅ Branch has been successfully rebased |
9208dbf to
fb025e0
Compare
|
Pulls: #1495 |
|
@fujitatomoya could you run CI again? I believe Linux failed for unrelated reasons. |
|
@fujitatomoya can we proceed to merge this PR? |
|
https://ci.ros2.org/job/ci_linux-rhel/4284/ are known issues and unrelated. |
|
@fujitatomoya thank you for helping to merge this PR. I really appreciate your support🙏 |
|
i think that it is straight-forward for kilted, but maybe there can be conflict for jazzy. but i think that it is backportable. |
|
@Mergifyio backport kilted jazzy |
✅ Backports have been created
|
* feature: add create_future and test Signed-off-by: Nadav Elkabets <[email protected]> * Use create_future in all executor tests Signed-off-by: Nadav Elkabets <[email protected]> --------- Signed-off-by: Nadav Elkabets <[email protected]> (cherry picked from commit bcdd663)
* feature: add create_future and test Signed-off-by: Nadav Elkabets <[email protected]> * Use create_future in all executor tests Signed-off-by: Nadav Elkabets <[email protected]> --------- Signed-off-by: Nadav Elkabets <[email protected]> (cherry picked from commit bcdd663) # Conflicts: # rclpy/src/rclpy/events_executor/events_executor.cpp # rclpy/src/rclpy/events_executor/events_executor.hpp # rclpy/test/test_executor.py
* feature: add create_future and test * Use create_future in all executor tests --------- (cherry picked from commit bcdd663) Signed-off-by: Nadav Elkabets <[email protected]> Co-authored-by: Nadav Elkabets <[email protected]>
* Feature: add executor.create_future() (#1495) * feature: add create_future and test Signed-off-by: Nadav Elkabets <[email protected]> * Use create_future in all executor tests Signed-off-by: Nadav Elkabets <[email protected]> --------- Signed-off-by: Nadav Elkabets <[email protected]> (cherry picked from commit bcdd663) # Conflicts: # rclpy/src/rclpy/events_executor/events_executor.cpp # rclpy/src/rclpy/events_executor/events_executor.hpp # rclpy/test/test_executor.py * resolve conflicts. Signed-off-by: Tomoya Fujita <[email protected]> --------- Signed-off-by: Tomoya Fujita <[email protected]> Co-authored-by: Nadav Elkabets <[email protected]> Co-authored-by: Tomoya Fujita <[email protected]>
Part of #1399 and #1469.
To allow an executor to reschedule a task when a future stops blocking, it is crucial that the future is attached to the same executor.
Currently, users are able to initialize a Future instance without supplying the executor parameter.
This behavior is necessary to allow calling client.call_async() before attaching the node to an executor (the future is attached to the running executor when processing the service response).
In asyncio, loop.create_future() was added to discourage users from initializing the Future class directly.
I suggest we follow the same path.