[英]Flink what is the proper way to submit args to job from cluster GUI?
我的目標是通過群集GUI中的“程序參數”字段將args傳遞給Flink作業的Main()函數。
並以某種方式在Main()函數中訪問它們(最好是通過鍵名):
public static void main(String[] args) throws Exception {
ParameterTool parameter = ParameterTool.fromArgs(args);
CustomProps props = new CustomProps (DEFAULT_PROPERTIES_FILE);
String kafkaAutoOffsetReset = props.getKafkaAutoOffsetReset();
String cassandraClusterUrl = props.getCassandraClusterUrl();
if (args.length == 1 && args[0] != null) {
cassandraClusterUrl = parameter.get("cassandraClusterUrl");
kafkaAutoOffsetReset = parameter.get("kafkaOffset");
}
//Other code...
}
我已經嘗試過“ ParameterTool”,但沒有任何幫助,如果嘗試以下操作:
kafkaAutoOffsetReset = args[0];
僅當我在“程序參數”字段中僅輸入一個單詞時,它才有效。 所以,如果我把:
blah
它說它設置為“等等”,但是如果我嘗試以下任何一種方法:
-kafkaOffset blah
--kafkaOffset blah
-kafkaOffset:blah
-kafkaOffset=blah
我什么都沒有。 我知道在CLI中,如何將args傳遞給jar的示例是:
--input file:///home/user/hamlet.txt --output file:///home/user/wordcount_out
但是似乎缺少使用GUI的另一種方式,但是我未能找到與此相關的文檔。
TL; DR
通過Flink群集GUI中的“程序參數”字段提交多個arg的正確方法是什么,以及在Main()函數中訪問它們的正確方法是什么?
感謝您提前提供的所有幫助!
程序參數應該在flink中給出,如下所示
--custom.key.one custom.value.one --custom.key.two custom.value.two
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.