Skip to content

Conversation

@Kriechi
Copy link
Contributor

@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
Contributor 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

3 participants