I run apache spark java job on google dataproc. The job creates spark context, analyses logs and finally closes the spark context. Then creates another spark context for another set of analysis. This continues for 50-60 times. Sometimes I get the error Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources repeatedly.
Based on answers on SO, this occurs when there isn't enough resource available while starting the job. But this usually happens mid job.
I want the dataproc job to error out and exit. But instead the job just logs this error. How can I make the job to fail. Also how can I prevent this error.