specifying prefix for print(), printToErr() ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

specifying prefix for print(), printToErr() ?

chrisr123

The documentation states that there is a way to specify a prefix msg to
distinguish between different calls to print() (see below), but I have not
found a way to do this? Can anyone show me how I would code this?

What I'd like to do conceptually, and have the prefix msg show up in the
output so I know where I am
in the transformation process:

DataStream<String> myStream = ...
myStream.print("beforeFilter");


DataStream<String> myFilteredStream = myStream.filter(new MyFilter());
myFilteredStream.print("afterFilter");


From Docs:
print() / printToErr() - Prints the toString() value of each element on the
standard out / standard error stream. Optionally, a prefix (msg) can be
provided which is prepended to the output. This can help to distinguish
between different calls to print. If the parallelism is greater than 1, the
output will also be prepended with the identifier of the task which produced
the output.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: specifying prefix for print(), printToErr() ?

Hequn Cheng
Hi chrisr,

The document is misleading. Only DataSet api support prefixed print now. I create a jira for DataStream[1].
For now, you can use a customed SinkFunction to achieve this.


On Sat, Jul 14, 2018 at 10:34 PM, chrisr123 <[hidden email]> wrote:

The documentation states that there is a way to specify a prefix msg to
distinguish between different calls to print() (see below), but I have not
found a way to do this? Can anyone show me how I would code this?

What I'd like to do conceptually, and have the prefix msg show up in the
output so I know where I am
in the transformation process:

DataStream<String> myStream = ...
myStream.print("beforeFilter");


DataStream<String> myFilteredStream = myStream.filter(new MyFilter());
myFilteredStream.print("afterFilter");


From Docs:
print() / printToErr() - Prints the toString() value of each element on the
standard out / standard error stream. Optionally, a prefix (msg) can be
provided which is prepended to the output. This can help to distinguish
between different calls to print. If the parallelism is greater than 1, the
output will also be prepended with the identifier of the task which produced
the output.



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/