@@ -130,9 +130,10 @@ def populate(self, *restrictions, suppress_errors=False, return_exception_object
130
130
reserve_jobs = False , order = "original" , limit = None , max_calls = None ,
131
131
display_progress = False , processes = 1 , make_kwargs = None ):
132
132
"""
133
- table.populate() calls table.make(key) for every primary key in self.key_source
134
- for which there is not already a tuple in table.
135
- :param restrictions: a list of restrictions each restrict
133
+ ``table.populate()`` calls ``table.make(key)`` for every primary key in
134
+ ``self.key_source`` for which there is not already a tuple in table.
135
+
136
+ :param restrictions: a list of restrictions each restrict
136
137
(table.key_source - target.proj())
137
138
:param suppress_errors: if True, do not terminate execution.
138
139
:param return_exception_objects: return error objects instead of just error messages
@@ -143,8 +144,10 @@ def populate(self, *restrictions, suppress_errors=False, return_exception_object
143
144
:param display_progress: if True, report progress_bar
144
145
:param processes: number of processes to use. When set to a large number, then
145
146
uses as many as CPU cores
146
- :param make_kwargs: optional dict containing keyword arguments that will be
147
- passed down to each make() call
147
+ :param make_kwargs: Keyword arguments which do not affect the result of computation
148
+ to be passed down to each ``make()`` call. Computation arguments should be
149
+ specified within the pipeline e.g. using a `dj.Lookup` table.
150
+ :type make_kwargs: dict, optional
148
151
"""
149
152
if self .connection .in_transaction :
150
153
raise DataJointError ('Populate cannot be called during a transaction.' )
@@ -178,7 +181,8 @@ def handler(signum, frame):
178
181
error_list = []
179
182
populate_kwargs = dict (
180
183
suppress_errors = suppress_errors ,
181
- return_exception_objects = return_exception_objects )
184
+ return_exception_objects = return_exception_objects ,
185
+ make_kwargs = make_kwargs )
182
186
183
187
if processes == 1 :
184
188
for key in tqdm (keys , desc = self .__class__ .__name__ ) if display_progress else keys :
@@ -209,7 +213,7 @@ def handler(signum, frame):
209
213
if suppress_errors :
210
214
return error_list
211
215
212
- def _populate1 (self , key , jobs , suppress_errors , return_exception_objects ):
216
+ def _populate1 (self , key , jobs , suppress_errors , return_exception_objects , make_kwargs = None ):
213
217
"""
214
218
populates table for one source key, calling self.make inside a transaction.
215
219
:param jobs: the jobs table or None if not reserve_jobs
@@ -230,7 +234,7 @@ def _populate1(self, key, jobs, suppress_errors, return_exception_objects):
230
234
logger .info ('Populating: ' + str (key ))
231
235
self .__class__ ._allow_insert = True
232
236
try :
233
- make (dict (key ))
237
+ make (dict (key ), ** ( make_kwargs or {}) )
234
238
except (KeyboardInterrupt , SystemExit , Exception ) as error :
235
239
try :
236
240
self .connection .cancel_transaction ()
0 commit comments