1
votes

Can anyone help to fix the following code please?

import pyspark
from pyspark import SparkContext, SparkConf
conf = SparkConf()
conf.setMaster('yarn-cluster')
conf.setAppName('test')
sc = SparkContext.getOrCreate()
r = sc.textFile("data.csv")
r.collect()

It errors out with the following exception:

WARN cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources

I am expecting the collection result will be printed out.

Thanks.

1

1 Answers