awslabs / aws-streamer

Video Processing for AWS
Apache License 2.0
44 stars 9 forks source link

Greengrass: Failed to run StreamPipeline: Exception('Failed to make element sink of type kvssink') #7

Closed iamsangeeth closed 3 years ago

iamsangeeth commented 3 years ago

[INFO]-stream_graph.py:45Failed to make element sink of type kvssink [INFO]-stream_client.py:48,Failed to run StreamPipeline: Exception('Failed to make element sink of type kvssink')

Have added kvs to environment.

This error is thrown only when we are running application through greengrass, It is running fine and stream is starting through python3 shell. I have checked path and environment variables compared to python3 shell output. only difference is greengrass application is running at '/lambda' directory. Any thoughts?

bpawlik commented 3 years ago

Have added kvs to environment.

What exactly do you mean by that?

You need include compiled awstreamer (build/awstreamer_py) together with your lambda code. If your greengrass group runs in a container mode, then you can't access anything outside of /lambda, so any references to the build in your filesystem will not work.

Please have a look at examples/greengrass to see how to use this package in greengrass in more detail.

iamsangeeth commented 3 years ago

Thank you for the comments. Situation solved by running greengrass group as "No container" mode (https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-containerization-groupsettings). Able to access kvssink now.
There another case just popped up "Failed to make element source of type nvarguscamerasrc" (same situation like before) Any thoughts?

bpawlik commented 3 years ago

Thank you for the comments. Situation solved by running greengrass group as "No container" mode

Running lambda in no-container mode is a bit brute-force approach and quite unnecessary in this case, but glad it works for you!

There another case just popped up "Failed to make element source of type nvarguscamerasrc" (same situation like before) Any thoughts?

nvarguscamerasrc is NVidia's plug-in, so you need to make sure that you are on NVidia hardware and have all jetpacks and drivers installed. Does it work for your from the shell already?

This being said, NVidia plug-in require access to hardware resources. If run your lambda in recommended container mode, then take a look at this example for what resources may be needed: https://github.com/awslabs/aws-streamer/blob/09525140b4d080e647be2a1a830233318634db8d/examples/greengrass/src/greengrass_template.yml#L187-L227

If you run your lambda in no-container mode, you may have to run it as root: https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html

iamsangeeth commented 3 years ago

Great. I was setting up "no container" mode and changing use to root made it work. Also need to setup "LD_LIBRARY_PATH" and "GST_PLUGIN_PATH" properly at environment variable section inside lambda configuration from aws iot console.

Thank you for help @bpawlik

bpawlik commented 3 years ago

Glad I could help!