diff --git a/.gitignore b/.gitignore index 23391fe..72958bf 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,6 @@ tags .idea .build-cache submodules/flogo-cicd/.build-cache -./Dockerfile \ No newline at end of file +./Dockerfile + +operations/utils \ No newline at end of file diff --git a/action/README.md b/action/README.md new file mode 100644 index 0000000..fed16e6 --- /dev/null +++ b/action/README.md @@ -0,0 +1,32 @@ +# 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 please visit `` . + +# 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](https://github.com/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](pipeline/definition.go) struct .This struct is used to set up [Instance](pipeline/instance.go) of the +pipleine. + +### Initialization. +During the initialization of pipeline instance [Mappers](https://github.com/project-flogo/core/blob/master/data/mapper/mapper.go) are set up for Input and Output of the CML. +[Operations](operation/operation.go) (defined in the CML spec) are also initialized. The Registered operations are fetched and initialized using +[factories](operation/registry.go). 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](https://github.com/project-flogo/core/blob/master/data/mapper/mapper.go) +, [Resolvers](https://github.com/project-flogo/core/blob/master/data/resolve/resolve.go), [Scope](https://github.com/project-flogo/core/blob/master/data/resolve/scope.go). 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 diff --git a/action/example/operation/go.mod b/action/example/operation/go.mod deleted file mode 100644 index 8812da0..0000000 --- a/action/example/operation/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module github.com/project-flogo/operation/math - -go 1.12 - -require ( - github.com/project-flogo/catalystml-flogo/action v0.0.0-20191016133650-3f39d84d181e // indirect - github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.4.0 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect - github.com/xeipuuv/gojsonschema v1.2.0 // indirect - go.uber.org/multierr v1.2.0 // indirect - go.uber.org/zap v1.10.0 // indirect - gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect - gopkg.in/yaml.v2 v2.2.4 // indirect -) diff --git a/action/example/samplefps/bin/samplefps b/action/example/samplefps/bin/samplefps deleted file mode 100755 index 8498f69..0000000 Binary files a/action/example/samplefps/bin/samplefps and /dev/null differ diff --git a/examples/README.MD b/examples/README.MD index 893c450..a837257 100644 --- a/examples/README.MD +++ b/examples/README.MD @@ -1 +1,12 @@ # CatalystML-Flogo implementaion Examples + +# Usage + +## Standalone Flogo App with Catalyst Ml. + + +## Flogo App with Flogo Flow and Catalyst Ml. + +## Go App as Flogo App and Catalyst Ml. + +## Standalone Go App with Catalyst Ml. diff --git a/action/example/operation/descriptor.json b/examples/operation/descriptor.json similarity index 100% rename from action/example/operation/descriptor.json rename to examples/operation/descriptor.json diff --git a/examples/operation/go.mod b/examples/operation/go.mod new file mode 100644 index 0000000..92795a4 --- /dev/null +++ b/examples/operation/go.mod @@ -0,0 +1,9 @@ +module github.com/project-flogo/operation/math + +go 1.12 + +require ( + github.com/project-flogo/catalystml-flogo/action v0.0.0 +) + +replace github.com/project-flogo/catalystml-flogo/action => ../../action \ No newline at end of file diff --git a/action/example/operation/go.sum b/examples/operation/go.sum similarity index 100% rename from action/example/operation/go.sum rename to examples/operation/go.sum diff --git a/action/example/operation/metadata.go b/examples/operation/metadata.go similarity index 100% rename from action/example/operation/metadata.go rename to examples/operation/metadata.go diff --git a/action/example/operation/operation.go b/examples/operation/operation.go similarity index 100% rename from action/example/operation/operation.go rename to examples/operation/operation.go diff --git a/action/example/operation/operation_test.go b/examples/operation/operation_test.go similarity index 100% rename from action/example/operation/operation_test.go rename to examples/operation/operation_test.go diff --git a/action/example/samplefps/flogo.json b/examples/samplefps/flogo.json similarity index 100% rename from action/example/samplefps/flogo.json rename to examples/samplefps/flogo.json diff --git a/action/example/samplefps/samplecml.json b/examples/samplefps/samplecml.json similarity index 100% rename from action/example/samplefps/samplecml.json rename to examples/samplefps/samplecml.json diff --git a/action/example/samplefps/src/go.mod b/examples/samplefps/src/go.mod similarity index 97% rename from action/example/samplefps/src/go.mod rename to examples/samplefps/src/go.mod index e4eb3f2..83e9687 100644 --- a/action/example/samplefps/src/go.mod +++ b/examples/samplefps/src/go.mod @@ -14,6 +14,6 @@ require ( ) -replace github.com/project-flogo/catalystml-flogo/action => ../../../ +replace github.com/project-flogo/catalystml-flogo/action => ../../../action replace github.com/project-flogo/operation/math => ../../operation diff --git a/action/example/samplefps/src/go.sum b/examples/samplefps/src/go.sum similarity index 97% rename from action/example/samplefps/src/go.sum rename to examples/samplefps/src/go.sum index 2f98559..265250d 100644 --- a/action/example/samplefps/src/go.sum +++ b/examples/samplefps/src/go.sum @@ -24,6 +24,7 @@ github.com/project-flogo/core v0.9.1 h1:c+nYS1Gf8F+asZmTZdLmKm2rd3phFealR3z30Oep github.com/project-flogo/core v0.9.1/go.mod h1:QGWi7TDLlhGUaYH3n/16ImCuulbEHGADYEXyrcHhX7U= github.com/project-flogo/core v0.9.2 h1:1j7d8e6ivwnhyRudeTRIZlr2XCNa+SERrmcrzKswr0Y= github.com/project-flogo/core v0.9.2/go.mod h1:QGWi7TDLlhGUaYH3n/16ImCuulbEHGADYEXyrcHhX7U= +github.com/project-flogo/core v0.9.4-beta.2 h1:o2aWHasV6bJFALrYDW8S2x521bUfuJ1Ba4Be/uTqGVs= github.com/project-flogo/core v0.9.4-beta.2/go.mod h1:QGWi7TDLlhGUaYH3n/16ImCuulbEHGADYEXyrcHhX7U= github.com/project-flogo/flow v0.9.1 h1:SbfooB8AMd1lvIUA0mBf5RvvJPpH26OK7Mz8lKSgHlE= github.com/project-flogo/flow v0.9.1/go.mod h1:ZvUloTpSwAFTBF8SFPerGRuvJ6DduOuW6UJ2pR3Kvdg= @@ -52,6 +53,7 @@ go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.2.0 h1:6I+W7f5VwC5SV9dNrZ3qXrDB9mD0dyGOi/ZJmYw03T4= go.uber.org/multierr v1.2.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= diff --git a/action/example/samplefps/src/imports.go b/examples/samplefps/src/imports.go similarity index 100% rename from action/example/samplefps/src/imports.go rename to examples/samplefps/src/imports.go diff --git a/action/example/samplefps/src/main.go b/examples/samplefps/src/main.go similarity index 100% rename from action/example/samplefps/src/main.go rename to examples/samplefps/src/main.go