Skip to content

Commit

Permalink
add python code
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyuan committed Mar 22, 2014
1 parent 47304b3 commit e554b1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class StorageLevels {
public static final StorageLevel MEMORY_AND_DISK_2 = new StorageLevel(true, true, false, true, 2);
public static final StorageLevel MEMORY_AND_DISK_SER = new StorageLevel(true, true, false, false, 1);
public static final StorageLevel MEMORY_AND_DISK_SER_2 = new StorageLevel(true, true, false, false, 2);

public static final StorageLevel TACHYON = new StorageLevel(false, false, true, false, 1);

/**
Expand Down
24 changes: 13 additions & 11 deletions python/pyspark/storagelevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,25 @@ class StorageLevel:
Also contains static constants for some commonly used storage levels, such as MEMORY_ONLY.
"""

def __init__(self, useDisk, useMemory, deserialized, replication = 1):
def __init__(self, useDisk, useMemory, useTachyon, deserialized, replication = 1):
self.useDisk = useDisk
self.useMemory = useMemory
self.useTachyon = useTachyon
self.deserialized = deserialized
self.replication = replication

def __repr__(self):
return "StorageLevel(%s, %s, %s, %s)" % (
self.useDisk, self.useMemory, self.deserialized, self.replication)

StorageLevel.DISK_ONLY = StorageLevel(True, False, False)
StorageLevel.DISK_ONLY_2 = StorageLevel(True, False, False, 2)
StorageLevel.MEMORY_ONLY = StorageLevel(False, True, True)
StorageLevel.MEMORY_ONLY_2 = StorageLevel(False, True, True, 2)
StorageLevel.MEMORY_ONLY_SER = StorageLevel(False, True, False)
StorageLevel.MEMORY_ONLY_SER_2 = StorageLevel(False, True, False, 2)
StorageLevel.MEMORY_AND_DISK = StorageLevel(True, True, True)
StorageLevel.MEMORY_AND_DISK_2 = StorageLevel(True, True, True, 2)
StorageLevel.MEMORY_AND_DISK_SER = StorageLevel(True, True, False)
StorageLevel.MEMORY_AND_DISK_SER_2 = StorageLevel(True, True, False, 2)
StorageLevel.DISK_ONLY = StorageLevel(True, False, False, False)
StorageLevel.DISK_ONLY_2 = StorageLevel(True, False, False, False, 2)
StorageLevel.MEMORY_ONLY = StorageLevel(False, True, False, True)
StorageLevel.MEMORY_ONLY_2 = StorageLevel(False, True, False, True, 2)
StorageLevel.MEMORY_ONLY_SER = StorageLevel(False, True, False, False)
StorageLevel.MEMORY_ONLY_SER_2 = StorageLevel(False, True, False, False, 2)
StorageLevel.MEMORY_AND_DISK = StorageLevel(True, True, False, True)
StorageLevel.MEMORY_AND_DISK_2 = StorageLevel(True, True, False, True, 2)
StorageLevel.MEMORY_AND_DISK_SER = StorageLevel(True, True, False, False)
StorageLevel.MEMORY_AND_DISK_SER_2 = StorageLevel(True, True, False, False, 2)
StorageLevel.TACHYON = StorageLevel(False, False, True, False, 1)

0 comments on commit e554b1e

Please sign in to comment.