[英]how can I get job submitting time and use it in Flink application?
I'm currently developing a stream processing application, one of the functionality is to take events that happen in the time zone [time of submitting the job, time of submitting the job + T ].我目前正在开发一个 stream 处理应用程序,其中一个功能是获取在时区发生的事件 [提交作业的时间,提交作业的时间 + T]。
how can access to that particular variable (time of submitting the job) with stream processing APIs in Flink?如何使用 Flink 中的 stream 处理 API 访问该特定变量(提交作业的时间)?
Thank you.谢谢你。
One possible way is to use Flink's ParameterTool
一种可能的方法是使用 Flink 的ParameterTool
https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/best_practices.html#getting-your-configuration-values-into-the-parametertool https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/best_practices.html#getting-your-configuration-values-into-the-parametertool
ParameterTool parameters = ParameterTool.fromArgs(args);
// set up the execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setGlobalJobParameters(parameters);
You can pass the timestamp through CLI parameters or simply get the system time in java code.您可以通过 CLI 参数传递时间戳,也可以简单地在 java 代码中获取系统时间。 With GlobalJobParameters
, you can access the time in any operators through the context
.使用GlobalJobParameters
,您可以通过context
访问任何运算符中的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.