Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/util/estimate_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ def map(line, params):
tot = 0
for k, v in result_iterator(job.wait()):
tot += v
print (4.0 * tot) / COUNT
print ((4.0 * tot) / COUNT)
6 changes: 0 additions & 6 deletions lib/disco/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ def sort_cmd(filename, sort_buffer_size):
.format(sort_buffer_size, filename), True)
integer_types = (int)

from hashlib import md5
def persistent_hash(input):
return int(md5(str_to_bytes(input)).hexdigest(), 16)

else:

basestring = basestring
Expand Down Expand Up @@ -86,6 +82,4 @@ def sort_cmd(filename, sort_buffer_size):
"-S", sort_buffer_size,
"-o", filename, filename], False)

persistent_hash = hash

integer_types = (int, long)
5 changes: 4 additions & 1 deletion lib/disco/fileutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
HUNK_SIZE = 1 * MB
CHUNK_SIZE = 64 * MB

OS_SEPS = os.sep + (os.altsep or '')


class Chunker(object):
"""
chunks contain hunks
Expand Down Expand Up @@ -137,7 +140,7 @@ def __init__(self):
def writepath(self, pathname, exclude=()):
for file in files(pathname):
name, ext = os.path.splitext(file)
if ext not in exclude:
if ext not in exclude and file.lstrip(OS_SEPS) not in self.NameToInfo:
self.write(file, file)

def writemodule(self, module, arcname=None):
Expand Down
4 changes: 2 additions & 2 deletions lib/disco/worker/classic/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
some default values, as well as otherwise useful functions.
"""
import re
from disco.compat import pickle_loads, pickle_dumps, bytes_to_str, str_to_bytes, sort_cmd, persistent_hash
from disco.compat import pickle_loads, pickle_dumps, bytes_to_str, str_to_bytes, sort_cmd
from disco.error import DataError
from disco.worker.task_io import *

Expand Down Expand Up @@ -126,7 +126,7 @@ def init(input_iter, params):
"""

def default_partition(key, nr_partitions, params):
return persistent_hash(key) % nr_partitions
return hash(key) % nr_partitions

def make_range_partition(min_val, max_val):
"""
Expand Down