@@ -173,8 +173,7 @@ def populate(
173
173
:param limit: if not None, check at most this many keys
174
174
:param max_calls: if not None, populate at most this many keys
175
175
:param display_progress: if True, report progress_bar
176
- :param processes: number of processes to use. When set to a large number, then
177
- uses as many as CPU cores
176
+ :param processes: number of processes to use. Set to None to use all cores
178
177
:param make_kwargs: Keyword arguments which do not affect the result of computation
179
178
to be passed down to each ``make()`` call. Computation arguments should be
180
179
specified within the pipeline e.g. using a `dj.Lookup` table.
@@ -211,6 +210,8 @@ def handler(signum, frame):
211
210
212
211
keys = keys [:max_calls ]
213
212
nkeys = len (keys )
213
+ if not nkeys :
214
+ return
214
215
215
216
if processes > 1 :
216
217
processes = min (processes , nkeys , mp .cpu_count ())
@@ -222,11 +223,7 @@ def handler(signum, frame):
222
223
make_kwargs = make_kwargs ,
223
224
)
224
225
225
- if processes < 0 :
226
- raise ValueError ("processes must not be negative" )
227
- elif processes == 0 :
228
- return error_list , nkeys
229
- elif processes == 1 :
226
+ if processes == 1 :
230
227
for key in (
231
228
tqdm (keys , desc = self .__class__ .__name__ ) if display_progress else keys
232
229
):
@@ -256,7 +253,8 @@ def handler(signum, frame):
256
253
if reserve_jobs :
257
254
signal .signal (signal .SIGTERM , old_handler )
258
255
259
- return error_list , nkeys
256
+ if not suppress_errors :
257
+ return error_list
260
258
261
259
def _populate1 (
262
260
self , key , jobs , suppress_errors , return_exception_objects , make_kwargs = None
0 commit comments