edited emr_spark.py