简体   繁体   English

如何获得作业提交时间并在 Flink 应用程序中使用?

[英]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.

相关问题 在使用命令行界面将Flink作业提交到Yarn中时,如何获取应用程序ID? - How to get get Application Id in submitting Flink jobs into Yarn use command line interface? 我可以在同一Flink作业中使用DataSet API和DataStream API吗? - Can I use the DataSet API and the DataStream API in the same Flink job? 我可以使用多个jar将作业提交到flink集群吗 - Can i use multiple jar to submit a job to flink cluster Apache Flink:提交 Flink 作业时出现 NoSuchMethodError - Apache Flink: NoSuchMethodError When Submitting Flink Job 从 IDE 运行 Flink 时如何启动 Flink 作业管理器 web 接口 - How can I start the Flink job manager web interface when running Flink from an IDE 如何在应用层面配置 Flink 作业的参数? - How to configure parameters of Flink job on application level? Flink:如何实时监控作业 - Flink : How to real time monitor a job 如何在独立flink集群中提交flink作业时指定与守护程序日志文件不同的日志文件 - How to specify log file different from daemon log file while submitting a flink job in a standalone flink cluster Flink - 通过 REST API 提交 Flink 作业时如何传递自定义参数 - Flink - How to pass custom parameter when submitting Flink job through REST API Flink 需要 hive conf 目录的本地路径,但是如果我们在纱线上提交 flink 作业,如何提供该路径? - Flink requires local path for hive conf directory but how to give that path if we are submitting flink job on yarn?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM