Skip to content

Commit 2483c27

Browse files
committed
Merge branch 'release/1.2.1' into develop
2 parents 67f63bc + 63b3e36 commit 2483c27

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.2.1
2+
- Fixed an issue in multiprocessing code.
3+
14
1.2.0
25
- Multiprocessing (by loisaidasam)
36
- Python 3 support

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Untar the archive::
1818
tar xf <filename.tar.gz>
1919

2020
Next, go to the folder just created. It will have the same name as the package
21-
(for example "cluster-1.2.0") and run::
21+
(for example "cluster-1.2.1") and run::
2222

2323
python setup.py install
2424

cluster/matrix.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ def worker(self):
5858
for task in iter(self.task_queue.get, 'STOP'):
5959
col_index, item, item2 = task
6060
result = (col_index, self.combinfunc(item, item2))
61-
self.task_queue.task_done()
6261
self.done_queue.put(result)
6362
tasks_completed += 1
64-
self.task_queue.task_done()
6563
logger.info("Worker %s performed %s tasks",
6664
current_process().name,
6765
tasks_completed)
@@ -117,7 +115,6 @@ def genmatrix(self, num_processes=1):
117115
# blocking operation)
118116
if num_tasks_queued > num_processes:
119117
col_index, result = self.done_queue.get()
120-
self.done_queue.task_done()
121118
row[col_index] = result
122119
num_tasks_completed += 1
123120
else:
@@ -136,7 +133,6 @@ def genmatrix(self, num_processes=1):
136133
# Grab the remaining worker task results
137134
while num_tasks_completed < num_tasks_queued:
138135
col_index, result = self.done_queue.get()
139-
self.done_queue.task_done()
140136
row[col_index] = result
141137
num_tasks_completed += 1
142138

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='cluster',
13-
version='1.2.0',
13+
version='1.2.1',
1414
author='Michel Albert',
1515
author_email='[email protected]',
1616
url='https://github.com/exhuma/python-cluster',

test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ def testUnmodifiedData(self):
164164
[new_data.extend(_) for _ in cl.getlevel(40)]
165165
self.assertEqual(sorted(new_data), sorted(self.__data))
166166

167+
def testMultiprocessing(self):
168+
cl = HierarchicalClustering(self.__data, lambda x, y: abs(x - y),
169+
num_processes=4)
170+
new_data = []
171+
[new_data.extend(_) for _ in cl.getlevel(40)]
172+
self.assertEqual(sorted(new_data), sorted(self.__data))
173+
167174

168175
class HClusterStringTestCase(unittest.TestCase):
169176

0 commit comments

Comments
 (0)