我有一个Flink java程序,它产生2个输出,我想在文件中写入。我正在使用OpenCSV 4.0,它运行良好。让我们说输出文件应该是x,y,其中x和y是两个输出。当我从IntelliJ IDE运行这个程序时,我得到了这个输出。
这是编写CSV文件的代码
if(write_into_csv && is_job_finished){
String fileName = "/Users/amar/Desktop/out/join.csv";
CSVWriter writer = new CSVWriter(new FileWriter("/Users/amar/Desktop/out/join.csv",true));
writer.writeNext(new String[]{Integer.toString(WindowLength_join__ms), Integer.toString(number_of_joined_events)});
writer.close();
} //if(write_into_csv)
此计划的输出
因为,我必须多次运行这个程序,所以我制作了一个bash文件,运行jar文件多次,然后运行python文件生成图形。 无论如何,问题是在bash文件的情况下输出是这样的
为什么第二个值为零?
bash文件的内容是
#! /bin/bash
clear
jarpath="/Users/amar/Documents/ThesisCode/CEP_Architectures/Mobile_CEP/classes/artifacts/cep_monitoring_jar/cep-monitoring.jar"
flinkpath="/usr/local/Cellar/apache-flink/1.3.2/"
result_file_path="/Users/amar/PycharmProjects/untitled/join_graph.py"
# $flinkpath./bin/historyserver.sh start
for i in {1..3}
do
$flinkpath./bin/flink run $jarpath 500
$flinkpath./bin/flink run $jarpath 1000
$flinkpath./bin/flink run $jarpath 2000
# $flinkpath./bin/flink run $jarpath 2500
# $flinkpath./bin/flink run $jarpath 3000
# $flinkpath./bin/flink run $jarpath 3500
# $flinkpath./bin/flink run $jarpath 4000
done
# $flinkpath./bin/historyserver.sh stop
python $result_file_path
echo "program is complete"