You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by subash basnet <ya...@gmail.com> on 2016/03/13 16:13:07 UTC

KMeans result folder not created

Hello all,

I created KMeans.jar from the source-code and it works fine.
But when I had put the *print* statement before *writeAsCsv, *the result
folder does not get created.
Eg:
clusteredPoints.print();
clusteredPoints.writeAsCsv(outputPath, "\n", " ");
// since file sinks are lazy, we trigger the execution explicitly
env.execute("KMeans Example");

But if I run KMeans.java with above *print* statement via eclipse it works
fine, but why not when I upload it to the flink?
Or is the flink taking long time to process the *print *statement before
reaching *writeAsCsv*?
Or after *print *statement writes to outputstream of JVM, the
*writeAsCsv *doesn't
get executed?

Best Regards,
Subash Basnet

Re: KMeans result folder not created

Posted by Aljoscha Krettek <al...@apache.org>.
Hi,
the problem is that print() eagerly executes the program even before execute() is called. For running the program on a cluster I would suggest to completely remove the “.print()”.

Cheers,
Aljoscha
> On 13 Mar 2016, at 16:13, subash basnet <ya...@gmail.com> wrote:
> 
> Hello all,
> 
> I created KMeans.jar from the source-code and it works fine. 
> But when I had put the print statement before writeAsCsv, the result folder does not get created. 
> Eg: 
> clusteredPoints.print();
> clusteredPoints.writeAsCsv(outputPath, "\n", " ");
> // since file sinks are lazy, we trigger the execution explicitly
> env.execute("KMeans Example");
> 
> But if I run KMeans.java with above print statement via eclipse it works fine, but why not when I upload it to the flink?
> Or is the flink taking long time to process the print statement before reaching writeAsCsv?
> Or after print statement writes to outputstream of JVM, the writeAsCsv doesn't get executed? 
> 
> Best Regards,
> Subash Basnet
>