Skip to content

Greengrass v2 IPC Connection and Sample #144

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

Merged
merged 3 commits into from
Feb 5, 2021
Merged

Conversation

Kriechi
Copy link
Member

@Kriechi Kriechi commented Jan 25, 2021

This PR incorporates the recommended code pieces or IPCUtils from the official documentation page:
https://docs.aws.amazon.com/greengrass/v2/developerguide/interprocess-communication.html#ipc-requirements

We can simplify and streamline the whole setup and user-facing API by moving and fully integrating this code snippet / requirement from the documentation page into the awsiotsdk and providing a wrapper function.

The new awsiot.greengrasscoreipc.connect() function is "ready to use" without function arguments, but can also be supplied with arguments to customize the behaviour of the returned GreengrassCoreIPCClient. You can also pass in a LifecycleHandler, which the original documentation-based code snippet did not explain or provide.

The new example ipc_greengrass.py is a simple GGv2 component which periodically publishes small json-based telementry events to IoT Core - throught the GGv2 IPC connection layer. The necessary component recipe snippets are included in the comment block at the top of the sample.

This PR includes 3 commits (feel free to cherry pick):

  • IPC connection management and an GGv2 sample component
  • greengrasscoreipc documentation RST files
  • a fresh rendering of all docs pages (including the newly added ones)

Follow-up action items after this PR is merged and a new awsiotsdk version is released:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Kriechi
Copy link
Member Author

Kriechi commented Jan 27, 2021

@JonathanHenson small thought: does it makes sense to have the port number as argument here? Connecting to a local socket probably ignore the port anyway?

edit: I removed the port and renamed the hostname argument to ipc_socket.

@JonathanHenson
Copy link
Contributor

@JonathanHenson small thought: does it makes sense to have the port number as argument here? Connecting to a local socket probably ignore the port anyway?

edit: I removed the port and renamed the hostname argument to ipc_socket.

port is unused if you use a local domain socket, but leaving port in with a default makes sense if you want to be able to support other socket types or transports in the future. One thing though, I think we're supposed to be using kwargs** everywhere for backwards compat purposes, let's have @graebm have a look and if he's fine with this, merge it.

@graebm graebm merged commit a7739a6 into aws:main Feb 5, 2021
@Kriechi Kriechi deleted the ipc-example branch February 5, 2021 18:30
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.

3 participants