pyspark.Broadcast.dump#
- Broadcast.dump(value,f)[source]#
Write a pickled representation of value to the open file or socket.The protocol pickle is HIGHEST_PROTOCOL.
- Parameters
- valueT
Value to write.
- f
BinaryIO File or socket where the pickled value will be stored.
Examples
>>>importos>>>importtempfile
>>>b=spark.sparkContext.broadcast([1,2,3,4,5])
Write a pickled representation ofb to the open temp file.
>>>withtempfile.TemporaryDirectory(prefix="dump")asd:...path=os.path.join(d,"test.txt")...withopen(path,"wb")asf:...b.dump(b.value,f)