2323
2424def _initialize_populate (table , jobs , populate_kwargs ):
2525 """
26- Initialize the process for mulitprocessing .
26+ Initialize the process for multiprocessing .
2727 Saves the unpickled copy of the table to the current process and reconnects.
2828 """
2929 process = mp .current_process ()
@@ -153,6 +153,7 @@ def _jobs_to_do(self, restrictions):
153153 def populate (
154154 self ,
155155 * restrictions ,
156+ keys = None ,
156157 suppress_errors = False ,
157158 return_exception_objects = False ,
158159 reserve_jobs = False ,
@@ -169,6 +170,8 @@ def populate(
169170
170171 :param restrictions: a list of restrictions each restrict
171172 (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.
172175 :param suppress_errors: if True, do not terminate execution.
173176 :param return_exception_objects: return error objects instead of just error messages
174177 :param reserve_jobs: if True, reserve jobs to populate in asynchronous fashion
@@ -206,7 +209,10 @@ def handler(signum, frame):
206209
207210 old_handler = signal .signal (signal .SIGTERM , handler )
208211
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+ )
210216
211217 # exclude "error", "ignore" or "reserved" jobs
212218 if reserve_jobs :
@@ -295,6 +301,7 @@ def _populate1(
295301 :return: (key, error) when suppress_errors=True,
296302 True if successfully invoke one `make()` call, otherwise False
297303 """
304+ # use the legacy `_make_tuples` callback.
298305 make = self ._make_tuples if hasattr (self , "_make_tuples" ) else self .make
299306
300307 if jobs is not None and not jobs .reserve (
0 commit comments