action

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

README

Introduction

This is a Flogo Action implementation of the CatalystMl Specification. It can also act as a standalone Go implementation of the CatalystMl. For more information about Flogo Action .

Installation

To get started with building CML apps with flogo install the following plugin.

flogo plugin install github.com/project-flogo/catalystml-flogo/plugin

To build the project. Just do normal build.

flogo build

Implementation Details :

This Flogo Action creates a pipeline of the operations specified in JSON spec and executes it sequentially. One of the challenging aspect of the pipeline is resolving the data in the spec. Mappers, Resolvers and Scope Interfaces provided by Project-Flogo core reposisotiry is used to simplify the resolution of data. For more information please visit Project-flogo/core.

Detailed Implementation:

The implementation of CML specification in Flogo can be divided into three steps:

  • Configuration.
  • Initialization.
  • Execution.
Configuration.

The CML JSON spec is unmarshalled into a DefinitionConfig struct .This struct is used to set up Instance of the pipleine.

Initialization.

During the initialization of pipeline instance Mappers are set up for Input and Output of the CML.
Operations (defined in the CML spec) are also initialized. The Registered operations are fetched and initialized using factories. The mappers for input and output of each operation are also initialized.

Execution.

After the initialization, when the action is called, the program iterates over each operation executing it. The input mappers of each operations is resolved before executing it. Only the inputs defined by the operation are sent over for the execution. There can be other variables in the pipeline scope that are not passed in execution of operation. After the execution of operation, the output mappers are resolved and are added in the pipeline scope; even if not needed by further operations. For more information on how mappers and resolvers work Please visit Mappers , Resolvers, Scope. The resolution of input and output is done using pipeline scope . The pipeline scope is nothing but the collection of all the variables, which are the output of each operations and input of CML, and its value . After execution of all the operations the output of the CML is resolved and returned

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	// contains filtered or unexported fields
}

func (*Action) IOMetadata

func (f *Action) IOMetadata() *metadata.IOMetadata

func (*Action) Info

func (f *Action) Info() *action.Info

func (*Action) Metadata

func (f *Action) Metadata() *action.Metadata

func (*Action) Run

func (f *Action) Run(context context.Context, inputs map[string]interface{}) (map[string]interface{}, error)

Run runs the instance of the CML pipeline.

type ActionFactory

type ActionFactory struct {
	// contains filtered or unexported fields
}

func (*ActionFactory) Initialize

func (f *ActionFactory) Initialize(ctx action.InitContext) error

func (*ActionFactory) New

func (f *ActionFactory) New(config *action.Config) (action.Action, error)

New returns the Action from the config.

type Input

type Input struct {
	Input interface{} `md:"input"`
}

func (*Input) FromMap

func (i *Input) FromMap(values map[string]interface{}) error

func (*Input) ToMap

func (i *Input) ToMap() map[string]interface{}

type ModelInfo

type ModelInfo struct {
	Framework     string `json:"framework"`
	Tags          string `json:"tags"`
	SignatureDefs string `json:"signatureDefs"`
}

type Output

type Output struct {
	Output map[string]interface{} `md:"output"`
}

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

type Settings

type Settings struct {
	Model         *ModelInfo `json:"model"`
	CatalystMlURI string     `md:"catalystMlURI,required"`
}

Directories

Path Synopsis
support

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL