In Scala, we would write an RDD to Redis like this:
datardd.foreachPartition(iter => { val r = new RedisClient(\"hosturl\", 6379) iter.foreach
PySpark's SparkContext has a addPyFile method specifically for this thing. Make the redis module a zip file (like this) and just call this method:
addPyFile
sc = SparkContext(appName = "analyze") sc.addPyFile("/path/to/redis.zip")