Skip to content

Commit faf117c

Browse files
committed
alter return type
1 parent 4324a0f commit faf117c

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

datajoint/autopopulate.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ def populate(
173173
:param limit: if not None, check at most this many keys
174174
:param max_calls: if not None, populate at most this many keys
175175
: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
178177
:param make_kwargs: Keyword arguments which do not affect the result of computation
179178
to be passed down to each ``make()`` call. Computation arguments should be
180179
specified within the pipeline e.g. using a `dj.Lookup` table.
@@ -211,6 +210,8 @@ def handler(signum, frame):
211210

212211
keys = keys[:max_calls]
213212
nkeys = len(keys)
213+
if not nkeys:
214+
return
214215

215216
if processes > 1:
216217
processes = min(processes, nkeys, mp.cpu_count())
@@ -222,11 +223,7 @@ def handler(signum, frame):
222223
make_kwargs=make_kwargs,
223224
)
224225

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:
230227
for key in (
231228
tqdm(keys, desc=self.__class__.__name__) if display_progress else keys
232229
):
@@ -256,7 +253,8 @@ def handler(signum, frame):
256253
if reserve_jobs:
257254
signal.signal(signal.SIGTERM, old_handler)
258255

259-
return error_list, nkeys
256+
if not suppress_errors:
257+
return error_list
260258

261259
def _populate1(
262260
self, key, jobs, suppress_errors, return_exception_objects, make_kwargs=None

0 commit comments

Comments
 (0)