如何使用 yarn rest api 将作业提交到 spark?我想使用 YARN REST API 提交作业以激发

How to submit jobs to spark using yarn rest api? I want to use YARN REST API for submitting job to spark

我正在构建一个用于触发 spark-jobs 和检查作业状态的界面。

我不能使用第 3 方库,如 Livy、spark 作业服务器。我想制作 APIs 用于通过 REST API.

启动和提交作业到 spark 集群

你可以使用 spark jobserver - https://github.com/spark-jobserver/spark-jobserver

更新-

没看到spark job server不能用,可以用下面的

工作提交

curl -X POST http://spark-cluster-ip:6066/v1/submissions/create --header "Content-Type:application/json;charset=UTF-8" --data '{
  "action" : "CreateSubmissionRequest",
  "appArgs" : [ "myAppArgument1" ],
  "appResource" : "file:/myfilepath/spark-job-1.0.jar",
  "clientSparkVersion" : "1.5.0",
  "environmentVariables" : {
    "SPARK_ENV_LOADED" : "1"
  },
  "mainClass" : "com.mycompany.MyJob",
  "sparkProperties" : {
    "spark.jars" : "file:/myfilepath/spark-job-1.0.jar",
    "spark.driver.supervise" : "false",
    "spark.app.name" : "MyJob",
    "spark.eventLog.enabled": "true",
    "spark.submit.deployMode" : "cluster",
    "spark.master" : "spark://spark-cluster-ip:6066"
  }
}

工作状态

curl http://spark-cluster-ip:6066/v1/submissions/status/driver-20151008145126-0000