I'm exploring Java Application Api in IBM Streams, so for it looks promising. I'm able to create topologies and run them in both standalone in distributed mode.
Now I'm trying to see how to invoke R script from Java Topology. One way I'm thinking is to use com.ibm.streams.rproject::RScript operator in my Java topology.
Here is my complete code:
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();
But when I run above topology, i'm getting the following error:
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.
Can you please suggest me what I'm doing wrong? Any insight into using SPL Operators in Java API will help?
Thanks Sudheer