无服务器 Dataproc 错误 - 需要批 ID
Serverless Dataproc Error- Batch ID is required
尝试使用无服务器 Dataproc 提交 spark 作业时使用 rest API
https://cloud.google.com/dataproc-serverless/docs/quickstarts/spark-batch#dataproc_serverless_create_batch_workload-drest
curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://dataproc.googleapis.com/v1/projects/project-id/locations/region/batches"
我收到了这个错误响应
{
"error": {
"code": 400,
"message": "Batch ID is required",
"status": "INVALID_ARGUMENT"
}
}
我在这里错过了什么?
我用 gcloud 测试过 --log-http
:
$ gcloud dataproc batches submit spark --log-http \
--jars=file:///usr/lib/spark/examples/jars/spark-examples.jar \
--class=org.apache.spark.examples.SparkPi \
-- 1000
...
==== request start ====
uri: https://dataproc.googleapis.com/v1/projects/my-project/locations/us-west1/batches?alt=json&batchId=21dd24ca279a4603926d4e59d65bfaf9&requestId=21dd24ca279a4603926d4e59d65bfaf9
method: POST
...
注意 URL 中的 batchId=21dd24ca279a4603926d4e59d65bfaf9
。
我还测试了手动设置 ID --batch
:
$ gcloud dataproc batches submit spark --log-http \
--batch=foobar \
--jars=file:///usr/lib/spark/examples/jars/spark-examples.jar \
--class=org.apache.spark.examples.SparkPi \
-- 1000
...
==== request start ====
uri: https://dataproc.googleapis.com/v1/projects/my-project/locations/us-west1/batches?alt=json&batchId=foobar&requestId=c7b5a753cac4483da21b1ba1c6c2a2d1
method: POST
...
似乎 REST API 在 URL 中需要一个 batchId
参数,但是当使用 gcloud 时它会自动生成一个。
尝试使用无服务器 Dataproc 提交 spark 作业时使用 rest API https://cloud.google.com/dataproc-serverless/docs/quickstarts/spark-batch#dataproc_serverless_create_batch_workload-drest
curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://dataproc.googleapis.com/v1/projects/project-id/locations/region/batches"
我收到了这个错误响应
{
"error": {
"code": 400,
"message": "Batch ID is required",
"status": "INVALID_ARGUMENT"
}
}
我在这里错过了什么?
我用 gcloud 测试过 --log-http
:
$ gcloud dataproc batches submit spark --log-http \
--jars=file:///usr/lib/spark/examples/jars/spark-examples.jar \
--class=org.apache.spark.examples.SparkPi \
-- 1000
...
==== request start ====
uri: https://dataproc.googleapis.com/v1/projects/my-project/locations/us-west1/batches?alt=json&batchId=21dd24ca279a4603926d4e59d65bfaf9&requestId=21dd24ca279a4603926d4e59d65bfaf9
method: POST
...
注意 URL 中的 batchId=21dd24ca279a4603926d4e59d65bfaf9
。
我还测试了手动设置 ID --batch
:
$ gcloud dataproc batches submit spark --log-http \
--batch=foobar \
--jars=file:///usr/lib/spark/examples/jars/spark-examples.jar \
--class=org.apache.spark.examples.SparkPi \
-- 1000
...
==== request start ====
uri: https://dataproc.googleapis.com/v1/projects/my-project/locations/us-west1/batches?alt=json&batchId=foobar&requestId=c7b5a753cac4483da21b1ba1c6c2a2d1
method: POST
...
似乎 REST API 在 URL 中需要一个 batchId
参数,但是当使用 gcloud 时它会自动生成一个。