为什么在 pyspark 脚本中有多个操作时,dataproc 中只有 1 个作业 ID?

Why is there just 1 job id in dataproc when there are multiple actions in the pyspark script?

spark作业的定义是:

Job- A parallel computation consisting of multiple tasks that gets spawned in response to a Spark action (e.g. save, collect); you'll see this term used in the driver's logs.

那么,为什么每个 spark-submit 在我可以看到的 dataproc 控制台中只创建一个作业 ID?

示例:以下应用程序应该有 2 个 spark 作业

sc.parallelize(range(1000),10).collect()
sc.parallelize(range(1000),10).collect()

Dataproc 作业和 Spark 作业之间存在差异。当您通过 Dataproc API/CLI 提交脚本时,它会创建一个 Dataproc 作业,然后调用 spark-submit 将脚本提交给 Spark。但在 Spark 内部,上面的代码确实创建了 2 个 Spark 作业。您可以在 Spark UI:

中看到它