Introducing Cloud Foundry CLI Plugin for Managing Predix Analytics Catalog

by Stas TurloSeptember 26, 2016
Using this plugin, you can upload and test your Predix analytics services.

Analytics Catalog is a service in GE Predix that provides a repository for hosting and exposing analytic assets. Today, we’re introducing a Cloud Foundry command-line interface (CF CLI) plugin that enables you to access Predix Analytics Catalog features via the CLI.

For instance, one can add “an analytic” to the catalog, delete it, test it in a Cloud Foundry environment, and download an analytic’s artifact through the CF CLI.

 

Installation

Building from code sources:

  1. Clone the repository.
  2. Go to the repository directory.
  3. Run make.

Binaries or URL:

  1. Copy the URL or download the binary for your platform from the latest release page.
  2. Call cf install-plugin with either the copied URL or the downloaded binary:
cf install-plugin [URL|binary]

To install the plugin from the repository of the Cloud Foundry Community, run the following commands:

cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org/
cf install-plugin cf-predix-analytics-plugin -r CF-Community

 

Managing analytics

To manage analytics, the plugin provides the following commands:

cf analyticsDisplays the list of analytics
cf create-analytic <Analytic name> <path to executable> [-version version] [-author] [-description description] [-taxonomy taxonomy location] [-language (Python|Java|Matlab)] [-metadata custom analytic metadata]Adds an analytic to the catalog
cf delete-analytic <Analytic name>Deletes the specified analytic
cf validate-analytic <Analytic name> <input file path>Validates the analytic
cf deploy-analytic <Analytic name> [-memory mb] [-diskQuota mb] [-instances n]Deploys the analytic
cf run-analytic <Analytic name> <input file path>Runs the analytic
cf analytic-logsGets the recent analytic logs

Here are some of the commands in action:

cf-cli-plugin-for-predix-analytics-catalog

 

Managing analytic’s artifacts

To manage the artifacts of an analytic catalog entry, the plugin provides the following commands:

cf analytic-artifacts <Analytic name>Lists the analytic artifacts
cf get-analytic-artifact <Analytic name> <file name>Downloads the specified analytic artifact
cf add-analytic-artifact <Analytic name> <file path> -type <artifact type> [-description description]Uploads the specified file as an analytic artifact
cf delete-analytic-artifact <Analytic name> <file name>Deletes the specified analytic artifact

For example:

cf-cli-plugin-managing-predix-analytics-artifacts

 

Managing analytics taxonomy

To manage the taxonomy, the plugin provides the following commands:

cf taxonomyRetrieves the full taxonomy structure
cf add-taxonomy taxonomy/to/addAdds a taxonomy to the catalog

For instance:

cf-cli-plugin-managing-predix-analytics-taxonomy

The plugin also provides the analytics-curl command that allows you to execute requests to the targeted Analytics Catalog API endpoint.

cf-cli-plugin-predix-analytics-catalog

For the source code of the solution, visit the plugin’s repository. If you have any questions about working with it, just let me know.

 

Related reading