Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在IBM Streams Java应用程序Api中使用RScript运算符?_Java_R_Api_Infosphere Spl_Ibm Streams - Fatal编程技术网

如何在IBM Streams Java应用程序Api中使用RScript运算符?

如何在IBM Streams Java应用程序Api中使用RScript运算符?,java,r,api,infosphere-spl,ibm-streams,Java,R,Api,Infosphere Spl,Ibm Streams,我正在IBM Streams中探索Java应用程序Api,因此它看起来很有前途。我能够创建拓扑,并以分布式模式在两种独立模式下运行它们 现在,我试图了解如何从Java拓扑中调用R脚本。我考虑的一种方法是在Java拓扑中使用com.ibm.streams.rproject::RScript操作符 这是我的完整代码: SPLStream tuples = testTupleStream(topology); //tuples.print(); topology.cr

我正在IBM Streams中探索Java应用程序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();
你能告诉我我做错了什么吗? 了解如何在JavaAPI中使用SPL操作符会有所帮助吗

谢谢
Sudheer

由于这是Java应用程序API,我相信您必须将数据目录属性设置为作业属性的一部分:

提交作业时,可以将属性传递到上下文:StreamsContext.submit(com.ibm.streamsx.topology.topology,java.util.Map)

还有一个Java应用程序API开发指南,您可以在这里找到:

希望这有帮助

萨曼莎

        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.