@@ -160,7 +160,6 @@ def populate(
160
160
max_calls = None ,
161
161
display_progress = False ,
162
162
processes = 1 ,
163
- return_success_count = False ,
164
163
make_kwargs = None ,
165
164
):
166
165
"""
@@ -177,12 +176,13 @@ def populate(
177
176
:param max_calls: if not None, populate at most this many keys
178
177
:param display_progress: if True, report progress_bar
179
178
:param processes: number of processes to use. Set to None to use all cores
180
- :param return_success_count: if True, return the count of successful `make()` calls.
181
- If suppress_errors is also True, returns a tuple: (success_count, errors)
182
179
:param make_kwargs: Keyword arguments which do not affect the result of computation
183
180
to be passed down to each ``make()`` call. Computation arguments should be
184
181
specified within the pipeline e.g. using a `dj.Lookup` table.
185
182
:type make_kwargs: dict, optional
183
+ :return: a dict with two keys
184
+ "success_count": the count of successful ``make()`` calls in this ``populate()`` call
185
+ "error_list": the error list if "suppress_errors" is set to True, otherwise None
186
186
"""
187
187
if self .connection .in_transaction :
188
188
raise DataJointError ("Populate cannot be called during a transaction." )
@@ -275,12 +275,10 @@ def handler(signum, frame):
275
275
if reserve_jobs :
276
276
signal .signal (signal .SIGTERM , old_handler )
277
277
278
- if suppress_errors and return_success_count :
279
- return sum (success_list ), error_list
280
- if suppress_errors :
281
- return error_list
282
- if return_success_count :
283
- return sum (success_list )
278
+ return {
279
+ "success_count" : sum (success_list ),
280
+ "error_list" : error_list if suppress_errors else None ,
281
+ }
284
282
285
283
def _populate1 (
286
284
self , key , jobs , suppress_errors , return_exception_objects , make_kwargs = None
@@ -291,7 +289,8 @@ def _populate1(
291
289
:param key: dict specifying job to populate
292
290
:param suppress_errors: bool if errors should be suppressed and returned
293
291
:param return_exception_objects: if True, errors must be returned as objects
294
- :return: (key, error) when suppress_errors=True, otherwise None
292
+ :return: (key, error) when suppress_errors=True,
293
+ True if successfully invoke one `make()` call, otherwise None
295
294
"""
296
295
make = self ._make_tuples if hasattr (self , "_make_tuples" ) else self .make
297
296
0 commit comments