23
23
24
24
def _initialize_populate (table , jobs , populate_kwargs ):
25
25
"""
26
- Initialize the process for mulitprocessing .
26
+ Initialize the process for multiprocessing .
27
27
Saves the unpickled copy of the table to the current process and reconnects.
28
28
"""
29
29
process = mp .current_process ()
@@ -153,6 +153,7 @@ def _jobs_to_do(self, restrictions):
153
153
def populate (
154
154
self ,
155
155
* restrictions ,
156
+ keys = None ,
156
157
suppress_errors = False ,
157
158
return_exception_objects = False ,
158
159
reserve_jobs = False ,
@@ -169,6 +170,8 @@ def populate(
169
170
170
171
:param restrictions: a list of restrictions each restrict
171
172
(table.key_source - target.proj())
173
+ :param keys: The list of keys (dicts) to send to self.make().
174
+ If None (default), then use self.key_source to query they keys.
172
175
:param suppress_errors: if True, do not terminate execution.
173
176
:param return_exception_objects: return error objects instead of just error messages
174
177
:param reserve_jobs: if True, reserve jobs to populate in asynchronous fashion
@@ -206,7 +209,10 @@ def handler(signum, frame):
206
209
207
210
old_handler = signal .signal (signal .SIGTERM , handler )
208
211
209
- keys = (self ._jobs_to_do (restrictions ) - self .target ).fetch ("KEY" , limit = limit )
212
+ if keys is None :
213
+ keys = (self ._jobs_to_do (restrictions ) - self .target ).fetch (
214
+ "KEY" , limit = limit
215
+ )
210
216
211
217
# exclude "error", "ignore" or "reserved" jobs
212
218
if reserve_jobs :
@@ -295,6 +301,7 @@ def _populate1(
295
301
:return: (key, error) when suppress_errors=True,
296
302
True if successfully invoke one `make()` call, otherwise False
297
303
"""
304
+ # use the legacy `_make_tuples` callback.
298
305
make = self ._make_tuples if hasattr (self , "_make_tuples" ) else self .make
299
306
300
307
if jobs is not None and not jobs .reserve (
0 commit comments