4

我们正在使用 rest api 提交 spark 作业,以在 dcos 集群中触发 master/cluster manager

以下工作完美无缺

休息端点 => 服务/火花/v1/提交/创建

{
"action" : "CreateSubmissionRequest",
"appArgs" : [ "100" ],
"appResource" : "https://<s3 location>/spark-examples-1.5.1-hadoop2.4.0.jar",
"clientSparkVersion" : "1.6.1",
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1",
"SPARK_JAVA_OPTS" : "-Dspark.mesos.coarse=true -Dspark.mesos.executor.docker.image=mesosphere/spark:1.0.0-1.6.1-2"
},
"mainClass" : "org.apache.spark.examples.SparkPi",
"sparkProperties" : {
"spark.jars" : "https://<s3 location>/spark-examples-1.5.1-hadoop2.4.0.jar",
"spark.app.name" : "SparkPi",
"spark.submit.deployMode" : "cluster",
"spark.master" : "mesos://<dcos mesos master>/service/spark/",
"spark.executor.cores" : "1",
"spark.executor.memory" : "2048m",
"spark.cores.max" : "2",
"spark.mesos.executor.docker.image" : "mesosphere/spark:1.0.0-1.6.1-2"
}
}

带有授权标头授权令牌=${token}

当我将它提交到 chronos 休息端点 - /service/chronos/scheduler/iso8601

{
  "schedule": "R10/2016-06-16T08:28:00Z/PT2H",
  "name": "sparkjavachronos",
  "container": {
    "type": "DOCKER",
    "image": "mesosphere/spark:1.0.0-1.6.1-2"
  },
  "cpus": "0.5",
  "mem": "1024",
  "command": "/opt/spark/dist/bin/spark-submit --class org.apache.spark.examples.SparkPi --master mesos://<dcos mesos-master>/service/spark/ --deploy-mode cluster --supervise --executor-memory 2g --total-executor-cores 1 https://<s3 location>/spark-examples-1.5.1-hadoop2.4.0.jar 100"
}

chronos 作业提交正常,授权标头授权令牌=${token},

但是当 chronos 执行命令时,它会以指示请求未经授权的响应结束。有没有办法将令牌转发到命令

或者与集群管理器对话的 chronos 命令如何在具有授权令牌设置的 dcos 中提供令牌。

4

0 回答 0