Skip to content
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

Working 3.10 install #52

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

TylerGubala
Copy link

Fixes some of the 3.10 code when creating an event (removed the loop parameter)

Adds some packages to the requirements file

Protobuf was giving an error about being able to create descriptors directly.
By downgrading, we avoid the error.
@TylerGubala TylerGubala requested a review from a team as a code owner August 30, 2022 16:38
@urastogi885
Copy link

urastogi885 commented Sep 1, 2022

Thanks for the PR.
I tested the pull request. The changes definitely get rid of loop parameter error thrown when sending any requests to Vector via the SDK. However, half of the times the requests don't get executed with the following traceback:

vector-python-sdk % python3 examples/tutorials/01_hello_world.py
11:12:59.762     connection.Connection    INFO  Connecting to <VECTOR_IP>:443 for <VECTOR_NAME> using <VECTOR_CERT_PATH>
E0901 11:13:00.483381000 123145484791808 fork_posix.cc:76]             Other threads are currently calling into gRPC, skipping fork() handlers
11:13:00.597     connection.Connection    INFO  BehaviorControl control_granted_response { }
Traceback (most recent call last):
  File "anki_vector/connection.py", line 749, in log_handler
    result = await func(*args, **kwargs)
  File "anki_vector/animation.py", line 168, in load_animation_list
    return await self._load_animation_list()
  File "anki_vector/animation.py", line 134, in _load_animation_list
    result = await self.grpc_interface.ListAnimations(req)
  File "/usr/local/lib/python3.10/site-packages/aiogrpc/channel.py", line 40, in __call__
    return await fut
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.DEADLINE_EXCEEDED
        details = "ListAnimations request timed out"
        debug_error_string = "{"created":"@1662045186.236287000","description":"Error received from peer ipv4:<ROBOT_IP>:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"ListAnimations request timed out","grpc_status":4}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "examples/tutorials/01_hello_world.py", line 34, in <module>
    main()
  File "examples/tutorials/01_hello_world.py", line 28, in main
    with anki_vector.Robot(args.serial) as robot:
  File "anki_vector/robot.py", line 742, in __enter__
    self.connect(self.behavior_activation_timeout)
  File "anki_vector/robot.py", line 663, in connect
    anim_request = self._anim.load_animation_list()
  File "anki_vector/connection.py", line 806, in result
    return future.result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "anki_vector/connection.py", line 751, in log_handler
    raise connection_error(rpc_error) from rpc_error
anki_vector.exceptions.VectorTimeoutException: StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

@TylerGubala did you experience similar issues?

@TylerGubala
Copy link
Author

TylerGubala commented Sep 1, 2022 via email

@urastogi885
Copy link

urastogi885 commented Sep 1, 2022

I think similar issues exist when using the SDK with Python 3.8 and 3.9
The problem lies in how the SDK uses the Python Asyncio library to execute concurrent tasks. There have been changes in the Asyncio library since Python 3.6 and we are still trying to adapt the SDK to those changes.

Wanted to work with the protobuf compiler in the workspace
Makes it easier to run the current file and test
Requires the following directory structure:

/google
   ... <google protobuf extra libs> ...
/.protobuf
   /bin
      protoc (protobuf exe)
   /include
      ... <protobuf standard libs>...
@urastogi885
Copy link

In order to assess your PR, can you provide information about the protobuf version used and how did you update the pb2 files?

@urastogi885
Copy link

Thanks for the PR. I tested the pull request. The changes definitely get rid of loop parameter error thrown when sending any requests to Vector via the SDK. However, half of the times the requests don't get executed with the following traceback:

vector-python-sdk % python3 examples/tutorials/01_hello_world.py
11:12:59.762     connection.Connection    INFO  Connecting to <VECTOR_IP>:443 for <VECTOR_NAME> using <VECTOR_CERT_PATH>
E0901 11:13:00.483381000 123145484791808 fork_posix.cc:76]             Other threads are currently calling into gRPC, skipping fork() handlers
11:13:00.597     connection.Connection    INFO  BehaviorControl control_granted_response { }
Traceback (most recent call last):
  File "anki_vector/connection.py", line 749, in log_handler
    result = await func(*args, **kwargs)
  File "anki_vector/animation.py", line 168, in load_animation_list
    return await self._load_animation_list()
  File "anki_vector/animation.py", line 134, in _load_animation_list
    result = await self.grpc_interface.ListAnimations(req)
  File "/usr/local/lib/python3.10/site-packages/aiogrpc/channel.py", line 40, in __call__
    return await fut
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.DEADLINE_EXCEEDED
        details = "ListAnimations request timed out"
        debug_error_string = "{"created":"@1662045186.236287000","description":"Error received from peer ipv4:<ROBOT_IP>:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"ListAnimations request timed out","grpc_status":4}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "examples/tutorials/01_hello_world.py", line 34, in <module>
    main()
  File "examples/tutorials/01_hello_world.py", line 28, in main
    with anki_vector.Robot(args.serial) as robot:
  File "anki_vector/robot.py", line 742, in __enter__
    self.connect(self.behavior_activation_timeout)
  File "anki_vector/robot.py", line 663, in connect
    anim_request = self._anim.load_animation_list()
  File "anki_vector/connection.py", line 806, in result
    return future.result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "anki_vector/connection.py", line 751, in log_handler
    raise connection_error(rpc_error) from rpc_error
anki_vector.exceptions.VectorTimeoutException: StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

@TylerGubala did you experience similar issues?

Also, @TylerGubala did the update of proto files reduce/remove above error thrown when executing SDK requests?

@TylerGubala
Copy link
Author

TylerGubala commented Sep 8, 2022

In order to assess your PR, can you provide information about the protobuf version used

I ran the following command and got the output:

py -m pip show protobuf

Name: protobuf
Version: 4.21.5
Summary:
Home-page: https://developers.google.com/protocol-buffers/
Author: [email protected]
Author-email: [email protected]
License: 3-Clause BSD License
Location: d:\code\vector-python-sdk\venv\lib\site-packages
Requires:
Required-by: googleapis-common-protos


how did you update the pb2 files?

I downloaded protoc here

image

And placed the resulting bin and include files in the following location in the repo:

.protobuf/

image

Then I downloaded the 'extra' Google protobuf libs and placed the google/ folder at the root of the repo like so:

image

This is apparently recommended practice, though I don't love it.

Then in Visual Studio Code (my preferred IDE):

View -> Command Palette -> Tasks: Run Task -> Build protobuf files

image

Otherwise you can rebuild them from the terminal using the following command, assuming your current working directory is the root of the repo:

.protobuf/bin/protoc --python_out=. anki_vector/messaging/*.proto


Also, @TylerGubala did the update of proto files reduce/remove above error thrown when executing SDK requests?

Nope I need help with that one. Not sure why it's happening suddenly. Maybe someone at DDL has a robot and can help with what the reason for that is and all the events.EventHandler WARNING Unknown Event type that I keep getting.

Removes the need for the user to copy the audio files
This keeps their environment "cleaner"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants