我正在 IBM Streams 中探索 Java Application Api,因此它看起来很有希望。我能够创建拓扑并在分布式模式下独立运行它们。
现在我正在尝试查看如何从 Java 拓扑中调用 R 脚本。我正在考虑的一种方法是在我的 Java 拓扑中使用 com.ibm.streams.rproject::RScript 运算符。
这是我的完整代码:
SPLStream tuples = testTupleStream(topology);
//tuples.print();
topology.createSubmissionParameter("rCommand", "/usr/local/bin/R --vanilla");
// Filter on the vi attribute, passing the value 321.
Map<String,Object> params = new HashMap<>();
params.put("rObjects", "first, second");
params.put("rScriptFileName", "./etc/print.r");
params.put("streamAttributes", "number1, number2");
//params.put("filter", SPL.createValue(" vi == 321 ", MetaType.BOOLEAN));
SPL.createSubmissionParameter(topology, "rsample", SPL.createValue(true, MetaType.BOOLEAN), true);
//String toolkitRoot = "/opt/ibm/InfoSphere_Streams/4.0.1.0/toolkits";
//SPL.addToolkit(tuples, new File(toolkitRoot));
SPLStream int32Filtered = SPL.invokeOperator("rsampleoperator","com.ibm.streams.rproject::RScript", tuples, tuples.getSchema(), params);
int32Filtered.print();
但是当我在拓扑之上运行时,我收到以下错误:
09 Nov 2015 04:09:53.234 [5407] ERROR #splapptrc,J[5],P[5],rsampleoperator,spl_pe M[PEImpl.cpp:process:841] - CDISR5079E: An exception occurred during the processing of the processing element. The error is: An operator was attempting to access the data directory and no data directory has been specified..
09 Nov 2015 04:09:53.241 [5407] ERROR #splapptrc,J[5],P[5],rsampleoperator,spl_operator M[PEImpl.cpp:process:872] - CDISR5053E: Runtime failures occurred in the following operators: rsampleoperator.
你能告诉我我做错了什么吗?对在 Java API 中使用 SPL 运算符有任何帮助吗?
谢谢苏德希尔