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
>>> import os >>> import tempfile
>>> b = spark.sparkContext.broadcast([1, 2, 3, 4, 5])
Write a pickled representation of b to the open temp file.
>>> with tempfile.TemporaryDirectory(prefix="dump") as d: ... path = os.path.join(d, "test.txt") ... with open(path, "wb") as f: ... b.dump(b.value, f)