创建分析算法目录服务Analytics Catalog
开发好的分析代码,要上传到分析算法目录服务上,才可以执行。目录服务上的每一项里必须包含一个可执行的程序,用来部署到分析平台上,另外还可以存放文档,测试数据等相关文件。
创建流程如下
1. 预先创建好UAA
2. 在网页上订阅Analytics Catalog服务,选择一个UAA服务实例
3. 在UAA中创建client_id,并配置上权限,Catalog需要的权限是analytics.zones.<catalog_service_instance_guid>.user,guid可以通过cf service <service_name> --guid获得。
4. 使用Postman上传分析应用。
5. 使用Postman执行分析应用验证和部署。
6. 分析应用可正常使用.
制作数据接口定义文件
之前,我们已经用Python/java/matlab写好了分析的代码, 并打包完毕, 现在需要制作对应的数据接口定义文件
数据端口定义文件定义了分析应用数据输入和输出的格式以及类型,如果分析应用要做为一个任务编排,那么这个定义文件是必须提供的。
{ "analyticName":<string>, "analyticVersion":<string>, "comment":[<string>], "inputPortDefinitions":[<List of PortDefinition>], "inputModelDefinitions":[<List of InputModel>], "outputPortDefinitions":[<List of PortDefinition>] }PortDefinition的基本格式如下
{ "comment":[<string>], "portName":<string>, "portType":<string>, "variable":<boolean> }
{ "comment": [<string>], "portName": <string>, "portType": <string>, "variable": <boolean>, "columns": [<List of FieldPorts>] }
{ "comment":[<string>], "portName":<string>, "portType":<string>, "variable":<boolean>, "childrenPorts":[<List of PortDefinition>] }
{ "analyticName": "analyticWith2ColumnsAnd1Constant", "analyticVersion": "V1.0", "inputPortDefinitions": [ { "portType": "COMPOSITE", "portName": "data", "variable": false, "childrenPorts": [ { "portName": "timeseries", "portType": "TIMESERIES_ARRAY", "required": true, "variable": false, "columns": [ { "portName": "column1", "portType": "FIELD", "variable": false, "dataType": "DOUBLE_ARRAY", "required": true }, { "portName": "column2", "portType": "FIELD", "variable": false, "dataType": "DOUBLE_ARRAY", "required": true } ] } ] }, { "portType": "COMPOSITE", "portName": "constants", "childrenPorts": [ { "portType": "FIELD", "portName": "constant1", "variable": false, "dataType": "DOUBLE", "required": true } ] } ], "outputPortDefinitions": [ { "portName": "data", "portType": "COMPOSITE", "required": true, "variable": false, "childrenPorts": [ { "portName": "time_series", "portType": "TIMESERIES_ARRAY", "required": true, "variable": false, "columns": [ { "portName": "results", "portType": "FIELD", "variable": false, "dataType": "DOUBLE_ARRAY", "required": true } ] } ] } ] }
最后把数据接口定义文件和分析代码一起上传到分析应用目录服务中。