gpt4 book ai didi

curl - Apache Spark 休息 API

转载 作者:行者123 更新时间:2023-12-02 03:34:18 24 4
gpt4 key购买 nike

我正在使用 log4j 属性的 Spark-submit 命令来调用 Spark-submit,如下所示:

/opt/spark-1.6.2-bin-hadoop2.6/bin/spark-submit \
--driver-java-options \
"-Dlog4j.configuration=file:/home/test_api/log4j-driver.properties\ --class Test testing.jar

如何--driver-java-options通过curl(Apache Spark的隐藏REST API)提交作业?

我试过这个:

curl -X POST http://host-ip:6066/v1/submissions/create --header "Content-Type:application/json;charset=UTF-8" --data '{
"action" : "CreateSubmissionRequest",
"appArgs" : [ "" ],
"appResource" : "hdfs://host-ip:9000/test/testing.jar",
"clientSparkVersion" : "1.6.2",
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass" : "Test",
"spark.driver.extraJavaOptions" : "-Dlog4j.configuration=file:/home/test_api/log4j-driver.properties",
"sparkProperties" : {
"spark.jars" : "hdfs://host-ip:9000/test/testing.jar",
"spark.app.name" : "Test",
"spark.eventLog.enabled": "true",
"spark.eventLog.dir": "hdfs://host-ip:9000/test/spark-events",
"spark.submit.deployMode" : "cluster",
"spark.master" : "spark://host-ip:7077"
}
}'

作业提交成功并给出响应,但有一个未知字段:

{
"action" : "CreateSubmissionResponse",
"message" : "Driver successfully submitted as driver-20160810210057-0091",
"serverSparkVersion" : "1.6.2",
"submissionId" : "driver-20160810210057-0091",
"success" : true,
"unknownFields" : [ "spark.driver.extraJavaOptions" ]
}

“unknownFields”:[“spark.driver.extraJavaOptions”]

我还尝试了driverExtraJavaOptions,如下所示:

curl -X POST http://host-ip:6066/v1/submissions/create --header "Content-Type:application/json;charset=UTF-8" --data '{
"action" : "CreateSubmissionRequest",
"appArgs" : [ "" ],
"appResource" : "hdfs://host-ip:9000/test/testing.jar",
"clientSparkVersion" : "1.6.2",
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass" : "Test",
"driverExtraJavaOptions" : "-Dlog4j.configuration=file:/home/test_api/log4j-driver.properties",
"sparkProperties" : {
"spark.jars" : "hdfs://host-ip:9000/test/testing.jar",
"spark.app.name" : "Test",
"spark.eventLog.enabled": "true",
"spark.eventLog.dir": "hdfs://host-ip:9000/test/spark-events",
"spark.submit.deployMode" : "cluster",
"spark.master" : "spark://host-ip:7077"
}
}'

但得到了类似的回应:

{
"action" : "CreateSubmissionResponse",
"message" : "Driver successfully submitted as driver-20160810211432-0094",
"serverSparkVersion" : "1.6.2",
"submissionId" : "driver-20160810211432-0094",
"success" : true,
"unknownFields" : [ "driverExtraJavaOptions" ]
}

这是为什么?
我看了spark-submit.scala并引用了 Spark REST API

最佳答案

现在可以将 Dlog4j.configuration=file:///(///本地文件的路径)并将spark.driver.extraJavaOptions 放入sparkProperties

curl -X POST http://host-ip:6066/v1/submissions/create --header "Content-Type:application/json;charset=UTF-8" --data '{
"action" : "CreateSubmissionRequest",
"appArgs" : [ "" ],
"appResource" : "hdfs://host-ip:9000/test/testing.jar",
"clientSparkVersion" : "1.6.2",
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass" : "Test",
"sparkProperties" : {
"spark.jars" : "hdfs://host-ip:9000/test/testing.jar",
"spark.driver.extraJavaOptions" : "-Dlog4j.configuration=file:///home/log4j-driver.properties",
"spark.app.name" : "Test",
"spark.eventLog.enabled": "true",
"spark.eventLog.dir": "hdfs://host-ip:9000/test/spark-events",
"spark.submit.deployMode" : "client",
"spark.master" : "spark://host-ip:7077"
}
}'

关于curl - Apache Spark 休息 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38883853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com