Commit 5591dea3 authored by Loic Esteve's avatar Loic Esteve Committed by Hardik Juneja

Better implementation of effective_n_jobs

to prevent n_jobs <=0
parent 5544b59b
...@@ -79,8 +79,13 @@ if ENABLE_JOBLIB: ...@@ -79,8 +79,13 @@ if ENABLE_JOBLIB:
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.zope_context = kwargs['zope_context'] self.zope_context = kwargs['zope_context']
def effective_n_jobs(self, n_jobs): def effective_n_jobs(self, n_jobs):
# TODO """Dummy implementation to prevent n_jobs <=0
return n_jobs
and allow (sequential) n_jobs=1 and n_jobs != 1 (parallel) behaviour
"""
if n_jobs == 0:
raise ValueError('n_jobs == 0 in Parallel has no meaning')
return abs(n_jobs)
def apply_async(self, batch, callback=None): def apply_async(self, batch, callback=None):
"""Schedule a func to be run""" """Schedule a func to be run"""
portal_activities = self.zope_context.portal_activities portal_activities = self.zope_context.portal_activities
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment