SparkJobServer - validate() 总是在 runJob() 之前被调用

SparkJobServer - is validate() always called before runJob()

根据 SparkJobServer 文档:

validate allows for an initial validation of the context and any provided configuration. If the context and configuration are OK to run the job, returning spark.jobserver.SparkJobValid will let the job execute, otherwise returning spark.jobserver.SparkJobInvalid(reason) prevents the job from running and provides means to convey the reason of failure. In this case, the call immediately returns an HTTP/1.1 400 Bad Request status code. validate helps you preventing running jobs that will eventually fail due to missing or wrong configuration and save both time and resources.

因此我可以假设 validate() 总是在 runJob() 之前被调用吗?

如果我在 validate() 中加载并验证作业配置,我的 runJob() 是否可以假设它已正确加载并且在 validate() 离开的地方可用?

是的,你的假设是正确的。参见 https://github.com/spark-jobserver/spark-jobserver/blob/master/job-server/src/spark.jobserver/JobManagerActor.scala#L268